name
stringlengths
5
6
title
stringlengths
8
144
abstract
stringlengths
0
2.68k
fulltext
stringlengths
1.78k
95k
keywords
stringlengths
22
532
597050
Supporting Content-Based Retrieval in Large Image Database Systems.
In this paper, we investigate approaches to supporting effective and efficient retrieval of image data based on content. We first introduce an effective block-oriented image decomposition structure which can be used to represent image content in image database systems. We then discuss the application of this image data model to content-based image retrieval. Using wavelet transforms to extract image features, significant content features can be extracted from image data through decorrelating the data in their pixel format into frequency domain. Feature vectors of images can then be constructed. Content-based image retrieval is performed by comparing the feature vectors of the query image and the decomposed segments in database images. Our experimental analysis illustrates that the proposed block-oriented image representation offers a novel decomposition structure to be used to facilitate effective and efficient image retrieval.
Introduction Content-based image retrieval has been proposed to allow retrievals to be performed on the basis of a variety of aspects of image content [1, 5, 15, 10, 6, 2, 18]. In this context, a challenging problem arises with many image databases, within which queries are posed via visual or pictorial examples. We term such queries visual queries. A common visual query to an image database system would involve finding all images in that database which contain a subimage that is similar to a given query image. Such retrievals must use embedded content features, such as the shape, color, texture, layout, and position of various objects in an image. There have not been generic tools which can facilitate to understand image content to a satisfiable extent. The automatic retrieval of images on the basis of content thus pose difficult problems. An approach which has drawn much recent attention involves the extraction of the color and texture features of images using image processing techniques. Currently, most research proposes to formulate image feature vectors based on color and texture characteristics. Content-based image retrieval is then supported by searching and comparing the feature vectors of the query image and database images. As the feature vector of a database image may not correctly represent its subim- ages, the retrieval based on the comparison between the feature vectors of the query image and database images themselves may not provide satisfiable results for visual queries. Thus, image segmentation is necessary in the implementation of feature-based techniques for searching image databases [11]. Effective segmentation will isolate the important features of the images in the database. Ideally, the results generated through the process of image recognition and analysis would be used to automatically segment image content. However, as image recognition itself is still in its formative stage, investigations in this direction are still in their infancy. To avoid manual segmentation of images in a large image database, a block-oriented approach based on quad-tree decomposition of images has been adopted to circumvent the difficulty of automatic segmentation [5, 11]. An effective query-by-texture approach using quad-tree segmentation and wavelet transforms has been presented [11]. The decomposition approach was demonstrated to be effective. In this paper, we conduct a comprehensive study on image data representation and retrieval approaches to support effective and efficient retrieval of image data based on content. We first introduce an effective block-oriented image decomposition structure to be used in content-based image retrieval. This structure is an extension of the quad-tree decomposition. We then discuss the application of this data model to content-based image retrieval. Wavelet transforms are used to extract image features. Significant content features are extracted from image data in their pixel format through decorrelating the image data into frequency domain using wavelets. Feature vectors of images can then be constructed. Content-based image retrieval is performed by comparing the feature vectors of the query image and the segments in database images. Our experimental analysis illustrates that the nona-tree decomposition offers a novel decomposition structure to be used to facilitate effective and efficient image retrieval. The rest of the paper is organized as follows. Section 2 introduces the block-oriented data structure, namely, nona-trees, and discusses the computational complexity of this data structure. Section 3 investigates the application of the nona-tree image representation in content-based image retrieval. Experimental results will be presented in this section. Section 4 offers discussions on the effectiveness of the nona-tree decomposition with different wavelet transforms and compares the effectiveness of the nona-tree decomposition with other block-oriented decomposition approaches. Concluding remarks are offered in Section 5. 2. Image Data Modeling - Nona-trees In this section, we will present the nona-tree image decomposition structure to be used to specify image content in image databases. We then discuss the computational complexity of the nona-tree decomposition structure. 2.1. Nona-tree A nona-tree is a hierarchical image decomposition structure based on a slight modification of the recursive decomposition of images that is proposed in quad-trees [4]. That is, each decomposition on an image segment produces nine subsegments of equal size rather than four. These subsegments include four equal-sized quadrants (numbered 1, 2, 3, and 4), one subsegment of the same size as each quadrant taken from the central area of the image segment (numbered 5) , and four subsegments of the same size as each quadrant produced from the central areas of the upper, bottom, left, and right halves of the image segment (numbered 6, 7, 8 and 9). Figure 1 demonstrates the positions of these subsegments in the decomposed image segment. Figure 1. Nine subsegments in nona-tree decomposition. The decomposition process of a nona-tree can be described recursively with the root representing the entire image and its children representing the decomposed segments which, in turn, are roots for further decomposed segments. Each internal node has at most nine children. The strategy of quad-tree decomposition proposed in [11] can be used in determining the decomposition of subsegments 1, 2, 3 and 4 in the nona-tree. That is, decompositions are only carried out on the segments with heterogeneous textures. Before four children are spawned by each parent, conditions for merging are tested. A distance threshold is computed for each child on the basis of extracted texture features. The distances in the feature space are measured from the parent node to each child. If the distances to all four children fall within the thresholds of the children, a single texture would be declared in the parent node, and no further decomposition is necessary. Otherwise, pair-wise grouping of the children will then be performed. That is, if the distance between two neighboring children falls below the thresholds of both, the children are merged as a single child. Also, whether or not the subsegments 1, 2, 3 and 4 are generated determines the generation of subsegment 5, 6, 7 and 8. We have the following cases: ffl No decomposition of subsegments 1, 2, 3, and 4: a single texture has been declared for the segment. Thus, subsegment 5, 6, 7, 8, and 9 should not be generated. ffl No decomposition of subsegments 1 and 2: a single texture has been declared for the merging of subsegments 1 and 2. Thus, subsegment 6 should not be generated. ffl No decomposition of subsegments 1 and 3: a single texture has been declared for the merging of subsegments 1 and 3. Thus, subsegment 8 should not be generated. ffl No decomposition of subsegments 2 and 4: a single texture has been declared for the merging of subsegments 2 and 4. Thus, subsegment 9 should not be generated. ffl No decomposition of subsegments 3 and 4: a single texture has been declared for the merging of subsegments 3 and 4. Thus, subsegment 7 should not be generated. Those subsegments which do not correspond to any of the above cases are generated in the nona-tree. Figure 2 illustrates the representation of an image by a nona- tree data structure in which the subsegments of each segment are listed in the increasingly numbering order. For example, at the first level of decomposition, the given image is decomposed into nine segments. All segments are heterogeneous and thus further decomposition is needed. At the second level of decomposition, segment 2 obtained from the first level is decomposed into nine subsegments. In this decomposition, subsegments 1, 2, 4, 6 and 9 are homogeneous and all other subsegments are heterogeneous. Other segments can be similarly decomposed. (a) Image (b) Figure 2. (a) Image; (b) Nona-tree. 2.2. Computational Analysis We now discuss the maximum number of segments existing in a nona-tree and analyze the overlapping coverage between a query image and the segments of a database image in the situation of the query image is similar to a subimage of the database image. 2.2.1. Number of Segments in Nona-tree Table 1 illustrates the relationship between image size and nona-tree level. Table 1. Nona-tree level and image size in the hierarchy Level Image Size 256x256 128x128 64x64 32x32 16x16 We will now discuss the maximum number of segments existing in a nona-tree with levels. Clearly, at each level i, there are at most 9 i possible segments. However, there are redundant segments; these start at level two of the nona-tree. We introduce the concept of a representative point for each segment to illustrate the maximum number of segments possible in each nona-tree. The representative point of a segment in a nona-tree refers to the uppermost left point of that segment. Thus, in Figure 3 (a), labeled bold points A through I are representative points for the nine subsegments of the given segment. That is, points A, C, G, I in Figure 3 (a) are representative points for subsegments 1, 2, 3, 4, respectively. Point E represents subsegment 5, and points B, H, D, F represent subsegments 6, 7, 8, 9, respectively. Thus, at level 1, we have 3 \Theta which is 9. Subsegments at the next level are similarly labeled in Figure 3 (b). Note that some of the points represent multiple segments. For example, the point labeled N in Figure 3 (b) represents the shaded area which appears to be a subsegment of segment 1, 5, 6, and 8 at level 1. This subsegment is the fourth subsegment of segment 1, the first subsegment of segment 5, the third subsegment of segment 6, and the second subsegment of segment 8. In Figure 3 (b), there are actually subsegments at the third level of the nona-tree, which can also be expressed as 1). Thus, there are 81 \Gamma redundant subsegments. By analyzing these numbers, at the ith level, we have at most instead of 9 i subsegments. Table 2 lists the maximum number of segments at each level of a nona-tree. Thus, strictly speaking, nona-trees are hierarchical graphs in which nodes in different branches at one level may share common nodes at the next lower level. (a) (b) Figure 3. (a) Segment decomposition and representative points at level 1; (b) Segment decomposition and representative points at level 2. Table 2. Maximum number of segments in nona-tree Level segments in nona-tree 2.2.2. Subimage Coverage The nona-tree decomposition ensures that, if a portion of a decomposed image matches a query image, there then exists a segment which covers at least 9of the query image. Figure 4 illustrates the situation. In this example, we assume that the size of the query image is compatible with that of the first level decomposition. In Figure 4 (a), the shaded area of the query image is ( 3 which is 9 In general, as shown in Figure 4 (b), the covered area A of the query image has the following cases: the area covered by segment 5 is: the area covered by segment 6 is: the area covered by segment 8 is: 4 r: the area covered by segment 1 is: (a) (b) Figure 4. Covered area of query image by segments. Clearly, this also holds when the query image is located in other places within the decomposed image. 3. Texture-based Image Retrieval In this section, we will investigate the application of the proposed image data model to content-based image retrieval in image database systems. A search procedure on the nona-tree is designed to compare the feature vectors between the query image and database images. Wavelet transforms will be used to generate the feature vectors of image segments. 3.1. Searching Nona-trees Let database images be represented by their nona-trees. A procedure of feature generation is then applied to each node in the nona-tree. Thus, each node contains the feature vector of a segment rather than the original pixel data. Also, the feature vector is generated on the basis only of the pixel data of the node rather than the image. We now consider an image database in which all images are represented by their feature vectors in nona-trees. Let Q be an query image. We discuss a procedure for matching the feature vector of the query image with that of the database images. A correspondence is first established between database image contents and feature vectors, and retrievals are then performed on the basis of the relationship between these feature vectors and the feature vectors of query image Q. We can then locate those images within a large image database which contain or are similar to the query image, as governed by set criteria. A relationship between a given query image Q and any image M in the database is determined by comparing the feature vector of Q with different portions of M. This can be done by traveling through the nona-tree of M from the root to the bottom. We use the root mean square metric to compare the distance between the feature vector of the query image and that of the image segments of the database images. That is, for given feature vectors v 1 (a 1 ; :::; an ) and v 2 (b distance is computed as follows: (1) For a given threshold t, if the distance between the query image and a segment of a database image is less than t, then we select this database image as a matched image. Note that the above search of individual nona-trees may be highly time consum- ing. However, this problem can be circumvented by a novel indexing technique on the feature vectors generated from the image segments. Consider a feature space which contains all generated feature vectors of image segments. An indexing technique can be constructed to classify the feature vectors into different clusters based on their distances in the feature space [7]. For a given query image, an efficient retrieval can then be supported by search through the index. The details to construct an index on the feature space will not be discussed further in this paper. 3.2. Wavelet Transforms A wide variety of wavelet-based image compression schemes have been reported in the literature. In this approach, compression is accomplished by applying a wavelet transform to decorrelate the image data, quantizing the resulting transform coefficients, and coding the quantized values. The central part of this process, wavelet transform, is what we want to examine. The data transformed by wavelets can be utilized for content-based retrieval. Wavelet transform is a type of signal representation that can give the frequency content of the signal at a particular instant of time. Initially, regions of similar texture need to be separated out. This may be achieved by decomposing the image in the frequency domain into a full subband tree using filter banks [16]. In order to explore the advantage of deriving the texture features from compressed image format, the wavelet transform can be used for the subband decomposition [9]. Each of the subbands obtained after filtering has uniform texture information. Typical methods like energy estimation in subbands are used for feature extraction from the subbands. Wavelet based subband coding allows simultaneously for high spatial resolution at high spatial frequencies and high spatial-frequency resolution at low spatial fre- quencies. Thus a filter bank based on wavelets could be used to decompose the image into low-pass and high-pass spatial-frequency bands [8]. Using a specific wavelet transform, feature extraction is performed on all image segments in the nona-trees. Three-level of subband decomposition is used [9]. Each of the subbands obtained after filtering have uniform texture information. In our experiments, the feature extraction was performed using Daubechies wavelet transform [14]. Each three-level transformation produces 10 subbands. The features were extracted by energy estimation in subbands. Two energy features, mean and variance, are computed on each subband. Thus, each feature vector has 20 ele- ments. This feature extraction procedure is applied to all image segments in the tree representation of each image. Each node in the nona-tree thus represents a segment of the image and its feature vector. 3.3. Experiments A testbed of the image database has been constructed from Brodatz texture images [3] and their variants. There are 112 different textures and 20 samples with each texture. The images are 96 \Theta 96 pixels in size. The query images were chosen as random subimages of randomly chosen Brodatz images. Given a query image, its feature vector is calculated using the above feature extraction approach. We then compare the distance between the query image and the image segments of the database images with a size greater than or equal to the size of the query image. Figure 5 presents four query images with the size 24 \Theta 24 pixels, each of which is associated with the best selected four database images based on the distance comparison. The number under each database image in the figure indicates the distance between this database image and the given query image. d001p d001j d001d d095p (a) d067m d067d d041j d067i (b) d077o d077s d077n d077t (c) d105k d076t d076o d105l (d) Figure 5. Iconic images and matched database images Let the position of each pixel in the image be represented by (x; y) coordinates, where x refers to the column position and y refers to the row position. Let (0; coordinates be at the most upper left point of the image. Table 3 presents the positions of the matched segments within the database images shown in Figure 5. For example, for query image Figure 5 (a), a matched segment was found in image d001p at the position of the 48th row and the 48th column with the size 24 \Theta 24 pixels. This segment appear to be the subsegment 1 of segment 3 at the first depth nona-tree decomposition. Similarly, a matched segment was found in image d001j at the position of the 0th column and 24th row with the size 24 \Theta 24 pixels. This segment appear to be the subsegment 3 of segment 1 at the first depth nona-tree decomposition. The exact positions of the matched segments are illustrated in Figure 5. Table 3. Positions of matched image segments in database images Test Image matched segment position size d001d (12,60) 24x24 d067d (48,0) 24x24 d077s (36,0) 24x24 d077n (0,12) 24x24 d077t (48,48) 24x24 d076t (24,72) 24x24 d105l (48,48) 24x24 Database images belonging to different texture groups but containing closely similar texture features may fall within a very small distance. As indicated in Figure 5, for example, d105k, d105l and d076t, d076o are in two different texture groups. However, the texture features in the two group contain closely similar texture fea- tures. A similar situation also occurs to the groups of d001 and d095. Note that the selection of the threshold is application dependent. As shown in Figure 5, the minimum distance between similar images varies with different images. Also, note that some semantically irrelevant images may have feature vectors that fall within a very small distance. To prevent the retrieval of such irrelevant images, a clustering approach is needed to classify the images into different categories before retrieval is performed [20]. 4. Discussions In this section, we will discuss the retrieval effectiveness of the nona-tree decomposition using different wavelet transforms and compare the effectiveness of the nona-tree decomposition with other block-oriented decomposition approaches. We will also compare the block-oriented decomposition strategy with the traditional moving window analysis [13]. 4.1. Retrieval Effectiveness with Different Wavelets We now discuss the retrieval effectiveness of the nona-tree using different types of wavelet transforms. The retrieval effectiveness was calculated in terms of recall and precision [17]. Recall is defined as the ratio of the number of relevant images retrieved to that of the total relevant images in the database: Precision is the ratio of the number of relevant images retrieved to that of all the images retrieved: retrieved The retrieval effectiveness for given query images varies on several aspects, including the locations of subimages in database images to which the query image is found to be similar, the size of query images and the types of wavelet transforms used to generate feature vectors. In order to evaluate the retrieval effectiveness of various wavelet transforms, experiments were performed on two different types of wavelet transforms - Haar and Daubechies. Figure 6 presents the results of the retrieval experiments with these two wavelet transforms, while the query images are located close to the central areas of the upper, bottom, left, or right halves of the image segments of the database images. Based on these experiments, we see that the Daubechies with six coefficients is superior to the Daubechies with four coefficients and Haar in cases (a), (c), and (d). We also observe that Haar transform is superior to the Daubechies in case (b). Based on the experiments, the retrieval effectiveness of the nona-tree using wavelet transforms varies with application domains. Thus, the type of wavelet transform plays an important role in retrieval effectiveness. Experiments must be performed to determine which particular wavelet transform is best suited to any specific application domain. Haar Precision Haar Precision Recall0.300.400.500.600.700.800.901.00 (a) left (b) right Haar Precision Recall0.600.700.800.901.00 Haar Precision Recall0.300.400.500.600.700.800.901.00 (c) upper (d) bottom Figure 6. Retrieval effectiveness of Haar and Daubechies wavelet transforms. In [19], we have introduced the nona-tree and its application in fractal-based image content retrieval. The nona-tree structure can also be used to search and match other image features, including color. 4.2. Comparison with Other Block-Oriented Trees A quad-tree decomposition ensures that, if a portion of a decomposed image matches a query image, there then exists a segment which covers at least 1of the query image. Obviously, such a overlapping coverage may not be sufficient for supporting feature-based matching. Let us now consider a quin-tree which is similar to the nona-tree but omits segments 6, 7, 8, and 9 in each decomposition. A quin-tree decomposition ensures that, if a portion of a decomposed image matches a query image, there then exists a segment which covers at least 1of the query image. We now compare the effectiveness of the quad-, quin- and nona-trees in content-based image retrieval. Our experiments are performed by selecting various subimages in the database images, which are remote to the central area of the database images, to be the query images. Retrieval based on these query images is then performed. Figure 7 presents the results of the retrieval experiments when a given query image is located at or very close to the central areas of the upper, bottom, left, or right halves of the image segment. In principle, the image segments in the nona-tree decomposition offer higher possibilities to match with such query images than those in the quad- and quin-tree decomposition. In experiments, we can see from Figure 7 that the query retrieval effectiveness using the nona-tree structure is much higher than using the quin- and quad-trees. Quad Daubechies Quin Daubechies Daubechies Precision Recall5.0015.0025.0035.0045.0055.0065.0075.0085.0095.000.00 20.00 40.00 60.00 80.00 100.00 Quad Haar Quin Haar Haar Precision Recall5.0015.0025.0035.0045.0055.0065.0075.0085.0095.000.00 20.00 40.00 60.00 80.00 100.00 (a) Upper (b) Bottom Quad Daubechies Quin Daubechies Daubechies Precision Recall5.0015.0025.0035.0045.0055.0065.0075.0085.0095.000.00 20.00 40.00 60.00 80.00 100.00 Quad Haar Quin Haar Haar Precision Recall5.0015.0025.0035.0045.0055.0065.0075.0085.0095.000.00 20.00 40.00 60.00 80.00 100.00 (c) Left (d) Right Figure 7. Retrieval effectiveness for a query image located at or very close to the central areas of the upper, bottom, left, and right halves of the image block. The query retrieval effectiveness using the quin-tree is also higher than using the quad-tree, especially when the query images are found to be similar to the subimages located in the central area of the database images. This illustrates that for query images which are located in such places in database images, the nona- tree decomposition offers a mechanism that is more effective in identifying relevant images. For those query images which are commonly covered by the image segments of quad-, quin-, and nona-trees, we observe that, in a recall range between 40 and 90 percent, the nona-tree structure offers the best retrieval precision results. For a recall range under 40 percent, nona-tree decomposition may not result in increased retrieval precision comparing with quad- or quin-tree decomposition, because a greater number of irrelevant images were identified by the nona-tree structure. Moreover, we also observed that, when the recall is greater than 90 percent, the performance of all the trees degrades. However, the nona-tree structure is still performed better than both quin- and quad-tree structures. This can be attributed to the fact that, in case of the nona-tree, the query image is compared with more subsegments and there is a higher number of irrelevant images that get retrieved. We now discuss the issue of whether the nona-tree structure should be further expanded. Theoretically, the block-oriented image decomposition can continue to expand the nona-tree structure to include more segments. Clearly, such a expansion will result in that, if a portion of a decomposed image matches a query image, there then exists a segment in the decomposed image which covers more than 9of the query image. However, to guarantee evenly distributed segment decomposition and equally coverage of query images, the segments to be added at each level of tree decomposition is highly explosive. For example, the smallest number of subsegments to be decomposed for each segment to expand the nona-tree structure is 25 (Let us term this tree structure the 25-tree). The smallest number of subsegments to be decomposed for each segment to further expand the 25-tree structure is 81. We see that such a expansion will cause the feature space to explosively grow and seriously affect retrieval efficiency. Thus, the trade-off between image retrieval effectiveness and efficiency must be considered in choosing a specific block-based decomposition strategy. Our experimental results indicate that the nona-tree structure is more effective than both quad- and quin-tree structure for certain query images. In addition, although the nona-tree structure increases the number of segments than the quad- or quin-tree structure, the retrieval efficiency can be remained by a good indexing technique. 4.3. Comparison with Traditional Moving Window Analysis An alternative to hierarchical decomposition methods is the traditional moving window analysis. Here the signal processing argument is that the image, since it consists of projections of multiple objects, cannot be treated as a stationary stochastic process. Instead, it is reasonable to regard the image as having been generated by a short-space stationary process, where the signal (image) characteristics remain stable over a short-space and can change in adjacent spaces. The correct way to analyze such an image is by the use of an overlapping moving window. The size of the window is usually left unspecified as it is application dependent. However, there is a distinct relationship between the window size and overlap between win- dows, which can be derived based on sampling theory arguments. Specifically, it was shown in [12], that a minimum overlap of N=2 x N=2 for a moving window of size N x N must be maintained. From this observation, the quad-trees that do not maintain overlap between windows cannot do a complete analysis of the 2D short-space signal (image). By comparison, the nona-trees meet the minimum overlap requirement by having the segments at each level start at an offset of N=2. For recognizing query objects in unsegmented images, the overlapping window method was used in [13]. There, a relation was derived between the window size the shift in window (L and the size of the query pattern (N 1 to be detected as: If the moving window analysis was done using the above constraints, then it was shown that one of these windows was guaranteed to contain only the query pattern (if not all of it). With this tradeoff, we could design windows that captured any specified percent of query area by suitably varying M i and L i . It was also shown that a window containing only the query pattern can be detected even under pose changes by bounding the maximum pose change. The disadvantage with this scheme is that it is very model-based in that, for each query, a different moving window analysis is required indicating that the windowing be done dynamically during querying rather than during database creation. One way to get around this is to categorize the queries in terms of size ranges and the moving window analysis per category can be done ahead of time. Alternatively, we can fix a window size for one-time moving window analysis (usually corresponding to the smallest query) and scale a given query region to the standard size before invoking search. But the disadvantage with these schemes is that to maintain the constraint described above, especially under pose changes, the windows may have to be very small, so that even if only the query region is isolated in the window, due to the small window size, the feature generation process may not give reliable features for matching to query region. In contrast, the nona-tree decomposition can be considered as anticipating queries of different size and/or undergoing different pose changes for localization. 5. Conclusions In this paper, we have conducted a study on image data representation and retrieval approaches to support effective and efficient retrieval of image data based on content. An effective block-oriented image decomposition structure, termed nona-tree, has been introduced to be used for content-based image retrieval. This decomposition structure offers a better block-oriented tree decomposition approach than the quad-tree decomposition. We have also discussed the application of the nona-tree data model to content-based image retrieval. Wavelet transforms were used to extract image features. Feature vectors of images were constructed using two wavelet transforms. Content-based image retrieval were performed by comparing the feature vectors of the query image and the segments in database images. Our experimental analysis have illustrated that the nona-tree decomposition offers a novel decomposition structure to be used to facilitate effective and efficient image retrieval. --R QBISM: A Prototype 3-D Medical Image Database System A Visual Information Management System for the Interactive Retrieval of Faces. A Photographic Album for Artists and Designers. Principles of Pictorial Information Systems Design. An Intelligent Image Database System. Medical Image Retrieval by Spatial Features. Multiresolution approximation and wavelet orthonormal bases of l 2 (r). A theory for multiresolution signal decomposition: the wavelet representa- tion Automatic Image Indexation and Retrieval. Attentional Selection in Object Recognition. IDB: An Image Database System. Multirate Systems And Retrieval Effectiveness. Faces Using Mutiple Re- trievals An Approach to Query-by-texture in Image Database Systems A Fractal-Based Clustering Approach in Large Visual Database Systems --TR --CTR Aidong Zhang , Wendy Chang , Gholamhosein Sheikholeslami , Tanveer F. Syeda-Mahmood, NetView: Integrating Large-Scale Distributed Visual Databases, IEEE MultiMedia, v.5 n.3, p.47-59, July 1998 Wendy Chang , Gholamhosein Sheikholeslami , Aidong Zhang , Tanveer F. Syeda-Mahmood, Efficient resource selection in distributed visual information systems, Proceedings of the fifth ACM international conference on Multimedia, p.203-213, November 09-13, 1997, Seattle, Washington, United States Wendy Chang , Gholamhosein Sheikholeslami , Jia Wang , Aidong Zhang, Data Resource Selection in Distributed Visual Information Systems, IEEE Transactions on Knowledge and Data Engineering, v.10 n.6, p.926-946, November 1998 Maude Manouvrier , Marta Rukoz , Genevive Jomier, A generalized metric distance between hierarchically partitioned images, Proceedings of the 6th international workshop on Multimedia data mining: mining integrated media and complex data, p.33-41, August 21-21, 2005, Chicago, Illinois Wasfi Al-Khatib , Y. Francis Day , Arif Ghafoor , P. Bruce Berra, Semantic Modeling and Knowledge Representation in Multimedia Databases, IEEE Transactions on Knowledge and Data Engineering, v.11 n.1, p.64-80, January 1999 Gholamhosein Sheikholeslami , Aidong Zhang , Ling Bian, A Multi-Resolution Content-Based Retrieval Approach for Geographic Images, Geoinformatica, v.3 n.2, p.109-139, June 1999
wavelet transforms;image representation;content-based image retrieval;texture;image decomposition;image database systems
597056
Concepts for Resource Reservation in Advance.
Resource management offers Quality-of-Service reliability for time-critical continuous-media applications. Currently, existing resource management systems in the Internet and ATM domain only provide means to reserve resources starting with the reservation attempt and lasting for an unspecified duration. However, for several applications such as video conferencing, the ability to reserve the required resources in advance is of great advantage. This paper outlines a new model for resource reservation in advance. We identify and discuss issues to be resolved for allowing resource reservation in advance. We show how the resource reservation in advance scheme can be embedded in a general architecture and describe the design and implementation of a resource management system providing reservation in advance functionality.
Introduction Computer systems used for continuous media processing must cope with streams having data rates of several Mbits/s and must provide timely processing guarantees. For instance, an end-system shall synchronize audio and video streams up to a granularity of about 80 ms [16]. Since available system resources are not abundant, applications have to be 'protected' such that they have access to the required resources in time. Otherwise the user will notice a glitch or drop in the presentation quality. Hence, means to manage the available system resources are necessary. Resource management provides a way to offer applications reliability with respect to Qual- ity-of-Service (QoS) [21]. A resource management system controls the access to scarce system resources needed for audio and video data processing. It checks whether additional service requests can be satisfied, and if yes, the required resources are reserved for that application, else, the request is rejected. Sophisticated systems will allow for a negotiation according to the available capacities and constraints (e.g., by tariffs). 1.1 Requirements of Application Scenarios Today existing resource management systems, for instance, HeiRAT [18, 19], QoS Broker [12], Tenet [8, 1], offer functions which only allow to reserve resources for a time interval which starts with the reservation attempt and which lasts for an unspecified time. For several application scenarios this model of immediate reservations is not appropriate. Consider, for instance, a virtual meeting room (conferencing) scenario supported by multimedia systems. Traditionally, a meeting will be scheduled for a specific time at a well defined location (room). To be sure that the respective room will be available at the scheduled time, a *. Part of this work was done while the authors were with IBM's European Networking Center, Germany. This work is sponsored in part by: Volkswagen-Stiftung, D-30519 Hannover, Germany. reservation entry, in some form of a meeting room calendar, is written before the meeting starts. The time between the reservation and the meeting itself can vary from short intervals, e.g., half an hour or a few hours, to very long periods, e.g., months. In addition to 'one time events', meetings such as project meetings occur periodically. To support these 'virtual meeting room' scenarios the resource reservation system must offer mechanisms to reserve in advance the resources needed for the conference, i.e., certain capacities of networks, routers, and end-system resources. Resource Reservation in Advance (ReRA) is not only needed for conferencing but for other scenarios such as video-on-demand as well. This resembles a video rental scenario where a user 'orders' a video for a specific time: for the video-on-demand system it means that the resources necessary to retrieve, transfer and present the video have to be reserved in advance, i.e., video server, network, router, and end-system resources. Further application areas can also be found outside of typical multimedia applications, e.g., within manufacturing process control systems (where time-critical data must be processed and transmitted) or any kind of remote surgery in medicine. The need for ReRA has also been expressed by Degermark, K-hler, Pink and Schel-n in [5, page 4] as: "Where resources are plentiful, not even immediate reservations may be necessary, but where resources are scarce enough to justify reservations at all, it makes sense to be able to make them in advance." 1.2 Contents of this Paper We discuss a model for ReRA, identify the issues to be resolved and describe the design and implementation of a resource management system offering ReRA functionality. The paper is organized as follows: Section 2 provides a description of a common resource management scheme and an according architecture. Section 3 introduces the notion of ReRA, the used model, and characteristics of ReRA. Section 4 presents the architecture of a ReRA system and some aspects of the prototype implementation. Related work is discussed in Section 5 before we conclude the paper. Resource Management In the following we describe the main issues of resource management relevant to the ReRA scheme. For a more detailed view please refer to, for instance, [19, 12 and 21]. Any resource management component on each system which is part of an application must provide certain functionality for each "active" resource (i.e., CPU, network adapter): User QoS Requirements Interpretation QoS Computation Translation Resource Reservation User Data Resource Scheduling Negotiation Enforcement Figure 1: Resource Management Phases. Capacity Test . Interpretation and translation of the application specified QoS in metrics applicable to the affected resources. . Capacity test to check whether the available resource capacity (taking the existing reservations into account) is sufficient to handle the new request. . QoS computation to calculate the possible performance the resource can provide for the new stream. . Resource reservation to reserve the required resource capacities. . Resource scheduling to perform the scheduling of the resource during data processing such that the QoS guarantees are satisfied. Figure 1 illustrates how this functionality interact at two resource management phases. In the set-up phase (also called 'QoS negotiation') applications specify their QoS requirements (e.g., throughput and delay). These parameters are used for capacity test and QoS computation which finally results either in resource reservation or in rejection of the reservation attempt if the QoS cannot be met due to a lack of resources. After the negotiation phase has been successfully completed, in the data transmission phase, the resources used to process the user data are scheduled with respect to the reserved resources (also called 'QoS enforcement'). In a ReRA system, the negotiation phase is not in close vicinity to the enforcement phase and the resources are not reserved for immediate but for delayed use. The resulting states for a stream are idle, negotiate, established and active (see Figure 2). During the set up of a stream, it changes due to a request from idle to negotiate. If the set up was successful (accepted by the resource management system) the stream is established which is in a non-ReRA system identically with active (dashed box). In a ReRA System, both states must be distinguished since negotiation and usage can be potentially very distant. To achieve QoS provision for a distributed multimedia application, resource management is applied to all resources on the transmission and processing path, from the sending host via gateways or any other computers and networks to the receiving host. Resource reservation protocols such as ST-II [17] and its more recent version ST2+ [6], and RSVP [22] offer the functionality for QoS provision in distributed systems. Figure 2: States of a Stream. idle negotiate active established use close renegotiate renegotiate request reject accept close close for periodic streams 1 possible enhancement The local resource management system contains among others components for QoS interpretation and translation, schedulability tests and the according scheduling mechanisms, data-bases for available and reserved resources, monitor and regulator mechanisms to detect and potentially enforce the characteristics of data streams. A simplified architecture is shown in Figure 3. 3 Resource Reservation in Advance Model and Issues This section introduces the notion of ReRA, presents its basic ReRA model, and discusses issues to be addresses by ReRA systems. 3.1 Classification of Reservation Types To distinguish ReRA schemes from other reservation schemes, e.g., existing reservation tech- niques, we classify reservations based on two key factors: . whether the resources are exploited at reservation time, and . whether the reservation duration is known at reservation time. The most stringent use of resource management is in the domain of process and control systems including embedded real-time systems. There, resources are reserved for the whole active phase of such systems, i.e. for the lifetime. Changes can only be done at the initialization phase (and not at the actual run-time phase). Therefore we characterize such approaches as "static" (see Figure opposed to the dynamic approaches discussed in the remaining of this paper. Figure 3: Components of a Resource Management System. Resource Scheduler Resource Manager CONTROL Monitor Resource Specific Information Reservation Database Regulator Capacity Now static from now with unknown duration known duration in advance dynamic Figure 4: Reservation Types. Traditional resource management systems (non-ReRA) assume that the resources are immediately used after they have been successfully reserved and no assumptions are made on the duration of the reservations. A ReRA scheme, on the contrary, is characterized by deferred resource usage and reservations of known duration (which might possibly be enlarged). In case of immediate usage and known duration, both schemes can be realized. We clarify this point at the end of this section, after introducing the ReRA model. This leads to the simple matrix presented in Table 1: 3.2 Basic Model To provide an appropriate model for ReRA, we start from the common reservation scenarios of everyday life. In such scenarios, appropriate actions are required as part of the reservation, e.g., we have to specify at what time and for how many persons we intend to reserve. Here, we introduce a simple model to define these actions and regulate the interaction between the reservation requestor (i.e., the client application itself or a ReRA agent acting on behalf of the appli- cation, cf. Section 4) and the service provider (e.g., network and server applications). The model is shown in Figure 5. The ReRa scheme consists of two parts: . resource reservation in advance . usage of reserved resources In the first part of the ReRA scheme, the client issues a REQUEST and it specifies the nature of its request by indicating how much of the resource capacities will have to be reserved for its application, i.e., it gives a workload specification. It also specifies the points in time that define beginning and duration of the reservation. The service provider may then CONFIRM the reser- vation. As part of this confirmation, it possibly provides the client with a reservation identifier for later client identification. This terminates the first part of the ReRA scheme. The second phase begins shortly before the client intends to exploit its reservation. The client contacts the service provider to DEMAND the previously reserved resources. It may be requested to show some form of identification, which the service provider will ACCEPT. After receiving this acceptation, the client eventually exploits its reservation by making USE of the reserved resources. While a session is established, the participants may like to either finish earlier (than previously reserved) or they may like to extend the time. The drop of the session before the actual reservation time expires is what usually will happen, it is shown by the close primitives in Table 1: Classification of Reservation Schemes. Duration of Reservation Known Unknown Dynamic Usage Deferred ReRA Immediate Traditional Approaches Static Usage Unlimited Duration Figure 5. The extension request is shown as a continue primitive which again must be confirmed by the whole set of involved resources. It is possible to further simplify this scheme by eliminating DEMAND and ACCEPT. In this case, the client attempts directly to make use of the allocated resources and client identification can be associated with USE. However, we feel that the scheme described in Figure 5 is more convenient because it provides for the management system the ability to prepare the resource usage phase and generally allows for higher flexibility. For instance, it is often necessary to change reservations at the very last moment. A common example is a couple of unexpected guests for dinner making a larger table necessary. With the DEMAND and ACCEPT scheme, DEMAND can be used to adjust reservations appropriately when possible. Also, an explicit ACCEPT from the service provider is desirable because it informs the client that everything is set so that its requirements can be met. 3.3 Timing In order to appropriately define a ReRA system, it is important to analyze the temporal relationships among the events. Consider the events in Figure 6. In our view of a ReRA system, we assume that the distance between t req and t conf is short, about the order of delay tolerated by Remote Procedure Calls (RPC). The same holds for t dmd , t acc and t begin . On the contrary, t req and t begin are possibly very distant, possibly in the order of weeks or months. Let us call I the time interval between resource reservation and exploitation: When I is too small, making a ReRA reservation is pointless and a normal reservation scheme can be adopted. A ReRA system may define a value for I, say I min , such that requests are rejected because the overhead induced by the management of resources might otherwise be too large. In the same way, an I max value for I can be defined to prevent applications to request their reservation long ahead of time, e.g., to prevent storing too much reservation state. These definitions help clarify Table 1 when both non-ReRA and ReRA are possible, the I min value can be used to decide which of the two schemes to adopt. However, if limits for I are defined it Figure 5: Reservation in Advance Primitives. ReRA REQUEST DEMAND CONFIRM ACCEPT Resource Negotiation Phase Resource Usage Phase CONTINUE CLOSE ACKN. CONFIRM Resource Renegotiation Phase ReRA must be considered that in the 'real' world we have the possibility to specify exceptions, e.g., if hotel rooms for a large event can be reserved long time in advance, similarly, it might be necessary to be able to reserve network and other system resources for large events already long time in advance. Instead of using single values for the events, the use of intervals and a target value within this interval is more general. For instance, instead of the single value t req , the interval [t req, earliest , latest ] and the according target value t req, target might be used. If a certain application will be run periodically, e.g., the video conference of the weekly project meeting, it is useful to specify the reservation already as periodically. All specified time values must be unambiguous within all components participating in the provision of a distributed and ReRA supported application. Hence, absolute time values, based on synchronized and coordinated clocks must be used. The granularity of specified times might be system dependent and influence the overhead incurred by the ReRA system. As for 'real- world' reservations, we believe that introducing a certain granularity, e.g., a virtual conferencing room is only reservable for one or several slices of 15 minutes, would be acceptable to users. If necessary, a distinction among 'close' and 'far away' events may be added, e.g., for events starting soon the granularity might be set to one minute, for events far in future it might be minutes. 3.4 Reservation Duration ReRA schemes require that the applications reserve resources over a certain time interval. The problem is, it is difficult to predict in advance how long some applications may need their res- ervations. In a video-on-demand system, it is usually possible to foresee the duration of a movie. Still, the user may increase this duration by pausing playout or even by stopping and rewinding to watch his favorite sequence a second time. In the same way, meetings take often longer than expected. Note that also shorter durations may be induced, e.g., by skipping through movie sequences or by rapidly adjourning a meeting. When the actual duration does not correspond to the reservation, several issues arise: . if the duration is shorter, exceeding resources should be freed and made available for other applications. In this case, resources are more likely to be made available for immediate use and for traditional reservation requests than for new ReRA requests, because of the short notice (which is likely < I min ). . if the duration is longer, the system may or may not have a sufficient amount of resources to serve the application with its needed QoS. If enough resources are available, one possibility is not to interrupt the service and to provide the application with the means to extend its previous reservation. If insufficient resources are available, the system may still attempt to serve the application on a best-effort basis with a degradation in the QoS. Figure Model Temporal Sequence. time Means to extend a previous reservation are desirable for a ReRA system, i.e., in addition to the primitives discussed in Section 3.2 a CONTINUE primitive to enlarge an already established reservation is necessary. Sometimes, the delay can be foreseen, e.g., it becomes clear that the meeting will take longer than expected. In such cases, it may be possible to extend in advance, i.e., before it expires, a previous reservation. This will only be successful if sufficient resources are avail- able, e.g., if no other reservation overlaps with the extended reservation. For the prolongation of the reservation, we differentiate two alternatives, (i) the management system informs the application/user that the reservation will expire and queries whether the reservation should be extended or (ii) the application has complete responsibility about the reservation state and must take appropriate action to lengthen the reservation. The ability to extent reservations encourages applications not to book resources over too long time intervals in order to be guaranteed against unpredicted longer durations. In a cost-based ReRA system, this can also be imposed by adequate payment policies of the associated reservation costs. If it is known before the beginning of usage that the needed reservation duration is different to the originally specified length, the DEMAND mechanism can be used to adapt the reservation to the required duration. If the duration shall be shortened, the reservation requestor might be charged for preventing other reservations. For prolongation, the necessary resources might be unavailable, however, due to the earlier request, the risk is lower than during the usage phase of a reservation. 3.5 States The state diagram for non-ReRA streams as shown in Figure 2 must be extended to allow for the reservation of resources in advance. That figure distinguishes already between established and active which are identical in a non-ReRA system. Yet, this simple extension falls short, e.g., it does not provide the ability to handle failure situations which can occur between the reservation and the use of the resources which can be very distant in a ReRA sys- tem. Yet, in the time between reservation and use, resource characteristics and availability might change. Therefore, additional states must be introduced as shown in Figure 7. The regular 'state cycle' consisting of idle, negotiate, established, active, and ending is basically identically with the one described above. However, between established and active time can pass and, hence, resource capacities might change in such a way that the negotiated QoS can no longer be guaranteed. In that case, the stream is still established but moved into the can't be met state; if later the capacity becomes sufficient again its state is changed back to established. Otherwise, the application may renegotiate its resource requirements or close the stream. Serving an 'established' stream with insufficient resources is not considered as useful because then a stream without any resource reservation can be used. The timely distinction between the reservation and the use of resources implies that the begin of the usage phase (marked by the use primitive) can occur before, at or after the scheduled begin date. Therefore, three cases have to be distinguished: . The use request is given too early. The stream is marked as 'in-use' and put into the state early but not yet scheduled with real-time priority. Hence, it is served in a best-effort mode without any QoS guarantee. When the reserved time is reached (start) the stream changes into the active state and it is scheduled with real-time priority in order to achieve the negotiated QoS. . The use request occurs exactly at the specified time. Then the stream changes directly to the active state and is scheduled with real-time priority. This case is, depending on the granularity of time measurement, the exception and not the regular case. . The use request comes within the reserved time interval. From the beginning of the reserved interval until the use request the stream is in the pending state from where it changes to the active state. If the use never occurs (or occurs very late, i.e., after a specified 'reservation holding time') the reservation expires and the stream goes via expired into the final idle state. A certain time before the reservation ends the application can be notified by the system about this coming event (and changes into the ending state). Hence, the application can prolong and renegotiate the reservation. established negotiate idle early active pending expired ending reject start start accept use use use renegotiation capacity change notify close close close can't close close close expire regular cycle request close be met Figure 7: Extended State Diagram for Advance Reservation With Additional Characteristics and Error Conditions. 1. Allocation Before Reserved Interval 2. Allocation Exactly at Reserved Interval 3.6 Distribution of Announcement Information In addition to the information about stream characteristics which are exchanged via resource reservation protocols such as RSVP and ST-II, information about the date of the stream and even basically the knowledge about its existence time must be distributed as well. Such information is today usually distributed via other means than the one later used for the application, e.g., the invitation to join a multi-user phone conference is given to the potential participants by contacting each person independently via a point-to-point phone call. Considering distributed multimedia applications, two different scenarios can be distinguished . the sender of the data stream has complete knowledge about the set of receivers, i.e., their identities, . the sender has no knowledge about the set of receivers, i.e., the sender knows neither identity of receivers nor even whether anyone is listening. The former scenario occurs in point-to-point communication or in multicast communication using a sender oriented communication setup, this is the case, for instance, in ST-II. The latter scenario is used in multicast communication where the receivers are not specified by the sender and is typical for IP multicast communication. In both cases, the human users who will consume the presentation of the transmitted data must be informed about the intended transmission of the multimedia data and accept or reject the stream. While it would be possible, in the first scenario, to perform the announcement phase together with the reservation attempt, it should be avoided. The reason is the severe drawback that until the user decided about the delivery of the stream, the resources on the complete path from the sender to the receiver must be set aside (for the future time frame) for the case that the receiver accepts the stream. However, the reaction of the user might be delayed for an unknown amount of time - the user might even not be at the computer for days or weeks, e.g., during business trips or vacations. Keeping resources reserved for such a long time can lead to rejected reservation attempts for other applications even if finally the user decides not to receive the stream and, therefore, available resources at the time the other applications intended to run. Additionally, it complicates the implementation of the ReRA components and the recovery from system failures. Altogether, it becomes clear that a distinction into the announcement of the data stream and ReRA for that stream is necessary. The information about these announcements can be handled by a 'user agent' which is similar to the user agent of a mail system. It provides the interface for the user to handle resource reservations in advance. An incoming invitation to a multimedia application (to be started sometime in the future) is presented to the user who can acknowledge or reject the invitation. Using this agent, users can also start reservation attempts themselves. The user agent should provide the ability to start automatically the application at the time the data stream has been scheduled, i.e., just before the conference begins. 3.7 Failure Situations For the handling of failures, we must distinguish when the failure occurs: . during the negotiation and reservation, . after the reservation, but before the usage (between REQUEST and USE), or . during the usage phase. The first and the last case is not different from failures within traditional reservation-based sys- tems. The second case, however, requires special attention since it was not present in non- ReRA systems. The reservation state information stored at nodes might be needed for long lasting time peri- ods. State information must be stored in stable storage not only to protect against failures, but also since any node may be restarted between REQUEST and USE also regularly, e.g., for maintenance. In opposite to failures occurring during data transmission, no client is running when a node notices a failure. The failure itself might, however, not be detected at the failing node but only at a neighbor which has only partial information about the reservation state stored at the node. Means to inform the clients explicitly about the failure situation and whether it can be resolved in time must be provided, respectively the application must be able to query the correctness and availability of the reservation before it starts its usage phase. Applications which have been written for a scenario where resource reservation is done but which are not aware that they are running within a ReRA system might encounter during their resource reservation usage phase the additional problem that the resources are not available as expected. This can occur if the application is early and wants to use resources before the reserved time interval or if the reservation interval ends and the application continues to use the resources, e.g., if a video conference lasts longer than originally scheduled. In the first case, the application is served on a best-effort basis until the begin time of its reservation, hence, the perceived QoS might be low. In our system, the application is informed about this situation by an according flag in the acknowledgment of the allocation. In the second case, the resource reservation ends and the application is served from that time with a best-effort mode only. Yet, the system offers the ability to inform the application before the reservation ends (state notify in Figure 7). Then the application can extend the reservation if necessary. This functionality will lead to optimistic reservations, i.e., an application will usually reserve for tight bounds and not necessarily reserve for a surplus of time. Service provider can even foster such a reservation behavior (which is desirable for them) by offering better rates for such reservations. If an application which reserved resources in advance fails to start and hence does not use the reservation, the service provider will probably nevertheless charge the application (resp. its user) somehow because the resources have not been available for other applications whose reservation attempts might have been rejected. This is similar to reserved but not used hotel rooms, etc. In order to reduce the effect, a time after which reserved resources are made available to other applications is defined. The state expired is introduced for this purpose. 3.8 Management of the Resource Pool It is not possible for all applications to know in advance their duration, e.g., video conferences. For other applications, it is not possible to determine (long enough in advance) when they will run. Therefore, advance reservations and immediate reservations must coexist. Advance reservations may block immediate reservations if both are served from the same pool of resources (see Figure 8). This blocking can occur if at a later time all resources are reserved by advance reservations. The reason is that since the duration of an immediate reservation is unknown, it must not overlap with any existing advance reservation. Hence, the reservation is rejected despite all needed resources may be available. The same applies to advance reservations. They are rejected if existing reservations (immediate and advance) use all resources, since immediate reservations can last for undefined time. This blocking problem can only be solved by splitting the available resources among the two reservation styles. A simple scheme would be to use fixed-sized partitions - one part is used for immediate, the other for advance reservations. However, it is nearly impossible to find partition sizes which satisfy the reservation needs over a longer interval for varying requirements. Thus, partitions with floating boundaries must be used, to avoid that one partition becomes empty (and the other contains all resources) water marks for minimum values are needed. In Figure 8, an example for the use of resources is illustrated. For the intervals t 1 - t 4 and advance reservations have been set. As can be seen, advance and immediate reservations block each other. The dashed part could be reserved as advance reservation but it cannot be reserved as immediate reservation because its duration is unknown. Instead of using only two partitions, one for immediate and one for advance reservations, more partitions for advance reservations can be used to distinguish among short and long-term reservations. 4 Architecture for Resource Reservation in Advance Now we describe the architecture of our ReRA system and some aspects of its prototypical implementation. 4.1 Management of Reservations To allow for reservations in advance, the time axis is divided into slices. Within each slice a certain set of reservations exists and there is no change of this set or of the QoS parameters of these reservations, i.e., the reservation state is stable within each slice and changes only at the boundaries (as described in [7]). Thus, the resource management system has a similar view as before: at a certain point in time (in a time slice) a fixed set of reservations with fixed QoS exist corresponding to a fixed resource utilization and free resource capacity. This view changes only if new reservations are established or existing ones end. Therefore, the following components of the resource management system need modification: . The interface of the resource management system needs in addition to the QoS parameters now also specifications of the time parameters (begin and duration). . These time values must also be contained in the flow specification distributed via the resource reservation protocols to all affected network nodes. Usage Reservation A Reservation B Reservation C available for available for ReRA Time immediate reservations reservable via ReRA but rejected as immediate reservation Figure 8: Partitioning of Resources. . The database of existing reservations must represent the time slices. For each time the set of existing resp. reserved streams with their QoS parameters and the free resources must be known. . The resource management algorithms must take the time parameters into account. . Additional failure handling mechanisms and means to save state information in permanent storage are necessary. Furthermore, the reservation protocols must be enhanced. New PDU types to support the additional states and transitions (e.g., USE explained in Section 3.2) and to handle failure situations and notify neighbor nodes about such are needed. Figure 9 illustrates the data structures for the management of time slices (left side) and for reservations (right side). Information for all slices is kept in a list so that splitting a slice or joining adjacent slices is simple. For each slice the information about its beginning and its end, the amount of resources (available, reserved, and allocated) and the identifiers of set reservations are stored. Binding available resources to time slices allows the change of resource capacities over time. By keeping separately track about reserved and allocated resources provides the possibility to distinguish between established, active and not serviceable reservations (cf. state diagram in Section 3.5). The list for all reservations contains one entry per reservation where a list of times, the (potentially varying) QoS within this time, and the corresponding resource load is stored. The data structures for the management of the resources hold information about the used scheduling algorithm, the amount of resources to be managed and further parameters affecting the schedulability test (e.g., the maximum packet size for a transport system). This provides for the check whether sufficient resources are available for a new stream. 4.2 Management of Resources Characteristics The usable capacity of a resource can vary within a long time interval, for instance, due to necessary maintenance work only parts of the full capacity, e.g., in a network, might be available. Therefore, a system component independent of the reservation management should exist which keeps track of the capacities and characteristics of the managed resources. The time of the reservation of resources does not necessarily coincide with the beginning of the usage phase, hence, the reserving application is in the mean time usually not active and reachable. Thus, in case of changes, another instance must be available which can implement corresponding reactions. This part can be taken over by the reservation management - it is Time Slice: begin, end Resources: available reserved allocated Reservations: Time Slice: begin, end Resources: available reserved allocated Reservations: Reservation ID Usage Begin, End QoS Slices Begin, End QoS Resource Load Reservation ID Usage Begin, End QoS Slices Begin, End QoS Resource Load Figure 9: Data Structures for Management of Time Slices (left) and Reservations (right). Begin, End QoS Resource Load Begin, End QoS Resource Load informed about resource capacity changes and checks then whether all active and reserved streams can still be served. If the available resources are not sufficient to serve all these streams, some of the streams must be modified. For active streams, the application can be informed, whereas for reserved but not yet active streams, the application might not be reachable now. It will be informed about the changed situation when it contacts the reservation man- agement, i.e., when it wants to use the reserved resources. The introduction of components for resource dependent functions, i.e., for capacity determination and for mapping between QoS and resource load, generally provides for independence of the reservation management from the actual resources and the usage scenario of the reservation system. Complete independence is not possible, since several policy decisions implied by the usage scenario must be taken by the reservation management, e.g., the decision which reservations are marked as can't be met in case of resource capacity reduction. Further, the workload model has impact on the behavior of the resource and the used scheduling algorithm influences the maximum resource utilization (cf. [11]) and hence the amount of available resources. 4.3 Notification Component The reservation management should be designed as general as possible and independent of resource and application specific details. In the last subsection this led already to the distinction between management of reservations and resources. To allow for independence from applications and reservation protocols, an additional component is introduced. This notification component accepts 'sign in' and 'sign out' of an application and hence knows whether the initiator of a reservation can be reached. Further, it informs an application in case that the state of one of its reserved streams changes, e.g., time controlled or due to resource changes. Whether this notification of the application by the notification component occurs immediately or delayed depends on the reachability of the application which is known by the notification component due to the 'sign in' and 'sign out' operations. Some applications might not be aware of the notification mechanism, hence, it cannot be mandatory. Applications can specify that they want to be informed about state changes and which state changes should be traced. 4.4 User Agent A user agent is introduced to allow the user to coordinate its work flow with the use of certain applications. The user agent, similar to a calendar and comparable to a mail user agent, provides the ability for a user to make reservations for a specified time interval and to visualize statistical information about the reservations stored within the resource management system, for example to find out the best time interval for a new reservation. Another task of the user agent is to control the state of existing reservations: Can a reservation still be served ? Till when will the failure be repaired ? Could the stream be served with lower QoS ? Another useful feature is the detection of the start time of the usage duration and the automatic start of the application which serves also as reminder. The user agent is additionally the component which receives announcements about events such as conferences from other users. It notifies the user about that event who can then decide to accept the invitation and participate in the event. From the information given inside the announcement, the user agent should be able to deduce an according reservation. 4.5 Announcement System The user agent integrates the announcement service into the reservation system. The characteristics of the event such as date, duration, required QoS and additional information such as agenda, contact person, participants, etc. are specified via the reservation tool and made available with its help to the other users, e.g., the participants of a conference call or all interested persons in case of public events. Using their user agents, other users can search in public databases containing event announcements and perform reservations with database provided information for the events which are of interest to them. Such databases can be compared to magazines or announcement boards. For private events, the number of interested persons is usually limited (confidential informa- tion) or the interest is geographically concentrated (local announcements). Therefore, the announcement can be sent to each interested party personally via email. The architecture of the announcement system is illustrated in Figure 10. The 'announce- ment & reservation tool' is used to specify the event characteristics. Then the event is either announced in a publically available database or the announcement is packaged into a form and send via email to the participants. Users search for public events in the databases. Private announcements are taken and filtered from their incoming mailbox and put into a separate box which is checked periodically by the reservation tool. Then the user only has to accept or reject the invitation to join the announced event. In future, the announcement generation and processing might be integrated into calendar and groupware applications. 4.6 Overall Architecture The described components interact as illustrated in Figure 11. The central part is the reservation management which uses the databases holding the information about the resource characteristics and the usage of resources over time intervals. The resource database keeps information about the resource capacities for every point in time. The reservation database Process Specification Announcement & Reservation Tool sendmail Message Database Announcement Mailbox Filter Folder Announcement Reservation Resource Management System Process Specification Specification Specification Announcement Reservation Tool Figure 10: Architecture of the Announcement System. stores for every time interval the information about existing streams and their resource load and also about the available resources in that interval. With this information, the schedulability test can decide whether a new request can be satisfied. In case of a change of a time interval (a new time slice starts), the resource scheduler gets information about all active streams and their priorities. Based on this, it enforces the QoS by appropriate dispatching. The mapping between QoS parameters and resource requirements must be done before the schedulability test can decide whether to accept or reject a request. This mapping is done within a resource-specific component which also keeps track about changes of resource capacity and characteristics. The notification component offers the interface to the using system by accepting the service requests from applications. Resource requests and also requests for statistical information (e.g., state of a reserved stream, available resource capacity within a certain time interval) are forwarded to the reservation management. The resource reservation requests come from a local application, from the protocol engine of a resource reservation protocol, e.g., RSVP or ST-II, or from the user agent. Resource SNMP- Agent Translation QoS / Resource Management Resource Management Reservation Time Schedule Component Notification Monitor Regulator Resource Scheduler Application ReRA/nonReRA- Reservation Protocol Agent User Agent RMS Data Control AnnouncementDB Ressource-DB,Time Monitor Reservation-DB Figure 11: Architecture of a ReRA Resource Management System. The user agent is only a ReRA application, reservations performed via the agent cannot be distinguished from applications made by other applications. The difference is outside of the RMS. A 'normal' application reserves resources for a particular work effort and duration, the user reserves in order to have needed resources available at a certain time for his task (then means to hand over the reservation to an application are needed). The user agent offers an interface to the announcement database. It can be used to announce own events and perform queries of announced events. If a user schedules an event such as a conference call, he must inform the other participants about the beginning and duration of the event and must also provide information about the required QoS parameters. Additional information such as topic/agenda, participants, etc. is useful. Some events such as conferences or lectures will be public, others such as conference calls are private. The announcements of public events are stored in public databases where the users can perform the above mentioned queries For system administration purposes, a SNMP (or CMIP) agent should be attached to the RMS as indicated by the dashed lines and box on the right side of Figure 11. Administration would also be possible via the regular interface through the notification component, however, because of standardization and security reasons a separate interface is preferable. For instance, any user should only be able to retrieve information about his/her personal reservations and anonymous information about the rest. However, system administrators need access to all reservation information. 4.7 Implementation Decisions We decided to place no limit on the period of time for reservations in advance and that no minimum interval between reservation and usage is necessary. At stream establishment time only one QoS which is valid for the whole interval can be however, during renegotiations the interval boundaries can be changed and parts of the reserved interval can get a different QoS. Additionally, time intervals directly following the current reservation can be reserved to extend the overall stream duration. This both allows for the adaptation to changing requirements and considers the dynamic character of future applica- tions. Alternatively, it could have been implemented that at set-up time several intervals with varying QoS might be specified, yet, we felt that such a feature would be seldomly used and hence did not justify the induced overhead. We support only two partitions, one for immediate reservations, the other for advance reser- vations. The boundary between them can be changed. The watermarks of the partitions are fixed inside the reservation management. The state of the RMS about reservations, etc., must be saved in permanent storage to provide means for failure recovery and for shutdowns before maintenance operations. In our pro- totype, its state is only saved either as part of its shutdown or on request via an API call provided for that purpose. This must be enhanced for a production system so that the state is either saved periodically or in case of state changes. If a capacity reduction occurs so that not all established reservations can be served anymore then the reservations which are farest in the future are marked as can't be met first. If later the resources are again sufficient to serve reservations which have been marked as can't be met then the reservations which are closed to their start will be reactivated first. This straight-forward approach tries to keep the currently active streams serviceable and to move the resource allocation for not active streams so far that they might become serviceable due to release of resources by currently active streams. Priorities might be added as further decision criterion in the future. 4.8 Module Structure The ReRA RMS prototype is implemented as a server (Figure 12). The server stub calls functions of the notification component which communicates with the reservation management. The latter uses the services of the resource management component and loads the information about streams and their priorities into the scheduler when a new time slice begins. The ReRA library on the client side offers APIs to set-up, to allocate, or to free reservations, to renegotiate QoS or reservation duration, to retrieve state and also statistical information, and to register for and perform functions of the notification service. 4.9 Prototype Figure 13 shows a screen shot of the user agent as user interface to the management compo- nent. The vertical axis is divided into areas for announcements, for reservations, and for statistical information about the resource usage. Additionally, menus for the announcements and reservations (generation, query, control, .) are present on the screen. Private and public announcement are kept separately and are not displayed at the same time, yet, the user can toggle between them. Own, new announcements are generated by filling in a form. The list of reservations contains two immediate and one advance reservation. The statistics area illustrates the corresponding resource utilization. The immediate reservations occurred within a short time interval leading to the first two steps on the left side. The time of the release of the resources is unknown, hence, the utilization does not drop below that value. The advance reservation increases the resource utilization after several time ticks. Its duration is known in advance (leading to the displayed 'drop' after some time). 5 Related Work In the last few years, several publications detailed the need for ReRA and discussed some ideas on appropriate mechanisms: the necessity for ReRA has become evident. However, to our knowledge only little work has been performed on that subject yet. Roberts and Liao present in [15] a mathematical model for a reservation process and calculate the capacity requirements of video-conference networks in order to avoid bottlenecks and Server Client RPC Client ReRA-Library Application Resource Management Reservation Management Notification RPC Server Scheduler RMS Figure 12: Module Structure. severe resource contention. This work is directed towards the (at the time of that article) upcoming ISDN networks. Hence, its applicability to computer-based multimedia systems is somewhat limited due to the different application and usage characteristics and the restricted system environment. Ferrari, Ramaekers and Ventre are among the pioneers who notice in [9] that ReRA is a useful concept. They describe the parameters for the start and duration of a reservation. They also discuss that the resource management system (only considering the network but not any other resources such as crucial resources involved in the processing within a video-on-demand server) must verify that a client does not exceed the time interval granted to him. Neither further requirements of ReRA nor design aspects are described in more detail. Figure 13: Initial Version of the User Agent. Campbell, Coulson and Hutchinson describe in [2] their Quality of Service Architecture and specify start and end time parameters for 'forward reservations', however, they also state that these parameters have been omitted and remain for further study. Chang presents in [3] a scheduling service based on the telephone system as basic model: Conferences are set up via a special service offered by a (phone system) service provider. The work describes a programming interface which offers functions for the creation and deletion of conferences (conference_schedule() resp. conference_cancel()) as well as for announcement of new conferences (conference_announcement()) and for searching (conference_search()) of created conferences. It is proposed to use X.500 for the provision of this function. Chang identifies (1) that the scheduler components of a resource management system can be kept unchanged and (2) that the reservation database and the schedulability test algorithms must be changed in order to take the time parameters into account. However, it is not discussed how this can be done. In Chang's work, all reservation requests must contain information about begin and duration of the reservation, yet it is not described what happens if a conference lasts longer than specified. Reinhardt gives in [13] a straight-forward extension of the resource reservation protocol ST-II [17] to exchange (within the flow specification) the necessary information about start and time of a reservation in advance and describes some problems to be solved within ReRA. In [14], he discusses application classes which can make use of ReRA and evaluates the resource reservation protocols ST-II and RSVP with respect to their suitability to reserve resources in advance. However, no general model is presented. The NOSSDAV 1995 workshop contained three papers about ReRA [7, 5, 20]. Ferrari, Gupta and Ventre from the Tenet group at the University of Berkeley describe in [7] a scheme for advance reservations of real-time connections without a general architecture. They present methods for connection establishment where the usage duration must only be stated by advance reservations; 'immediate channels' are established for an undetermined amount of time. To avoid conflicts with advance reservations (resources already reserved for the latter cannot be used for reservations of unknown duration since then no guarantee about the availability of these resources can be given) the resources are partitioned into separate areas for immediate and for advance reservations. The boundary between the areas can be varied within certain constraints (watermarks). The authors developed also a mechanism to manage effectively the table of all set advance reservations by dividing the time into intervals which describe regions of constant resource availability. Degermark, K-hler, Pink and Schel-n show in [5] an extension of the admission control algorithm for predicted service suggested by Jamin, Clark, Shenker and Zhang [4, 10]. Fur- thermore, they discuss briefly how such a service can be implemented using RSVP [22] by periodically repeating RSVPs PATH and RESERVATION messages (already in advance to set up and keep the reservation state) and adding time parameters to the flow specification. A general model or architecture is not presented in their work. Wolf, Delgrossi, Steinmetz, Schaller, and Wittig present in [20] a model for resource reservation in advance. In that paper, the issues to be resolved in resource reservation in advance systems have been discussed and it has been shown how the resource reservation in advance scheme can be embedded in a general architecture. This was the initial work which has been enhanced since then to serve as a basis for this publication. Many of these initial ideas have been refined during the design and implementation of the architecture with its prototype presented in Section 4. 6 Conclusions While current resource management systems provide mechanisms which offer reliability with respect to QoS, this is not sufficient since many well established application scenarios, e.g., from the cooperative work area, are not well supported. Only with the advent of ReRA mechanisms several cooperative work applications will be accepted in our daily life. ReRA is more than a simple extension of current resource reservation systems. As part of the development of ReRA systems, several issues must be attacked: The integration of current reservation schemes with ReRA requires resource partitioning methods. Applications must be offered a variety of mechanisms to prolong and adapt reservations. Failure handling raises difficult questions and must be carefully integrated into the system architecture. The provision of reservation mechanisms remains to be only one issue of a complete ReRA system. Agents to interact with the user, for reservation request generation as well as for the presentation and handling of incoming invitations, are necessary. We presented an architecture which addresses such issues and offers suitable ReRA func- tionality. Our implementation shows that it is possible to provide ReRA capabilities to time constrained multimedia applications. Acknowledgments The practical work performed by Gerhard Sittig on ReRA provides the base of the architecture and implementation. His contributions together with fruitful discussions with Winfried Kalfa are gratefully acknowledged. Further thanks are due to our former colleagues Luca Delgrossi, Sibylle Schaller and Hartmut Wittig who participated actively in the early discussions and a preliminary report about ReRA. --R "The Tenet Real-Time Protocol Suite: Design, Implementation, and Experiences" "A Quality of Service Architecture" "Network Support for a Multimedia Conference Scheduling Service" "Supporting Real-Time Applications in an Integrated Packet Services Network: Architecture and Mechanisms" "Advance Reservation for Predicted Service" "Internet STream Protocol Version 2 (ST2) - Protocol Specification - Version ST2+" "Distributed Advance Reservation of Real-Time Connections" "Network Support for Multimedia: A Discussion of the Tenet Approach" "Client-Network Interactions in Quality of Service Communication Environments" "Admission Control Algorithm for Predictive Real-Time Service" "Scheduling Algorithms for Multiprogramming in a Hard Real-Time Environment" "Resource Management in Networked Multimedia Systems" "Advance Reservation of Network Resources for Multimedia Applications" "Advance Resource Reservation and its Impact on Reservation Protocols" " Traffic Models for Telecommunication Services with Advance Capacity Reservation" "Human Perception of Jitter and Media Synchronisation" "Experimental Internet Stream Protocol, Version 2 (ST-II)," "HeiRAT: The Heidelberg Resource Administration Technique - Design Philosophy and Goals," Quality-of-Service Management for Distributed Multimedia Systems" "Issues of Reserving Resources in Advance" "Resource Management for Distributed Distributed Multimedia Systems" "RSVP: A New Resource ReSerVation Protocol," --TR --CTR Ch. Bouras , K. Stamos, An efficient architecture for bandwidth Brokers in DiffServ networks, International Journal of Network Management, v.18 n.1, p.27-46, January 2008 Ch. Bouras , K. Stamos, Performance Analysis of Adaptive Admission Control Algorithms for Bandwidth Brokers, Journal of Network and Systems Management, v.15 n.2, p.191-218, June 2007 Lars-Olof Burchard, Analysis of Data Structures for Admission Control of Advance Reservation Requests, IEEE Transactions on Knowledge and Data Engineering, v.17 n.3, p.413-424, March 2005 Bharadwaj Veeravalli, Network Caching Strategies for a Shared Data Distribution for a Predefined Service Demand Sequence, IEEE Transactions on Knowledge and Data Engineering, v.15 n.6, p.1487-1497, November David H. T. Chieng , Alan Marshall, A flexible bandwidth resource provisioning system with agent-enhanced SLA negotiation, Journal of High Speed Networks, v.13 n.1, p.1-23, January 2004 Debasish Ghose , Hyoung Joong Kim, Scheduling Video Streams in Video-on-Demand Systems: A Survey, Multimedia Tools and Applications, v.11 n.2, p.167-195, June 2000 Mumtaz Siddiqui , Alex Villazn , Thomas Fahringer, Grid allocation and reservation---Grid capacity planning with negotiation-based advance reservation for optimized QoS, Proceedings of the 2006 ACM/IEEE conference on Supercomputing, November 11-17, 2006, Tampa, Florida References, Grid resource management: state of the art and future trends, Kluwer Academic Publishers, Norwell, MA, 2004
resource reservation;multimedia;quality of service;resource management;advance reservation
597100
Handling Updates and Crashes in VoD Systems.
Though there have been several recent efforts to develop disk based video servers, these approaches have all ignored the topic of updates and disk server crashes. In this paper, we present a priority based model for building video servers that handle two classes of events: user events that could include enter, play, pause, rewind, fast-forward, exit, as well assystem events such as insert, delete, server-down,server-up that correspond to uploading new movie blocks onto the disk(s), eliminating existing blocks from the disk(s), and/or experiencing a disk server crash. We will present algorithms to handle such events. Our algorithms are provably correct, and computable in polynomial time. Furthermore, we guarantee that under certain reasonable conditions, continuing clients experience jitter free presentations. We further justify the efficiency of our techniques with a prototype implementation and experimental results.
Introduction Over the last few years, there has been a tremendous drop in digitization costs, accompanied by a concomitant drop in prices of secondary and tertiary storage facilities, and advances in sophisticated compression technology. These three advances, amongst others, have caused a great increase in the quality and quantity of research into the design of video servers [2, 4, 11, 6, 10, 16]. Most models of video servers to date assume the following parameters: 1. Movies are stored, in part, or in their entirety, on one or more disks. 2. The video-on-demand VoD system is responsible for handling "events" that occur. Client events that have been studied include: ffl the enter of a new client into the system, requesting a movie, ffl the exit of an existing client from the system. ffl the activities of continuing clients (e.g. play, fast forward, rewind, pause). "Handling" an event refers to the process by which the VoD server assigns jobs to different disk servers, so as to optimize some performance criterion. A variety of algorithms to "handle" the above events have been studied by researchers. Authors' Address: Department of Computer Science, University of Maryland, College Park, MD 20742. All the above events are "user" events, in the sense that they are invoked or caused by the activities of a user of the VoD system. However, in reality, there is another class of events that must be accounted for, which we call system events, which includes events such as server-down (specifying that a certain disk server has crashed), server-up (specifying that a disk server that had previously crashed is "up" again), insert (specifying that the system manager wishes to include some new movies (or blocks of movies) on a disk), and delete (specifying that the system manager wishes to delete some movies from a server's disk array). Most work to date on server crashes has focused on the important topic of recovery of data on the crashed disk, but has not really looked into how to satisfy clients in the VoD system who were promised service based, in part, on the expectation that the crashed disk would satisfy some requests. The main focus of this paper is to develop VoD server algorithms that can handle not just user events, but can also handle system events. The problem of updates in video servers is crucial for several applications where video data is being gathered at regular intervals and being placed on the VoD system. For example, a movie-on-demand vendor may, at regular intervals, include new movies in the repertoire of movies offered to potential customers. These movies need to be placed on the disk array that the vendor may be using, leading to an insert operation. Similarly, in news-on-demand systems, new news videos and audio reports may become available on a continuing basis, and these need to be made available to editors of news programs for creating their current and up to date news shows. In many similar systems today, this is done by taking the system "down", accomplishing the update, and then bringing the system back "up" again. The obvious undesirable aspect of this way of handling updates is that service must be denied to customers who wish to access the server when it is down, thus leading to lost revenues for the VoD vendor. The algorithms proposed in this paper treat updates as (collections of) events, and schedule them to occur concurrently with user-events in a manner that ensures that: 1. existing customers see no deterioration (under some reasonable restrictions) in the quality of service, and 2. the update gets incorporated in a timely fashion. In particular, our algorithms will flexibly adapt to the load on the disks, so as to incorporate as much of the update as possible when resources are available, and to reduce the update rate when resources have been previously committed. 3. the system is not "taken down" in order to accomplish the update. Unlike the issue of updates, disk crashes have certainly been studied extensively over the years [2, 12]. However, consider the problem of a VoD server that has made certain commitments to customers. When a crash occurs, the VoD server must try to ensure that any client being serviced by the disk that crashed be "switched" to another disk that can service that client's needs. Furthermore, the VoD server must ensure that the fact disk d has crashed be taken into account when processing new events. In the same vein, when a disk server that had previously crashed comes back "up", this means that new system resources are available, thus enabling the VoD server to take appropriate actions (e.g. admit waiting clients, re-distribute the load on servers to achieve good load balance, etc. We show how our framework for handling updates can handle such crashes as well (under certain limitations of course). In particular, we propose an algorithm called the VSUC ("Video Server with Updates and Crashes") algorithm, that handles events (including user events, as well as update events and crashes) and has several nice properties. In particular: Disk Array Server Disk Array Server n Disk Array Client 1 Client 2 Client m-1 Client m High Speed Network ROUTER Figure 1: System structure. ffl VSUC guarantees that under certain conditions, it ensures continuous, jitter free service for clients, once they have been admitted. (We will make the conditions precise in Theorem 4.1). ffl VSUC also guarantees (again under certain conditions), that no client is denied service for arbitrarily long (cf. Theorem 4.2). ffl VSUC reacts to client events, as well as system events in polynomial time. System Architecture Throughout this paper, we will use the term video block (or just block) to denote a video segment. We will assume that the size of a block is arbitrary, but fixed. In other words, one VoD application may choose a block to be of size frames, while another may consider it to be of size 60 frames. As our video data is stored on disk, this means that the start of each video block is located on a single page of any disk that contains the block. As data is laid out on a collection of disks, we will assume that this collection of disks is partitioned into disjoint subsets DC 1 We will furthermore assume that all disks in DC i are homogeneous (i.e. have identical characteristics) and a single disk server DS i regulates access to the disk drives in DC i . It is entirely possible that DC i contains only one disk, but it could contain more. Note that there is no requirement that two disk collections DC need to have the same characteristics and hence, disks in DC i may have vastly different characteristics than those in DC j - this is what accomplishes heterogeneity. The design of disk servers is now well known [2, 4, 11, 6, 10, 16]. In its simplest form, a disk server is a piece of software that, given a physical disk address, retrieves the object located at that address. In our case, disk servers DS i mediate access to a collection DC i of disks, which means that given a disk-id and a physical disk address, the server retrieves the block located at the given disk address on the specified disk. Figure 1 shows the structure of the system as described informally above. In our architecture, the video server is responsible for the following tasks: 1. When an event (user event or system event) occurs, the video server must determine how to handle the event. This is accompanied by creating a schedule to accomplish the event, and deciding what instructions must be sent to the disk server(s) involved to successfully handle the event. For example, for a user event play, such instructions could include: Fetch (for client cl id) the block starting on page p of disk d. Note that the disk server does not necessarily need to know the client's identity, cl id. 2. In addition, the video server may need to "switch" clients from one disk server to another. For example, client cl id 1 may be being served by disk server DS 1 . If a new client cl id 20 requests a movie (or block) that is only available through disk server DS 1 and if disk server DS 1 is already functioning at peak capacity, then it may be possible to "switch" client cl id 1 to another disk server (say DS 2 has the resources needed to satisfy client cl id 1 3. Third, the video server may "split" a job into smaller, manageable jobs, and distribute these smaller jobs to different servers, which leads to better system utilization. 4. Fourth, whenever events such as disk server crashes occur, the VoD server must re-assign the existing clients to other servers (when possible) and schedule system generated recovery events so as to minimize the damage caused by the crash. 2.1 System Parameters In any VoD system, the participating entities may be divided into the following components: 1. Servers: these are the disk servers that retrieve specified blocks from the relevant disks; 2. Clients: these are the processes that are making/issuing requests to the servers; and 3. Data: this includes the movie blocks laid out on the disks. In order to successfully model a VoD system, and develop provably correct and efficient algorithms for this purpose, we must model each of the above parameters, as well as the interactions between the above components. Tables 2,3, and 4 show the notations we use to denote the relevant parameters of servers, clients, and movies, respectively. Throughout this paper, we assume that there is a set of movies that we wish to store on disk. Each movie M i has bnum(M i ) "blocks". A block denotes the level of granularity at which we wish to store and reason about the media-data. For example, a block may be a single-frame (finest granularity) or a consecutive sequence of (100 frames). The application developer is free to select the size of a block in any way s/he wishes, but once such a block size is selected, s/he is committed to using the selected block size for the application. In other words, they are free to choose their block size as they wish, but once they make the choice, they must stick to it. Symbol Meaning buf(i; s) The total buffer space associated with the disk server i at state s. s) The total cycle time for read operation by the server i at state s. s) The total disk bandwidth associated with the disk server i at state s. s) The time-slice allocated to client j at state s by server i. (i) The set of servers handling request by client i at state s. s) The set of servers that contain block b of movie M i according to placement mapping - at state s. server client(i; s) The set of all clients that have been assigned a non-zero time-allocation by disk server i at state s. server status(i; s) The status flag for server i. It is true when the server is working, false otherwise. s) The time required for the disk server i to switch from one client's job to another client's job at state s. s) The buffer space needed at the server i to match the consumption rate of client j at state s. priority(e; s) The priority of the event e at state s. Figure 2: Server Parameters Symbol Meaning s) The consumption rate of client i at state s. s) The set of data blocks that server i is providing to client j at state s. inuse(i; s) This set consists of 3-tuples, (j; M k ; b), it specifies that the server i is providing block b of movie M k , to client j at state s. active client(s) The set of all clients that are active at state s client(m; s) The set of all clients that are watching movie m at state s rew win(i; s) The size of rewind window for client i at state s. This means the client can not rewind the movie more than that many blocks. s) The size of fast forward window for client i at state s. This means the client can not fast forward the movie more than that many blocks. play win(i; s) The time limit for client i to access the system at state s. pause win(i; s) The time limit for client i to pause at state s. Figure 3: Client Parameters Symbol Meaning The number of blocks for a movie M i . Figure 4: Movie Parameters 3 State Transition Model In this paper, we will develop a state transition model that has the following properties: ffl A state is any feasible configuration of the system, and includes information such as: which disk server(s) are serving a client, and what service they are providing to the client, and what resources are committed by the server to the client to accomplish the service provided. ffl The state of the system may change with time, and is triggered by events. Events include: Client events such as enter, exit, fast-forward, pause, rewind, play, as well as - Server events such as server-down, server-up where a server goes "down" or comes back "up", and Manager events such as insert, delete. Note that manager events could either be initiated by a human VoD system manager, or by a tertiary storage device that is staging data onto disk (though we will not go into this possibility in detail in this paper). 3.1 What is a State ? A system state s consists of the following components: 1. A set active client(s) of active clients at state s. 2. The current cyctime(i; s) of each server in the system. 3. The consumption rates of the active clients (cons(i; s)) in state s. 4. The time, timealloc(i; j; s), within cyctime(i; s) that has been allocated by server i to client j in state s. 5. The locations (-(m; b; s)) of each movie block, i.e. the set of all servers on which block b of movie m is located in state s. 6. The set of data blocks (data(i; j; s)) being provided by server i to client j in state s. 7. A client mapping - s which specifies, for each client C, a set of servers, - s (C), specifying which servers are serving client C. 8. A set down servers(s) consisting of a set of servers that are down in state s. 9. A set insert list(s) consisting of a set of 3-tuples of the form (i; m; b) where m is a movie, b is a block, and i is the server where this block will be inserted. (This set is used to model a set of insertion updates that are "yet to be handled.") 10. A set delete list(s) consisting of a set of 3-tuples of the form (i; m; b) where m is a movie, b is a block, and i is the server where this block will be deleted. (This set is used to model a set of deletion updates that are "yet to be handled.") 3 A system state s must satisfy certain simple constraints that we list below. 1. For each server i that is not down, the sum of the time-allocations assigned to the clients being served by that server must be less than the cycle time of the server. This is captured by the 2. If a server is processing a request for some data, then that data must be available in the server. This is captured by the expression: 3. The sum of consumption rates of the clients being served by a given disk server must not exceed the total disk bandwidth of the server. This is captured by the expression: 4. For each server i that is down, there is no active client. This is captured by the expression: The above constraints specify the basic constraints that tie together, the resources of the VoD disk server system, and the requirements of the clients. 3.2 Prioritized Events Informally speaking, an event is something that (potentially) causes the VoD system to make a transition from its current state to a "next" (or new) state. The study of the performance of disk servers for multimedia applications varies substantially, depending upon the space of events that are considered in the model. In our framework, the space of events that are allowed falls into two categories: ffl Client events: enter,exit,pause,play,fast-forward,rewind; ffl System events: server-up, server-down, insert, delete. Each event has an associated integer called the priority of the event, and a set of attributes. For example, the event server-up has an attribute specifying which server is up. Thus, server-up(2,s) specifies that the event "server 2 is up" has occurred at state s. Likewise, the event insert has three attributes - a server id, movie id, and a block number - specifying the server to which the event is assigned, the movie identifier and the movie block identifier. For example, the event insert(2,m1,b1) specifies that block b1 of movie m1 is being inserted into server 2. The priority of an event is chosen either by the importance of the event or by the inherent attributes of the event. For example, handling client event like play inherently implies delivering continuous data stream to the client. If the data stream is interrupted due to any reason, then the client may experience degradation in the quality of service. This degradation has to be avoided by choosing appropriate priority for play event. As an example of system event, we can consider delete event. In the case where enough disk space is not available to download hot movies, the system should be able to make space by deleting data blocks as soon as possible. To expedite data deletion, the event should be assigned high priority. Before specifying how events are handled, we describe some concepts underlying our approach. 3.3 Modeling Usage Constraints In any VoD system, the system administrator may wish to enforce some "usage" constraints. In this paper, we do not try to force constraints upon the system. However, we do make available to the system administrator, the ability to articulate and enforce certain types of constraints that s/he feels are desirable for his system. ffl Pause time constraint: A pause time constraint associates, with each client c, an upper bound, pause win(c; s), on the amount of time for which the customer can "pause" the movie s/he is watching. For example, suppose pause win (John Smith, s)=25. This means that as far as the system is concerned, John Smith's pause time cannot exceed time units at state s. If the pause window expires, then the resources allocated to him by the VoD system will be "taken back" to satisfy other users' requests. In general, when a customer "pauses", the server(s) satisfying the customer's request continues to "hold" the resources which were assigned by the system. Clearly, holding such resources for an indefinite period is not wise. The pause window specifies, for each customer, an upper bound on the period of time for which the customer can pause the movie. ffl Fast-forward/Rewind window constraint: In addition to pause window constraint discussed above, each client c is associated with fast-forward and rewind window constraint which specifies an upper bound on the number of data blocks that the client can fast-forward or rewind, respectively. The fast-forward and rewind windows associated with client c at state s is specified by ff win(c; s) and rew win(c; s). ffl Play time constraint: Finally, sometimes, it might be desirable to put a restriction on the time that a client can be serviced by the server for a request. This constraint can help to prevent valuable resources from being taken for a arbitrary long time by irresponsible usage. Also, by establishing the maximum time that a client can access the system for a request, every request will eventually be satisfied by the server. The total play time constraint for a client i is specified by play win(i; s). For example, play win (John Smith, s)=180 says that John Smith has at most 180 time units to finish viewing the current movie. To client c1 read delete m1:b1 c1 cannot rewind m5: [b21-b40] m4: [b01-b30] m3: [b41-b50] m2: [b31-b60] m5: [b21-b40] m4: [b01-b30] m3: [b41-b50] m2: [b31-b60] Figure 5: Deletion of a block 3.4 Update Boundaries Suppose s is a system state (at some arbitrary point in time) and j is a client being served by a server i. The state s contains a data tuple specifying what data is being provided to the client by that server. For example, consider the situation described in the example of Section 3.1. In that example, in the state shown, server 1 is presenting blocks b2 and b3 of movie m1 to client c 1 Now, suppose the system administrator wishes to delete block b1 of movie m1 on server 1. Figure 5 shows this situation. While the system manager has the ability to make the request at any time, the precise time at which the request is actually scheduled (i.e. the precise time at which deletion of the block is scheduled) must take into account, the existing clients watching that movie w.r.t. the server in question. In this case, the question that needs to be addressed is: What happens if the client c 1 wishes to rewind to b1? If the deletion is incorporated immediately upon receipt of the deletion request, then the rewind request of the client will be denied - a situation that may or may not be desirable. Thus, at any given point in time, each client has an associated rewind boundary associated with each server, specifying "how far back" that server can support a rewind request issued by the client. The rewind boundary may change with time. Rewind boundary, and its dual concept, fast-forward boundary, are defined below. Definition 3.1 (Rewind Boundary) The rewind boundary of a movie m w.r.t. server i in state s is defined as follows: Rewind Boundary(m,s) If the above set over which the min is performed is empty, that is, movie client(m,s) is empty, then Rewind example, let us return to the movie m2 at server 2 and the state s in 1. client c 5 is reading block b4 of movie m2; 2. client c 6 is reading block b3 of movie m2; block being read by c5 block being read by c6 rewind boundary rewind window for c5 rewind window for c6 this block can be updated (= min of the two above boundaries ) Figure Rewind boundary computation 3. no other client is reading movie m2 (exactly what they are doing is not pertinent for this example). If the rewind window for client c5 is 2, and that of client c 6 is 1, then the rewind boundary associated with server 2, movie m2 and state s is given by 2: Let us try to see why this is the case, and what this statement means. (Figure 6 illustrates this reasoning). ffl Two clients, viz. c 5 , are reading (parts of) movie m2 from disk server 2. If we try to update the copy of movie m2 residing on disk server 2, the only clients who can be affected (in the current state) are therefore clients c 5 and c 6 Client c 5 is currently reading block b4 and his rewind window is of length 2, which means he can only go "back" 2 blocks in the movie by executing a rewind command. Effectively, this means that he cannot access any blocks before block b2. ffl Likewise. client c 6 is currently reading block b3 and his rewind window is of length 1, which means he can only go "back" 1 block in the movie by executing a rewind command. Effectively, this means that he cannot access any blocks before block b2. ffl As the minimum of these two blocks is b2, this means that neither client has read access to block b1 in this state. ffl Thus, if we wish to update block 1 which lies "below" this rewind boundary, then this is "safe." An analogous situation occurs w.r.t. fast forward boundaries which are defined as stated below. c3's ff_window c2's ff_window c4's ff_window c1's ff_window current reading block13 Figure 7: Fast forward boundary computation Definition 3.2 (Fast Forward Boundary) The fast forward boundary of a movie m in state s is defined as follows: FF Boundary(m,s) If the above set over which the max is performed is empty, that is, movie client(m,s) is empty, then FF example, consider the single disk server in Figure 7. This disk server, i, contains several movies, but only one of these, viz. movie m4 is shown in the figure. Blocks 1-5,7-20 of this movie are available on the disk server i. Suppose that in state s, we have four clients watching this particular movie (other clients may be watching other movies) and that the blocks these clients are watching and the fast forward windows of these clients are as given below: Client Block being watched ff win Then, the fast forward boundary is given by: FF This means that only blocks 13-20 of the movie may be updated at this point of time. The primary use of rewind boundaries and fast forward boundaries is to ensure that when an update request is made by the system manager, that the users viewing the application have the flexibility to rewind or fast forward, within the limits of their fast forward/rewind boundaries. Notice that it is not always possible to guarantee this. For example, in figure 7, if client c 1 wishes to fast forward to block 6, there is no way to satisfy this request without switching him to another disk server, because the disk server in figure 7 does not have block 6. With these definitions in mind, we are now ready to define how to handle events. Handling Events In this section, we provide detailed algorithms for handling events. We will first provide an abstract, declarative specification of what constitutes an appropriate way of handling events. Then, we will provide algorithms to successfully handle events. 4.1 Optimal Event Handling: Specification and Semantics Suppose s is a valid state of the system, and e is an event that occurs. In this section, we will first specify what it means for a state s 0 to handle the event e occurring in state s. This will be done without specifying how to find such a state s 0 . We will later provide algorithms to handle such events. Definition 4.1 (Event Handling) State s 0 is said to handle event e in state s iff one of the following conditions is true: 1. New clients: [e =New client c enters with a request for movie m:] 2. Old clients: [e =Old client c exits the system] 3. Continuing clients: (a) (e =Continuing client c watches, in "normal viewing" mode, block b of movie m) (b) (e =Continuing client c pauses) (c) (e =Continuing client c fast forwards from block b to block b (d) (e =Continuing client c rewinds from block b to block 4. Server status event: (a) (e =disk server i crashes) (b) (e =disk server i comes back "up") rewind windowforward window rewind ff boundary Figure 8: Example of deferred updates 5. Update event status: (a) movie m from server i) delete list(s 0 ))). The handling of update events requires some intuition. Let us suppose, that we have a movie containing 100 blocks which is stored, in its entirety, on one disk server, and we have 2 clients c 1 who are watching the movie, via this server. Let us say that is watching block 45, and c 2 is watching block 50, and each of them is consuming 1 block per time unit (just to keep things simple). Let us further say that the system manager now wishes to update the entire movie, replacing old blocks by new ones (which may be viewed as a simultaneous insert and delete). Additionally, both clients c have rewind windows and fast forward windows of 5 blocks each. Figure 8 shows this situation. ffl At this stage, the rewind and fast forward boundaries for this movie are 40 and 55, respectively. ffl This means that blocks may be safely updated right away (assuming that enough bandwidth is available). ffl The blocks b such that 40 - b - 55 can only be updated later, i.e. the updating of these blocks must be deferred. ffl For example, after one time unit, block 40 can be updated. After 2 time units, block 41 can be updated, and so on. The skeptical reader will immediately wonder whether this definition allows us to postpone update events for an arbitrarily long time. The answer is that as stated above, update events could get deferred for ever. To avoid this situation, and to also assign different priorities to different clients, we now introduce the notion of priority. Associated with each event (client initiated or system initiated, or deferred) is a priority. The higher the priority, the more important the event. In particular, if e is an update event, and e is deferred, then for each time unit that e is updated, we must "increment" e's priority by a factor ffi e . Thus, different events can have different associated ``prioritization steps'' which may be selected by the system manager, based on the importance of the event as determined by him/her. What this means is that the priority of an update events "gradually rises" till it can be deferred no longer. We discuss this scheme in detail below, and also show how the same idea applies to priorities on other (non-deferred) events. 4.2 Priority Scheme for events Whenever an event occurs, that event is assigned an initial priority, either by the system, or by the system administrator. The system maintains a list of default priority assignments. In the event of a different priority assignment being made by the system administrator, then the latter overrides the former. Integers are used to represent "initial" priority assignments, though as we shall see, "non-initial" priority assignments may be real-valued. The precise integers used for initial priority assignment are not really important. What is more important is the relative priority ordering. Initial Priority Assignments: Figure 9 shows the initial priority assignments. The rationale for these assignments is discussed below. 1. System events have the highest priority. The reason for this is that a server crash, or a server coming "back up" are events that are hard to control. It is not possible, for instance, to defer or delay a crash. If it occurs, the system must transition to a new state that "handles" the crash as best as possible. 2. Next, existing clients already being served by the system must have the highest priority. The reason for this is that the VoD system has made a commitment to serve these clients well, and it must try to honor these commitments. However, each existing client may "spawn" different events, including exit, pause, play, fast forward, and rewind. Each of these events has a different priority. (a) The highest priority is assigned to events that exit. Processing an exit event early is desirable in general, because this can be done very fast, and furthermore, this frees up resources that may be used to satisfy other clients (continuing clients, as well as potential new clients). (b) The next highest priority in this class is assigned to pause events because: first these events request no new resources (and hence, they can be satisfied immediately) and second, because of the pause window, these events may lead to future exit events that do in fact (c) The next highest priority in this class is assigned to play events. The reason for this is that in most cases, play events are relatively easy to satisfy as they merely require that the next block of the movie be fetched, and in most cases, the next block will be on the disk(s) that are already serving the client. (d) The last two events in this category, with equal priority, are rewind and fast forward. These events may require substantial "switching" of clients (i.e. a client may be switched from its current server to another, because when blocks are skipped, the current server no longer has blocks that are several "jumps" ahead of the block currently being scanned. 3. New clients who just entered the system or has been waiting for service have the lowest priority among user events. The reason for this is that once the video server started to serve a client, that service should be continued with minimal disruption. But, in the case of new clients, it is reasonable to expect some delay before the service starts. However, this shouldn't cause new clients to wait infinitely. In this paper, this situation is handled by increasing the priority incrementally. Event Type Event Priority System Server down 9 System Server up 9 Client (old) Exit 7 Client (continuing) Pause 6 Client (continuing) Play 5 Client (continuing) Fast - Forward 4 Client (continuing) Rewind 4 Client (enter) Enter 3 Manager Delete 2-7 Manager Insert 1 Figure 9: Initial assigned priorities for different events 4. Of the system events, the delete event has the highest priority. The reason for this is that delete events can be accomplished by a very simple operation - just remove the pointers to the appropriate blocks. In contrast, insert events require greater resources (e.g. disk bandwidth is needed to write onto the disk). Priority Steps: Suppose an update request is received for block b of movie m in server i. Further- more, suppose rwb and fwb denote, respectively, the rewind boundary, and the fast forward boundary associated with the current state. It is not difficult to see that we must have rwb - ffb. The update cannot be carried out immediately if rwb - b - ffb. As a consequence, we might need to defer the update. However, as mentioned above, deferring the update might cause the event to be indefinitely delayed. One possible way to avoid this is to assign higher priority to update events than client events, so that they can be handled first. The problem here is that this might cause the continuous streams to experience interruption. To handle update events eventually as well as to minimize their effect on continuous streams, we define priority-step. The priority step ffi u is specified by the system administrator for the update request u. ffi u is a non-negative real number, and its interpretation is as follows: is the current state (in which the update u occurs with the priority p shown in Figure 9 (p must be either 1 or 2). are states that occur, consecutively after s 0 , all of which defer update u. ffl Then the priority p i of the update event u in state s i is (p Thus, for example, suppose u is a deletion request, and the system manager assigns a step of 0:2 to u. Then, after 6 state changes (i.e. in state s 6 ), the priority of this update will be 3:2, which would exceed the priority of a new event (which is occurring in that state. What this means is that if a new client enters the system in state s 6 , and requests a movie, then the server in question would be asked to consider the higher priority update request u, as opposed to serving the customer. By making the step size small, the system manager can allow a greater period of time to elapse before making the update have higher priority over new clients. For example, had the system manager set ffi u in the above example to 0:002, then 501 state changes would have to occur, before update u's priority exceeded that of a new client. Furthermore, the system manager does not have to specify the same priority step for each update. Different updates can have different associated priorities, as would be expected in most real life systems. We are now ready to give an algorithm that manipulates the priorities, such as those shown in Figure 9, and the above priority steps, to handle events that occur at any given point in time. Video Server with Updates and Crashes (VSUC) Algorithm main HandleEvents ( NewEvents, OldEvents ) f set of events that can't be scheduled in this cycle */ set of client events that have been scheduled successfully */ While ( !timeout and EvtList get the first event in EvtList ; switch f case case case play, rewind, fast-forward : handleContEvents ( evt ) case pause : handlePauseEvents ( evt ) case case enter : handleEnterEvents ( evt ) case insert: handleInsertEvents ( evt ) case delete: handleDeleteEvents ( evt ) increase priority of each event in EvtList by merge events from EvtList and WaitList ; return procedure HandleServerDownEvents ( evt ) for each data block b i in crashed server do update placement mapping so that b i is not visible ; for each event e i in crashed server do insert e i into EvtList preserving the sorted order ; procedure HandleServerUpEvents ( evt ) f for each data block b i in recovered server do update placement mapping so that b i is visible ; procedure HandleExitEvents ( evt ) f release resources and data structures allocated for evt ; procedure HandleContEvents ( evt ) f set of blocks necessary for servicing evt ; /* depending on event type, the way blocks are read from disks can be */ /* different. For example, in play event, certain number of continuous */ blocks should be read, but in rewind(ff) event, some intermediate blocks */ /* can be skipped to match the speed */ if ( servers that have been assigned to evt contain all blocks in Blocks ) f update the data component of evt ; insert evt into DoneList ; return set of servers that contain all blocks in Blocks ; placement mapping error */ f /* make evt considered after block insertions */ decrease evt's priority by insert evt into EvtList preserving the sorted order ; return set of servers in DServers satisfying resource constraints ; f if ( evt's priority has been decreased previously ) f Finished while ( Svlist 6= ; and !Finished ) do f select one server randomly from Svlist ; event e is served by s and there exists s 0 (6=s) that satisfies e while ( Switchables 6= ; and !Finished ) do f select one event randomly from Switchables ; if ( evt can be served using the resources that will be released from e 0 ) f release resources from e 0 and update resource allocation of s ; allocate resources to evt and update resource allocation of s ; allocate resources to e 0 and update resource allocation of s put evt into DoneList ; Finished f /* make evt scheduled prior to other clients in next cycle; */ increase evt's priority by ffi 0 evt insert evt into WaitList ; else f /* make evt considered after scheduling other normal continuing clients */ decrease evt's priority by ffi '' evt insert evt into EvtList preserving the sorted order ; else f for each server s i in RServers do f for the specified criteria ; f allocate resources to evt from update resource allocation of insert evt into DoneList ; procedure HandlePauseEvents ( evt ) f yield disk bandwidth to update events for next cycle ; keep the other status unchanged ; procedure HandleEnterEvents ( evt ) f /* enter event can be handled in a way similar to handling continuous events. */ /* The difference is that in the case of enter events, resources have not */ /* been assigned previously. Therefore, checking if already assigned server */ /* can handle the event is not necessary for enter events. */ procedure HandleInsertEvents ( evt ) f s evt server that data block is inserted into ; /* specified in evt */ the size of data that is inserted into s evt data size that server s evt can handle using available resources ; f allocate resources to evt ; update resource allocation of s evt by Dsize ; update placement mapping information of s evt else f Dsize can't be inserted in its entirety */ allocate resources to evt ; update resource allocation of s evt by Msize ; reduce evt's data size by Msize ; increase evt's priority by insert it into WaitList ; procedure HandleDeleteEvents ( evt ) f number that is deleted ; calculate the rewind and fast forward boundary of the movie ; rewind boundary or b evt ? ff boundary ) delete b evt and update placement mapping information ; else f /* evt is deferred to next cycle */ increase evt's priority by ffi evt insert it into WaitList ; It is easy to prove that the VSUC algorithm described above has a number of nice properties, as stated in the theorems below. An informal description of these properties is as follows: ffl Under certain reasonable conditions, clients who have already been admitted to the system experience no jitter, independently of what other events occur. This result applies when (1) if the placement mapping is "full" (i.e. either the entire movie is available through a server, or none of it is), and (2) when the client watches a movie entirely in "normal" viewing mode, and (3) no server outages occur. ffl Every event eventually gets handled as long as servers that go "down" eventually come back "up." ffl The VSUC algorithm runs in polynomial time, i.e. if the current state is s and if ev is the set of events that occur, then a new state s 0 (together perhaps with deferred events) is computed in polynomial time. Theorem 4.1 (Continuity of Commitments) Suppose s is the current state of the system, and C i is a continuing client in state s who is watching movie m in "normal" mode. Furthermore, suppose 1. movie m is contained in its entirety in each server sv 2 - s (i) and 2. no server in - s (i) goes "down" at this time and 3. for all updates u (before client C i entered the system,) that were deferred when client C i enters, pr where pr u is the priority of the update u when client C i enters the system, ffi u is the priority step associated with the update, and ffi C i is the priority step associated with C i . 4. for all updates u (before client C i entered the system,) that enter the system after client C i enters, newpr where newpr u is the priority of the update u when it enters the system. Then client C i 's movie request event will be satisfied by the VSUC algorithm. Proof Sketch. In the VSUC algorithm, the only event that diminishes the system's resources and that has a higher priority than a continuing client is a server down event or a deferred update event. However, by the assumption in the statement of the theorem, no servers serving client C i go down, and hence, the highest priority events are either deferred updates or continuing clients. Suppose a server sv is serving client C i 's request (in part or in full). If no deferred events occur, then the same server can continue servicing client C i 's request for ``next'' blocks. However, if deferred events occur, then there are two possibilities: 1. Suppose the deferred update u was requested before client C i entered the system. As pr u - 5 and as ffi , it follows that throughout the normal playing of the movie, client C i 's priority is higher than that of the update u. Thus, server sv continues to serve client C i without allowing deferred events to obtain priority over the client C i . 2. On the other hand, if the deferred update was requested after client C i entered the system, then client C is guaranteed to obtain priority over the update because newpr Hence, client C i can continue to be served by server sv. 2 The above theorem has important implications for admission control, both of new clients and of new updates. ffl Client Admission: To guarantee continuity of service, a new client C i should be admitted to the system only if for all deferred updates u that need to be handled when client C i enters the system, we must know that pr u - 5 and ffi ffl Update Admission: To guarantee continuity of service to existing clients, a new update u should be admitted to the system only if newpr Theorem 4.2 (All update events get handled eventually) Suppose s is the current state of the system and ev is any update event that requires a set SV of servers. Further suppose that for all times t ? now and all servers in SV , if there exists a time t 0 ? t at which one or more servers in SV go down, then there exists a time t ? ? t 0 at which all servers in SV come back up. Then: for any update event ev that occurs now, there exists a time t ev - now such that ev gets handled at time t ev . Proof Sketch. If update event ev does not get handled now, then, as in each execution of the VSUC algorithm, event ev's priority strictly increases till it exceeds 7, at which point t 0 in time, it will be handled unless one or more servers that are needed to service event ev are down. By the restriction in the statement of the theorem, there exists a time t ? ? t 0 at which all servers in SV are "up" simultaneously. We are guaranteed that this event will be handled latest at time t ? . 2 Theorem 4.3 Suppose ev(t) is a set of events that occur at time t. The time taken for the the VSUC algorithm to terminate is polynomial in the sum of the number of events in ev(t) and the number of deferred events. Proof. It follows immediately that each function call in the main algorithm runs in time polynomial w.r.t. the above sum. 2 5 Experiments 5.1 Crash Handling vs Survival rate Simulation experiments of the suggested VoD architecture were carried out. As we mentioned above, the video server consists of multiple disk servers with possibly different relative performance character- istics. The performance characteristics of disk servers are defined from 1(the lowest) to 4(the highest). Three disk server configurations considered in the experiments are homogeneous servers with highest performance characteristics, homogeneous servers with lowest performance characteristics, and heterogeneous servers with different performance characteristics [3]. In the following experiments, we examined the resilence of the video server against disk server crashes under different disk server configurations, i.e., how well the video server performs when crashes occur. The number of disk server crashes and crash time were generated randomly. We assumed that the crash recovery time is uniform. After the recovery time, the disk server would be available again for use. To compare the resilience of the video server, we repeated same experiment with different frequency of the server crashes, measuring average number of continuing clients after crashes. Figure shows the effect of handling server crashes on the number of continuing clients. Regardless of server configuration, the system could support more streams with crash handling than without crash handling. However, depending upon the performance characteristics of the servers involved, the number of continuing clients that could be supported varied. The most notable improvement was shown in the case of the homogeneous server with highest performance characteristics. As the frequency of disk crashes increases, the system will experience much more difficulty scheduling clients because resources and video data at the crashed servers are not available during crash recovery. Crash Handling Handling Effect of Server Crashes on Average Number of Continuing Client Probability of Server Crash Average Number of Continuing Client Heterogenous Homogenous-low Homogenous-high Figure 10: Effect of the disk server crashes.2040608010012040 70 100 130 160 190 220 250 280 310 340 370 400 430 460 490 520 550 580 Survival percentage Period of server crashes "Homogeneous-high" "Homogeneous-low" "Hetergeneous" Figure 11: Effect of server crash rate on survival rate. 1 Number of Video Clips 800 minutes video 400 minutes video 200 minutes video 100 2 Size of Video Segment 10-80 minutes 3 Size of Block 0.2 seconds' compressed video data 4 Number of Requests 800-2000 Request Pattern Based on actual data referenced in [5] 6 Number of Disk Servers 7 Types of Disk Servers Buffer / Disk bandwidth Group 3 32MB / 16MB Group 4 16MB / 8MB 8 Buffer size Avg. 50 MB per server 9 Disk Bandwidth Avg. 20 MB combined per server Table 1: Parameters used in simulation To measure how many clients can continue even after server crashes, we define survival rate as the ratio of clients who can continue to be served to the total number of clients in the system when crash occurs. Figure 11 shows that homogeneous disk servers showed a stable survival rate with respect to disk crashes. However, heterogeneous disk servers showed a noticeable variation in the survival rate. In the next experiment, we used different disk server configurations and examined the effect of crashes on disk servers with different performance characteristics. The request pattern for the video data is same as above. Table 1 shows several parameters related to the experiment. For the experiment, we used four different types of disk servers. Servers with the highest performance characteristics belong to group 1 and servers with the lowest belong to group 4. Under normal operation, servers with higher performance characteristics store more video segments and support more concurrent streams than those with lower performance characteristics. Therefore, the effects of disk crashes will vary depending on the performance characteristics of the server that crashes. Figure 12.a to 12.d show how many clients on the crashed server continue to be served even after disk crashes (under varying system load). For the comparison, we showed both the number of continuing clients with crash handling and without crash handling. Here, "after no crash handling" means that the streams on the crashed server(s) will be discontinued unconditionally. In these figures, the difference between the top line and the bottom line is the number of clients on the crashed disk. On the average, our crash handling VoD server algorithm can satisfy about half the clients affected by the crash by rescheduling their streams to other available servers. number of clients before server crash number of clients after crash handling number of clients after no crash handling Continuing Clients Before/After Server Crash in Group1 Clients in the system Number of continuing clients number of clients before server crash number of clients with crash handling number of clients after no crash handling Continuing Clients Before/After Server Crash in Group2 Clients in the system Number of continuing clients (a) Continuing clients in Group 1 (b) Continuing clients in Group 2 number of clients before server crash number of clients after crash handling number of clients after no crash handling Continuing Clients Before/After Server Crash in Group3 Clients in the system Number of continuing clients number of clients before server crash number of clients after crash handling number of clients after no crash handling Number Of Continuing Clients Before/After Server Crash in Group4 Clients in the system Number of continuing clients (c) Continuing clients in Group 3 (d) Continuing clients in Group 4 Figure 12: continuing clients after server crash 5.2 Performance vs Segmentation In this experiment, we examined the performance of the video server for different segmentations - here a segment refers to a continuous sequence of video blocks. We assumed that video objects are divided into several segments of equal size. These segments are placed in the disk servers in a way that adjacent segments should be placed in the different disk servers (otherwise multiple segments are merged into one large segment on a single server). Video segments were placed on the servers in a manner proportional to the size of the disk storage available, i.e., the probability that a video segment is placed on a disk having capacity 5 GB is 5 times the probability that same segment is placed on a 1 GB disk. Under this segment placement scheme, any two disk servers with adjacent segments should be synchronized for the seamless display of video stream. That is, as soon as a segment is consumed from the first server, the next segment should be delivered from the second server without delay. If the second server cannot deliver next segment in time, then clients may experience deterioration in quality of service. We will show later that this situation can be relaxed if we increase buffer space for each stream. number of segments: 1 number of segments: 2 number of segments: 4 number of segments: 8 800 1000 1200 1400 1600 1800 2000 2200200600100014001800Normal Continuing Clients Without Any Glitch Clients in the system Number of clients who experienced no glitch number of segments: 1 number of segments: 2 number of segments: 4 number of segments: 8 1000 1200 1400 1600 1800 2000 220010305070Average Interrupt Time Experienced by Clients Clients in the system length in cycles (a) Number of continuing clients (b) Average blocked time number of segments: 1 number of segments: 2 number of segments: 4 number of segments: 8 800 1000 1200 1400 1600 1800 2000 22002060100140180Average Initial Response Time Clients in the system Response time in cycles number of segments: 1 number of segments: 2 number of segments: 4 number of segments: 8 800 1000 1200 1400 1600 1800 2000 2200300500700900Number Of Updates Executed Clients in the system Number of updates executed (c) Average initial waiting time (d) Number of updates executed Figure 13: experiment results Figure 13.a shows how many streams will experience intermediate stream delay due to server switches for retrieval of adjacent segments. When video objects are stored in their entirety, then there is no need for server switches for the ongoing streams. But, as the number of segments in a movie is increased, the number of clients experiencing intermediate delays due to server switch increases. In Figure 13.b, we examined average intermediate stream delay experienced by the clients. It shows that once video objects are segmented, the average stream delay decreases as the number of segments increases. This is due to the fact that with smaller segments, clients stay at the server for a shorter time than larger segments. With shorter stays at the servers, resource availability of disk servers become flexible and therefore server switching can be done more easily and frequently. From figure 13.a and 13.b, we might conclude that storing video objects in its entirety on one disk server is the best scheme. But two other criteria show that this scheme has some disadvantages as well. Figure 13.c shows the server response time specifying how long each client has waited till the first frame of the video object was displayed. Under a moderate to a large number of clients in the system, the system response time increases sharply as the number of segments decreases. Also, the number of updates done during the simulation increases as the number of segments increases. Figure 13.d shows how many update requests have been done during the simulation. Furthermore, as mentioned earlier, intermediate stream delays due to server switches can be compensated to a certain degree if we increase buffer space for streams. From figure 13.b, average stream delay is less than cycles when the total number of clients is 1800. Therefore, as we increase the buffer space for streams, the number of clients experiencing actual intermediate display delay will be reduced. 6 Conclusions Though there has been extensive work on handling disk crashes most such work has occurred in the area of recovery of data on the crashed disk. Likewise, though there has been extensive work on developing systems support for handling VCR-like functions in video servers, this work has ignored two possibilities: 1. That during the operation of such a video server, updates might occur. The problem of handling such updates has not been adequately addressed in the literature. 2. Similarly, during the operation of such a video server, one or more servers might crash and/or otherwise become inaccessible. This means that any clients currently being served by those servers must be satisfied in some other way. To date, there has been no formal theoretical work on extending VoD servers to handle this possibility. The primary aim of this paper is to provide a formal model of VoD systems that is capable of handling such events, as well as to provide the VSUC algorithm that can neatly handle the variations in resource availability that may arise as a consequence of such events. In particular, the VSUC algorithm has many nice properties that, to our knowledge, have been proposed for the first time. ffl First, the VSUC algorithm guarantees that under certain reasonable conditions, users to whom the VoD server has already made commitments, will experience no disruption or jitter in service as long as they watch the movie in "normal" mode. ffl Second, the VSUC algorithm guarantees (again under certain reasonable restrictions) that no request made by a continuing client will be denied service "forever", i.e. it will eventually be handled. ffl Third, the VSUC algorithm reacts to both user events and system events, in polynomial time. Acknowledgements This work was supported by the Army Research Office under Grants DAAH-04-95-10174 and DAAH- 04-96-10297, by ARPA/Rome Labs contract F30602-93-C-0241 (ARPA Order Nr. A716), by Army Research Laboratory under Cooperative Agreement DAAL01-96-2-0002 Federated Laboratory ATIRP Consortium and by an NSF Young Investigator award IRI-93-57756. We are grateful to Dr. B. Prabhakaran for a careful reading of the manuscript and for making many useful comments and critiques. --R Staggered Striping in Multimedia Information Sys- tems Fault Tolerant Design of Multimedia Servers An Event-Based Model for Continuous Media Data on Heterogeneous Disk Servers Support for Fully Interactive Playout in a Disk- Array-Based Video Server "A Generalized Interval Caching Policy for Mixed Interactive and Long Video Workloads" Toward Workload Characterization of Video Server and Digital Library Application A Distributed Hierarchical Storage manager for a Video-on- Demand System On Multimedia Repositories Issues in the Design of a Storage Server for Video-On-Demand A Case for Redundant Arrays of Inexpensive Disks An Introduction to Disk Drive Modeling Disk Striping A Distributed Design and Performance Tradeoffs in Clustered Video Servers. Designing and On-Demand Multimedia Service Optimizing the Placement of Multimedia Objects on Disk Arrays Scheduling Algorithms for Modern Disk Drives --TR
constraints;priority and optimal handling;video server;updates;disk crashes
597142
Tune Retrieval in the Multimedia Library.
Musical scores are traditionally retrieved by title, composer or subject classification. Just as multimedia computer systems increase the range of opportunities available for presenting musical information, so they also offer new ways of posing musically-oriented queries. This paper shows how scores can be retrieved from a database on the basis of a few notes sung or hummed into a microphone. The design of such a facility raises several interesting issues pertaining to music retrieval. We first describe an interface that transcribes acoustic input into standard music notation. We then analyze string matching requirements for ranked retrieval of music and present the results of an experiment which tests how accurately people sing well known melodies. The performance of several string matching criteria are analyzed using two folk song databases. Finally, we describe a prototype system which has been developed for retrieval of tunes from acoustic input and evaluate its performance.
Introduction Music librarians are often asked to find a piece of music based on a few hummed or whistled notes. The magnitude of this task may be judged by the fact that the Library of Congress holds over six million pieces of sheet music-not including tens of thousands of operatic scores and other major works (Goodrum and Dalrymple, 1982). As digital libraries develop, these collections will be placed on-line through the use of optical music recognition technology (Carter, 1989; Selfridge-Field, 1994; Bainbridge and Bell, 1996). Furthermore, with the increasing use of music notation software for composition, it is likely that many compositions will be acquired in computer readable form-particularly by national libraries, such as the Library of Congress, that acquire material through copyright administration. The possibility of electronically searching corpora of music raises the interesting prospect of retrieval based on direct acoustic input. A user could literally sing a few bars and have all melodies containing that sequence of notes retrieved and displayed-a facility that would be attractive to casual and professional users alike. With advances in digital signal processing, music representation techniques, and computer hardware technology, it is becoming feasible to transcribe melodies automatically from microphone input. For example, a person can sing a tune and have it printed in ordinary musical notation. Searching large music databases and retrieving items in which a given theme or sequence of notes occurs is not a trivial Tune Retrieval in the Multimedia Library Rodger J. McNab 1 , Lloyd A. Smith 1 , Ian H. Witten 1 and Clare L. Henderson 2 1 Department of Computer Science 2 School of Education University of Waikato, Hamilton, New Zealand. {rjmcnab, las, ihw, clhend}@waikato.ac.nz undertaking, particularly given the inaccuracies that occur when people sing known melodies, but it is certainly within the scope of current technology. This capability will form an important component of the digital music library of the future. With it, researchers will analyze the music of given composers to find recurring themes or duplicated musical phrases, and both musicians and casual users will retrieve compositions based on remembered musical passages-perhaps imperfectly remembered. Moreover, the underlying technology for transcribing from acoustic melodies will facilitate the transcription of monophonic material such as field recordings of folk songs. Like most multimedia projects, developing a system for retrieving music from acoustic input is a multidisciplinary undertaking and, while there has been some work done on the individual components, there has been little effort to integrate them into a single system. Computer-based pitch trackers, which identify the frequency of acoustic input, have been around for thirty years or more, and hundreds of different algorithms have been developed (Hess, 1983). Askenfelt (1978) describes a system that automatically transcribes folk songs into music notation; however, the system requires extensive human intervention to correct wrongly transcribed pitches and rhythms. Hawley (1990) developed a system to search a tune database, given a note sequence entered via MIDI keyboard, but his system is inflexible in its retrieval strategy, returning only tunes whose beginnings exactly match the input. A great deal of work has been done in approximate string matching, particularly in identifying substrings in text (Wu and Manber, 1992) or genetic sequences (Bishop and Thompson, 1986). Our goal is to provide detailed design information, and a prototype system, encompassing all these aspects of a music retrieval facility. The system will transcribe acoustic input, typically sung or hummed by the user, and retrieve music, ranked by how closely it matches the input. It must operate on a substantial database of realistic size, and retrieve information in at most a few seconds. It is necessary to allow for inaccurate singing or imperfect memory on the part of the user, for variation in the way music is performed, and for differences between music as it is notated and performed. In order to take into account human inaccuracies of recall and of performance, we must model the kinds of errors that people make in remembering melodies, and in singing them; and devise flexible retrieval mechanisms that are tailored to the errors actually encountered in practice. Ghias et al. (1995) describe a system developed along the same lines, but which is rather more limited than our endeavor. The user hums a tune and the system tracks it using an autocorrelation method, converts it to a melodic contour, and matches this against a database of 183 songs. Ranked retrieval is performed, based on an approximate string matching algorithm that allows for replacement, dropout and duplication-although the system does not search for themes within songs. The biggest problems are the time taken to perform pitch tracking, the restriction to humming, the lack of attention to human performance in melody recall, and the very small database size. The present paper is a more comprehensive account of a somewhat more ambitious system. The paper is organized as follows. First we review the state of the art in signal processing for melody transcription, since this represents the main retrieval interface for tunes. The next question is how to match user input against the database. The requirements for the matching operation of a usable and useful library retrieval system turn out to be rather subtle, and in order to identify them we work from three directions. First we study the question of melody matching for music retrieval. Then we describe a pilot experiment on how people perform when asked to sing well-known songs. Next we analyze the characteristics of a test database of ten thousand folk songs in order to quantify how much information is required to identify tunes based on partial information of different types. These studies provide design information for a melody matching system that will satisfy users' requirements. Finally, we present an initial system for identifying and retrieving tunes from acoustic input. This is a "proof of concept" prototype that accepts acoustic input, typically sung by the user, displays it in standard music notation, and retrieves appropriate matching tunes from a database. 2. Automatic Transcription of Melodies Accepting acoustic input for musical retrieval is essentially a problem in music transcription. The analog acoustic signal is sampled for digital processing, notes are segmented from the acoustic stream, the frequency of each note is identified and each note is labeled with a musical pitch name and a rhythmic value. This section briefly describes how these problems are solved by a system for melody transcription called MT (McNab et al., 1996), which forms the signal processing front end for our acoustic music retrieval system. 2.1 The musical scale A musical scale is a logarithmic organization of pitch based on the octave, which is the perceived distance between two pitches when one is twice the frequency of the other. For example, middle C (C4) has frequency 261.6 Hz; the octave above (C5) is 523.2 Hz, and the octave below (C3) is 130.8 Hz. Although the octave seems to be a perceptual unit in humans (Deutsch, 1972), pitch organization within the octave takes different forms across cultures. In Western music, the primary organization since the time of Bach has been the equal-tempered scale, which divides the octave into twelve equally spaced semitones. The semitone is the smallest unit of pitch in Western music, but smaller units can easily be perceived and are used in the music of some cultures (Backus, 1969). The cent is defined as one hundredth of a semitone in the equal tempered scale. An octave, then, is 1200 cents. The smallest pitch difference between two consecutive tones that can be perceived by humans is about 3 Hz; this yields a pitch discrimination of about five cents at 1000 Hz. Above 1000 Hz discrimination stabilizes at about 4 cents. While pitch may be represented categorically in terms of octaves, semitones and cents, frequency is continuous. Assigning a musical pitch to a given frequency involves quantization. Semitone resolution is sufficient to quantize pitches based on a particular tuning standard (A-440, for example). To accommodate different tuning systems, however- including adapting to users, who inevitably sing slightly sharp or flat-higher resolution is essential. MT is designed around a pitch resolution of five cents (0.29%). 2.2 The MIDI note representation Since musical units-octaves, cents and so forth-are relative measures, a distance in cents could be calculated for each individual interval sung by the user. A fixed reference point, however, allows easier integration with applications. MIDI (Musical Instruments Digital Interface) is a standard for controlling and communicating with electronic musical instruments. It has many facets, the one most germane to our melody transcription system being its standard representation of the Western musical scale. MIDI assigns an integer to each note of the scale. Middle C (C4) is assigned 60, the note just above (C#4) is 61, and that below (B3) is 59. Although it makes little sense to assign pitch labels to frequencies below about 15 Hz, MIDI note 0 is 8.176 Hz, an octave below C0. The highest defined note, 127, is 13344 Hz, again not likely to be perceived as a musical note. The standard piano keyboard ranges from notes 21 to 108. In our melody transcription system, all pitches are related internally to MIDI notes, each being expressed as a distance in cents from 8.176 Hz. Notes on the equal tempered scale relative to A-440 occur at multiples of one hundred cents: C4, for example, is 6000 cents. This scheme easily incorporates alternative (non-equitempered) tunings of Western music, such as the "just" or Pythagorean system, simply by changing the relationship between cents and note name. It can also be adapted to identify notes in the music of other cultures. 2.3 Sampling and filtering For music transcription, we are interested only in the fundamental frequency of the input. Harmonics, which occur at integral multiples of frequency, often confuse pitch trackers and make it more difficult to determine the fundamental. Therefore the input is filtered to remove as many harmonics as possible, while preserving the fundamental frequency. Reasonable limits for the singing voice are defined by the musical staff, which ranges from F2 (87.31 Hz) just below the bass staff, to G5 (784 Hz) just above the treble staff. While ledger lines are used to extend the staff in either direction, these represent extreme pitches for singers and are unnecessary for music retrieval in the databases we are currently considering. Our retrieval system runs on an Apple Macintosh PowerPC 8500, which has built-in sound I/O. The acoustic waveform is sampled at 44.1 kHz and quantized to an 8-bit linear representation. Input is low-pass filtered with cutoff frequency of 1000 Hz, stopband attenuation -14 dB, and passband ripple of 2 dB. These are not stringent design requirements, and can be met by a digital finite impulse response (FIR) filter having nine coefficients (Steiglitz, Parks and Kaiser, 1992). The filtered signal is passed to the pitch tracker, which identifies its fundamental frequency. 2.4 Pitch tracking and note segmentation Sounds that are perceived as having pitch are made up of a number of recurring pitch periods. Algorithms for identifying the pitch of an acoustic signal may be classified by whether they work in the time domain, by examining the structure of the sampled waveform, the frequency domain, by examining the spectrum generated by a Fourier transform, or the cepstral domain, by performing a second Fourier transform on the log amplitude spectrum and examining the resulting cepstrum (Hess, 1983). It was not our purpose to perform research into pitch tracking-our focus is on the integrated multimedia application. For that reason, we chose to use the Gold-Rabiner pitch tracking algorithm (Gold and Rabiner, 1969), a time domain method which is well understood and documented, and which has become something of a standard against which other algorithms are compared; if another algorithm seems more appropriate at some point, we can replace our current pitch tracker without affecting the modules that use its output. The Gold-Rabiner algorithm assigns pitch by finding the repeating pitch periods comprising the waveform. Figure 1 shows 20 ms of a typical waveform for the vowel ah, as in father. Our implementation of the algorithm breaks the input sound into 20 ms frames and returns a pitch estimate for each frame. Once pitches have been identified, it is necessary to determine where notes begin and end. We have developed two ways of doing this, one based on amplitude and the other on pitch. Amplitude segmentation is simpler, but depends on the user's separating each note by singing da or ta-the consonant causes a drop in amplitude of 60 ms duration or more at each note boundary. Adaptive thresholds are then used to determine note onsets and offsets; in order to keep a marginal signal from oscillating on and off, the onset threshold is higher than the offset threshold. Figure 2 illustrates the use of amplitude to segment a series of notes. The alternative to amplitude segmentation is to segment notes directly from the pitch track by grouping and averaging 20 ms frames. An adjacent frame whose frequency is within 50 cents of a growing note segment is included in that segment. Any segment longer than 100 ms is considered a note. Pitch based segmentation has the advantage of relaxing constraints on the user, but may not be suitable for all applications-repeated notes at the same pitch may not be segmented, while a slide, or glissando, is segmented into a sequence of ascending or descending notes. After note onsets and offsets are determined, rhythmic values are assigned by quantizing each note to the nearest sixteenth according to the tempo set by the user. 2.5 Adapting to the user's tuning MT labels a note by its MIDI number according to its frequency and the current reference frequency. In some applications it is desirable to tie note identification to a particular standard of tuning. In others it is more desirable to adapt to the user's own tuning and tie note identification to musical intervals rather than to any standard. MT is able to do either. In adaptive tuning mode, the system assumes that the user will sing to A-440, but then adjusts by referencing each note to its predecessor. For example, if a user sings three notes, 5990 cents, 5770 cents and 5540 cents above MIDI note 0, the first is labeled C4 (MIDI 60) and the reference is moved cents. The second note is labeled Bb3, which is now referenced to 5790 (rather than 5800) cents, and the reference is lowered a further 20 cents. The third note is labeled Ab3, referenced now to 5570 cents-even though, by the A-440 standard, it is closer to G3. Thus the beginning of Three Blind Mice is transcribed. While constantly changing the reference frequency may seem computationally expensive, it is efficiently implemented as an offset in MIDI note calculation. If tuning is tied to a particular standard, the offset is fixed. To use a fixed A-440 tuning, for example, the offset is fixed at 0. 3. String Matching for Music Retrieval Retrieving music from a collection of musical scores is essentially a matter of matching input strings against a database. This is a familiar problem in information retrieval, and efficient algorithms for finding substrings in a body of text are well known. Tunes that begin with a certain sequence of notes can be found by the standard search techniques of binary search or hashing, while tunes that contain a certain sequence of notes can be found by standard string-matching methods such as the Knuth-Morris-Pratt or Boyer-Moore algorithms, or Rabin-Karp signature matching (Sedgewick, 1988). These algorithms find strings that match the input exactly (or, in the case of binary searching, find the match which is closest in lexicographic order). This is not suitable for matching music based on acoustic input. There are several problems with seeking an exact match between input string and database. The first is the variability in the way that music is performed. Folk songs, for example, appear in many variants (Sundberg and Lindblom, 1976). This applies not only to songs that have been handed down orally from generation to generation, but also to composed songs that have recently entered the folk tradition (Cohen and Cohen, 1973). Popular songs and well-known standards are often performed differently from how they appear in the score (Bauer, 1988). Performances of classical music generally have a more stable relationship to the score. However, there are other sources of error. Problems may be caused by deficiencies in the user's singing efforts-or his or her memory of the tune may be imperfect. Sloboda (1982) reports that people often distort and recombine melodic fragments in complex ways, changing melodic contours, intervals and tonalities; our own studies confirm this. It is necessary, then, to perform approximate string matching on the score database in order to retrieve music. Approximate matching algorithms are, in general, far less efficient than those which match strings exactly, and invariably take time which grows linearly with database size rather than logarithmically as in the case of binary search. 3.1 Search criteria What attributes should be used when searching a musical score database? The first point to note is that melodies are recognizable regardless of what key they are played or sung in-so it is important to allow users to enter notes in any key. This is accomplished simply by conducting the search on the basis of pitch ratios, or musical intervals. Second, a number of experiments have shown that interval direction, independent of interval size, is an important factor in melody recognition (Dowling, 1978)-indeed, Parsons (1975) has produced an index of melodies based entirely on the sequence of interval directions, which is called the "melodic contour" or "pitch profile." Using the notation of Parsons, where * represents the first note, D a descending interval, U an ascending interval, and R a repetition, the beginning of Three Blind Mice is notated: *DDUDDUDRDUDRD One cardinal advantage of searching on contour, at least for casual singers, is that it releases them from having to sing accurate intervals. 3.2 Approximate string matching for musical sequences The problem of approximate string matching was formulated in the early 1970s as a standard application of dynamic programming (Wagner and Fischer, 1974). In general, two strings of discrete symbols are given and the problem is to find an economical sequence of operations that transforms one into the other. The basic operations are deletion of a single symbol, insertion of a single symbol, and substitution of one symbol by another. These three operations have associated numeric "costs" which may be fixed or may depend on the symbols involved: in the case of deletion and insertion the cost might depend on the symbol, while for substitution it might depend on some measure of "distance" between the two symbols. The cost of a sequence of operations is the sum of the costs of the individual operations, and the aim is to find the lowest-cost sequence that accomplishes the desired transformation. The cost of this sequence is a measure of the distance between the strings. Using dynamic programming, the optimal solution can be found in a time which is proportional to the product of the lengths of the sequences. The problem can be augmented by adding new operators such as transposition of adjacent symbols, and the basic dynamic programming solution can be extended quite easily to handle this (Lowrance and Wagner, 1975). The dynamic programming algorithm for matching sequence a against sequence b is given by equation 1 (Sankoff and Kruskal, 1983). length of sequence a length of sequence b is the cost (or weight) of substituting element a i with b j is the cost of inserting a i is the cost of deleting b j d ij is the accumulated distance of the best alignment ending with a i and b j Initial conditions are: The algorithm is usually designed to be symmetric, meaning that matching sequence a with sequence b returns the same result as matching b with a. In order for the algorithm to be symmetric, the cost of an insertion must be equal to the cost of a deletion, and w(a i, b j There is no penalty for substituting an element with itself, i.e. This methodology can be applied to (monophonic) music by regarding a melody as a sequence of notes, each with an associated pitch and rhythm. Rests are dummy notes with only the duration specified. A distance metric between notes can be constructed by defining the distance between two pitches, and between two rhythms, and coming up with a suitable way of combining these components. Deletion and insertion can be handled by transforming a note to a notional zero-length note, and vice versa. Further operations are desirable: the consolidation operator, which combines a sequence of notes into one whose duration is their sum and whose pitch is their average (computed with respect to the distance metric), and the fragmentation operator which does the reverse. Of course, the same effect can be achieved by successive insertions or deletions, along with an appropriate substitution to adjust the rhythm, but in certain circumstances-for example, when the notes all have the same pitch-the consolidation and fragmentation operations involve much smaller costs. This reflects the fact that in these situations, a fragmentation or consolidation makes a less musically significant change to the melody than an equivalent sequence of basic operations. Mongeau and Sankoff (1990) have performed an extensive study of the comparison of musical sequences using this approach. They measure pitch differences in a way that gives consonant intervals like octaves and fifths a smaller distance than dissonant intervals such as seconds and sevenths. Scale degrees so forth) are used to allow melodies in minor keys to be mapped to ones in major keys without excessive penalty. Rhythmic differences are measured by subtracting the lengths of the notes. Mongeau and Sankoff define the distance between notes as a linear combination of the distances between pitches and rhythms; the relative weight of pitch vs. rhythm is determined heuristically by analyzing particular tunes and standard variants. So far, we have discussed how to match one complete melody against another. To locate a fragment in a melody database in prefix-match mode, a sequence of contiguous insertions leading right up to the end of a melody receives zero penalty. 3.3 Searching music databases One consideration in designing a music retrieval system is whether to search only at the beginnings of musical scores, or to search for an occurrence of the input pattern of notes anywhere in the score. Obviously, searching for embedded substrings dramatically increases the complexity of the search. In searching musical databases, the type of music to be retrieved will determine the necessity of searching for embedded patterns. A folk song database, for example, contains mostly strophic songs which people are likely to sing from the beginning. Users will search databases of symphonies and other instrumental compositions, however, by singing a theme from some point in the composition. Searching from the beginning may be acceptable if the user is looking for Beethoven's Fifth Symphony, but will not produce the desired result if the user sings the Ode to Joy theme from his Ninth Symphony, or the theme from Grieg's Piano Concerto in A Minor. Problems also arise with other song databases. Show songs are generally composed with a verse and a chorus, where the chorus is likely to be the familiar part of the song-indeed, few people will even be aware of the verse. Similarly, operatic arias are often preceded by a recitative that is unfamiliar to most people. For these reasons, we believe that a general purpose music retrieval system must have the capability to return songs based on matching embedded strings. Mongeau and Sankoff (1990) suggest "inverting" the dissimilarity score into a "quality" function which is to be maximized. This, however, is a cumbersome method, requiring some interpretation of the quality value. A simpler method is to modify the dynamic programming starting condition so that deletions preceding the match of the pattern are given a score of 0. The only change necessary is to equation 4 (Galil and Park, 1990): 4. Human Performance in Melody Recall Experiments described in the literature focus on people's recognition of well known melodies; these experiments indicate the importance of melodic contour and interval in melody recall (Dowling, 1978). For a music retrieval system, however, we must know not only how people recognize melodies, but also the ways in which people generate them. In order to get some idea of the kind of input we can expect to our music retrieval system, we performed an experiment to find out how people sing well known tunes. 4.1 Method Ten subjects were each asked to sing ten songs from memory. The songs, listed in Table 1, are all well known in the popular culture, and include folk songs, standards, show songs and popular songs (Pokare kare ana is a New Zealand Maori folk song). Subjects represented a wide range of musical background; three had degrees in music and three others had ten or more years of musical training on an instrument. One subject had two years training on piano; the remaining three subjects had little formal musical training. Subjects were invited to practice singing each song in order to refresh their memories and to decide what key to sing in, then the investigator taped the following performance for later analysis. Subjects were not expected to sing songs in their entirety-rather, they were instructed to sing as much as they knew. The focus was on the tunes; subjects were encouraged to sing words or any comfortable syllable, such as la or da. Composed songs were compared against publisher's sheet music to determine accuracy of melodic contour and interval sequences; folk songs (Yankee Doodle and Pokare kare ana) were compared against a well known version chosen as the norm for this experiment. If a subject could not sing a particular song on the list, he or she was asked to substitute a song from an alternate list of five songs. Because few people used the list of alternate songs, the alternates were not analyzed closely. 4.2 Results Table 1 lists the number of people attempting each song. All subjects were able to sing at least one phrase of each song attempted with fewer than three errors in contour. While contour was generally correct, however, repetitions of the same note were very sensitive to subjects' perceptions of the words. In some cases, for example, singers added extra syllables at the same pitch, or left one or more syllables out. Omitted notes were infrequent, but did occur occasionally; in fact, about half the subjects omitted the descending interval at the end of the second and fourth bars of Yankee Doodle. Subjects sometimes added a passing note between notes a third apart-this is a common phenomenon reported by Sloboda (1982). Subjects started at the beginning of all songs except Bridge Over Troubled Water, which seven of nine started at the chorus. Singers were considered to end in key if they finished singing a song within 25 cents (sharp or flat) of the key they started in. Table 1 shows that, in half the songs, subjects were generally able to sing a phrase or more while staying in key. These songs tended to have a narrow range, with predominantly stepwise melodic movement and repetitive melodic patterns. Several songs were particularly difficult. In Yesterday, measures two and three suggest a change of tonality from a major key to the melodic scale of its relative minor three semitones below. Subjects were generally unable to negotiate this change of tonality, with nine of the ten missing the accidentals (added sharps or flats) in measure two. Seven of the nine then continued in a new key, while two returned to the original key. Moon River presents a challenge with the first interval-an ascending fifth (seven semitones) between the first two notes. Four singers missed this interval, with the inaccuracy putting them into a new key. In King of the Road, the problem interval is an augmented fourth (six semitones) between the second and third bars. Summertime exhibits a number of major and minor thirds (four and three semitones, respectively), both ascending and descending, in the first two phrases, with one descending fourth (five semitones) as well. Five of the nine subjects attempting this song were unable to accurately negotiate these intervals, with four of the five landing in a new key following these phrases. In general, intervals greater than two semitones caused problems for singers, and the songs performed most accurately were those with largely stepwise movement. Wide leaps were often "compressed," with subjects singing the top note of an ascending interval flat, or the bottom note of a descending interval sharp; this was particularly noticeable on fifths and sixths (seven to nine semitones). On the other hand, subjects tended to "expand" sequences of smaller intervals-flatting, for example, on a descending sequence of tones and semitones and sharping on ascending stepwise or arpeggiated (three or more consecutive thirds and sequences. Some subjects decorated their performances with anticipations and slides. This was often a stylistic effect, on Summertime and Memories, for example, but happened also on songs that singers knew particularly well-Pokare kare ana, Yankee Doodle, and Puff, the Magic Dragon. Interestingly, subjects' accuracy was more dependent on singing experience rather than on musical training. Three subjects, for example, had random pitch problems throughout their performances. Two of these were instrumentalists with extensive musical backgrounds-one with a degree in music. Subjects who had sung extensively in amateur choirs were the most accurate. This suggests that subjects' performance accuracy depends more on motor training rather than on ability to hear musical differences-which further implies that an acoustic interface for musical subpopulations of users should be as forgiving as one designed for general use. Alternatively, it may be useful to provide a MIDI keyboard for input from musically trained users. 4.3 Discussion The results of the experiment are illuminating in terms of devising a practical matching strategy, indicating the need for an approximate matching algorithm such as the one devised by Mongeau and Sankoff (1990). The tendency of subjects to add or delete syllables calls for fragmentation and consolidation procedures; these procedures will also deal with long slides which are broken into multiple notes by a pitch-based note segmentation mechanism. Missed notes, particularly as exhibited in the three "problem" songs-Yesterday, Moon River, and Summertime-indicate the need for allowing replacement. Insertion and deletion are required in order to handle omitted notes and added passing notes. In most of the cases presented here, subjects started at the beginning of the song. However, on one of the commercial popular songs (Bridge Over Troubled Water), most subjects started at the chorus. The structure of modern popular music, where songs are designed with a memorable "hook" line to capture listeners, means that singers are likely to start at the hook-which often occurs at the beginning of the chorus- rather than at the beginning of a song. As mentioned above, people are also likely to sing show songs from the chorus rather than from the verse. As a preliminary to this experiment, a number of people were asked to sing the first phrase of Maria. Most people started at the beginning of the chorus ("Maria, Maria, I just met a girl named Maria."), but one person, who had recently performed in an amateur production of West Side Story, started at the beginning of the verse ("The most beautiful sound I ever heard. Similarly, while only two people in the experiment sang Jerome Kern's Old Man River (from the alternate list), both started at the chorus ("Old man river.") rather than at the beginning of the song ("Here we all work on the Mississippi. Because singers tend to compress wide intervals and stretch small ones, it is useful for the system to adapt to the user's gradually changing tonality. Abrupt changes in tonality, such as those occurring in subjects' performances of Yesterday, are adequately handled by a replacement operation along with a general strategy of matching intervals rather than absolute notes. Anticipations are notated by our music transcription system, and appear as a modification of rhythm. While it may be possible to use musical knowledge to deal with this in the front transcription module, a more general approach is to accommodate these differences in the matching strategy. It is difficult to know how to handle slides. Because our system determines the pitch of a note by a weighted average of the input frames, a short slide will be incorporated into the target note, but may affect the pitch. A longer slide will be broken into two or more notes; the extra notes generated in this way should either be deleted by the matching algorithm, or grouped together (consolidated) to match one note in the database. While the general approximate matching scheme of Mongeau and Sankoff is well supported by the experiment, there is no indication that match weights should be based on musical consonance rather than absolute distance in semitones. 5. Retrieving Tunes from Folk Song Databases The weaker the matching criteria, the larger the musical fragment that is needed in order to identify a particular song uniquely from a given corpus. To get a feeling for the tradeoffs involved, we performed an extensive simulation based on two corpora of folk songs. The first is the Digital Tradition collection of mostly American folk songs. This contains 1700 songs including a small number of duplicates (14) which were removed. The other is the Essen database of around 8300 melodies, about 6000 of which are German folk songs, 2200 are Chinese, and the remainder are Irish. Nearly 400 duplicates-the same song with a different name, perhaps in a different key-are present, and were removed. Because our music transcription system does not currently display triplets, the approximately 200 songs containing triplets were also removed. Combining the two sources and eliminating the three songs common to both collections gave us a database of 9400 melodies. There are just over half a million notes in the database, with the average length of a melody being 56.8 notes. 5.1 Retrieval experiments We are interested in the number of notes required to identify a melody uniquely under various matching regimes. The dimensions of matching include whether interval or contour is used as the basic pitch metric; whether or not account is taken of rhythm; whether matching is exact or approximate, with the possibility of note deletion, insertion or substitution; and whether attention is paid to note fragmentation and consolidation. Based on these dimensions, we have examined exact matching of: . interval and rhythm; . contour and rhythm; . interval regardless of rhythm; . contour regardless of rhythm; and approximate matching of: . interval and rhythm; . contour and rhythm. For each matching regime we imagine a user singing the beginning of a melody, comprising a certain number of notes, and asking for it to be identified in the database. If it is in the database, how many other melodies that begin this way might be expected? We examined this question by randomly selecting 1000 songs from the database, then matching patterns ranging from 5 to 20 notes against the entire database. This experiment was carried out both for matching the beginnings of songs and for matching sequences of notes embedded within songs. For each sequence of notes, we counted the average number c n of "collisions"-that is, other melodies that match. Fragmentation and consolidation are relevant only when rhythm is used in the match; in these experiments, fragmentation and consolidation were allowed for approximate matching but not for exact matches. 5.2 Results of retrieval experiments Figure 3 shows the expected number of collisions plotted against n, for each of the matching regimes when queries are matched at the beginnings of songs. The number of notes required to reduce the collisions to any given level increases monotonically as the matching criteria weaken. All exact-matching regimes require fewer notes for a given level of identification than all approximate-matching regimes. Within each group the number of notes decreases as more information is used: if rhythm is included, and if interval is used instead of contour. For example, for exact matching with rhythm included, if contour is used instead of interval two more notes are needed to reduce the average number of items retrieved to one. The contribution of rhythm is also illustrated at the top of Figure 3, which shows that, if rhythm is included, the first note disqualifies a large number of songs. It is interesting that melodic contour with rhythm is a more powerful discriminator than interval without rhythm; removing rhythmic information increases the number of notes needed for unique identification by about three if interval is used and about six if contour is used. A similar picture emerges for approximate matching except that the note sequences required are considerably longer. An important consideration is how the sequence lengths required for retrieval scale with the size of the database. Figure 4 shows the results, averaged over 1000 runs, obtained by testing smaller databases extracted at random from the collection. The number of notes required for retrieval seems to scale logarithmically with database size. Figure 5 shows the expected number of collisions for matching embedded note patterns. As expected, all matching methods require more notes than searches conducted on the beginnings of songs. In general, an additional three to five notes are needed to avoid collisions, with approximate matching on contour now requiring, on average, over 20 notes to uniquely identify a given song. 6. A System for Tune Retrieval We have developed a system, based on the melody transcription program described above, for retrieving tunes from the combined Essen and Digital Tradition folk song database. The user starts singing on any note, and the input is notated in the key that yields the fewest accidentals. Transcription operates in adaptive mode, adjusting to the user's gradually changing tuning. The user is able to retrieve folk tunes using an exact match of pitch, pitch and rhythm, melodic contour or contour and rhythm, or an approximate match of pitch and rhythm or contour and rhythm. The system allows the choice of matching from the beginnings of songs or searching for themes within songs. Approximate searching incorporates fragmentation and consolidation, as described by Mongeau and Sankoff (1990), and all retrievals are ranked- exact retrieval simply means that only tunes that match with the maximum possible score are retrieved. Our dynamic programming match algorithm is a minimization technique, with the perfect score being zero. In order to provide a more intuitive score for users, the dynamic programming score of each song is subtracted from 1000, with a lower limit of 0, so scores can range from 0 to 1000. Songs are ranked by score; songs with equal scores are listed alphabetically by title. Figure 6 shows the tune retrieval screen following a search. The names and corresponding scores of retrieved melodies are displayed in a text window and the tune of the best match is displayed in a melody window. The user may select other melodies from the list for display. The figure displays the best match, The Ash Grove, following an approximate search on pitch and rhythm. In this instance, the search returned 22 songs. The number of collisions for approximate matches can be controlled using a variable retrieval threshold; the search illustrated in Figure 6 returned songs with a score of 950 or better. Table 2 shows the number of songs retrieved, using the input pattern from Figure 6, for the various matching methods. Most matching schemes return a manageable number of songs, although, if the input string is allowed to occur anywhere in the song, approximate contour and rhythm returned over a third of the database; matching exact contour did not do a great deal better. These results clearly indicate that a longer query pattern is needed for matching exact contour or contour and rhythm. On the PowerPC 8500, with a clock speed of 120 MHz, pitch tracking and display of 10 seconds of audio input takes less than half a second (the input for Figure 6 was processed in ms). Our system currently uses approximate algorithms for all matches, with exact retrieval simply returning only songs with a perfect score, but we project exact searches using a fast string matching algorithm, such as Boyer-Moore (Sedgewick, 1988), to complete in one second or less. Approximate matching takes much more time. Retrieval based on the seven note sequence in Figure 6, for example, takes 10.9 seconds; searching for embedded themes takes 19.1 seconds. If fragmentation and consolidation are disallowed, matching from the beginning takes 10.4 seconds, while searching for themes takes 17.5 seconds. While this may be a reasonable time to ask users to wait for a retrieval, much larger databases-a million folk songs, for example, or a thousand symphonies-might take an unacceptably long time to search. The time taken for matching increases linearly with the size of the database (we assume search patterns sung by users will be approximately the same length regardless of the size of the database). There are approxmimate string matching algorithms that have the potential to speed up approximate searches (Wu and Manber, 1992). We feel it is necessary for any such algorithm to provide comparable retrieval performance to the Mongeau and Sankoff algorithm; the results of our human performance experiments will be useful in specifying how those algorithms might operate. One way of speeding retrieval based on embedded patterns is to automatically identify themes using an offline matching method, storing those themes in a separate collection indexed to the original database. Because themes are relatively short (in comparison to an entire composition), the theme database can be searched much more quickly; furthermore, it is unnecessary to search for embedded patterns in a database containing only themes. 6. Conclusion We have presented and analyzed methods for accessing an online musical score database using microphone input. Searching such a database requires efficient string matching algorithms. Previous experiments that test melody recognition suggest that search should be carried out on the basis of melodic contour and/or musical intervals. The results of a new experiment testing people's accuracy in singing well known melodies suggests that there should be provision for approximate matching of the input, and that the music transcription module of the interface should adapt to the user's musical tuning, which may vary during input. Analysis of two folk song databases provides some idea of the number of notes needed to perform a useful retrieval under various matching regimes. For a database of ten thousand songs, four to six notes are usually enough for exact retrieval if rhythm is included in the match. If rhythm is not included, one or two more notes are needed. Approximate search, in general, requires twelve notes or more to keep the number of retrieved songs manageable. For all search methods, several more notes are needed if the query pattern is allowed to occur anywhere in the song. We have implemented a prototype tune retrieval system which accepts input from a user singing into a microphone, transcribes the input into musical notation, and retrieves songs from a database of 9400 folk tunes. The system supports both exact and approximate searches based on either pitch or melodic contour; rhythm is optional for exact searches. Approximate searches perform relevance ranking on retrieved tunes, with scores ranging from 0 to 1000. We have some concern over the time taken to perform approximate matches in large databases of musical scores. We are investigating two ways of speeding these searches. One approach is to use a fast approximate search method (Wu and Manber, 1992), suitably guided by knowledge of the errors people make in singing well known melodies. Another possibility is to automatically create, offline, databases of themes which allow fast indexing into the main database. It may be possible, for example, to use the Mongeau and Sankoff algorithm to find recurring themes in symphonies or popular songs; these themes can then be stored in a separate, and much smaller, database. To this point, our investigations have focused on retrieval of musical scores-we have not yet considered retrieval of audio files and recordings. While it may someday be feasible to directly match acoustic input against digital audio files, it is likely that the musical score will be an intermediary representation for some time to come. We envision a system where the user might whistle the theme to Grieg's Piano Concerto in A Minor; this input is then matched to a database of musical scores, and the corresponding recording is returned to the user's terminal. The acoustic interface would then be just one aspect of a multimedia system such as that described by Loeb (1992). We believe that acoustic interfaces to online music databases will form an integral part of the digital music library of the future. --R The Acoustical Foundations of Music. "An extensible optical music recognition system." th Australasian Computer Science Conf. The new Real Book. "Maximum likelihood alignment of DNA sequences." Automatic recognition of printed music in the context of electronic publishing. "Tune evolution as an indicator of traditional musical norms." "Octave generalization and tune recognition." "Scale and contour: Two components of a theory of memory for melodies." "An improved algorithm for approximate string matching." "Query by humming." "Parallel processing techniques for estimating pitch periods of speech in the time domain." Guide to the Library of Congress. Pitch Determination of Speech Signals. "The personal orchestra." "Architecting personalized delivery of multimedia information." "An extension of the string-to-string correction problem." "Signal processing for melody transcription." "Comparison of musical sequences." The Directory of Tunes and Musical Themes. Time Warps "Optical recognition of music notation: a survey of current work." "Music performance." "METEOR: A constraint-based FIR filter design program." "Generative theories in language and music descriptions." "The string-to-string correction problem." "Comparative study of nonlinear warping techniques in isolated word speech recognition systems." Figure 5. Figure 6. Figure 2. Average number of notes Size of database required to return one song Figure 4. "in --TR --CTR Erdem Unal , Shrikanth Narayanan , Elaine Chew , Panayiotis G. Georgiou , Nathan Dahlin, A dictionary based approach for robust and syllable-independent audio input transcription for query by humming systems, Proceedings of the 1st ACM workshop on Audio and music computing multimedia, October 27-27, 2006, Santa Barbara, California, USA Richard A. Medina , Lloyd A. Smith , Deborah R. Wagner, Content-based indexing of musical scores, Proceedings of the 3rd ACM/IEEE-CS joint conference on Digital libraries, May 27-31, 2003, Houston, Texas Erdem Unal , Shrikanth S. Narayanan , Elaine Chew, A statistical approach to retrieval under user-dependent uncertainty in query-by-humming systems, Proceedings of the 6th ACM SIGMM international workshop on Multimedia information retrieval, October 15-16, 2004, New York, NY, USA Erdem Unal , S. S. Narayanan , H. H. Shih , Elaine Chew , C. C. Jay Kuo, Creating data resources for designing user-centric frontends for query by humming systems, Proceedings of the 5th ACM SIGMM international workshop on Multimedia information retrieval, November 07-07, 2003, Berkeley, California Maureen Mellody , Mark A. Bartsch , Gregory H. Wakefield, Analysis of Vowels in Sung Queries for a Music Information Retrieval System, Journal of Intelligent Information Systems, v.21 n.1, p.35-52, July Jia-Lien Hsu , Arbee L. P. Chen , Hung-Chen Chen , Ning-Han Liu, The effectiveness study of various music information retrieval approaches, Proceedings of the eleventh international conference on Information and knowledge management, November 04-09, 2002, McLean, Virginia, USA Jyh-Shing Roger Jang , Hong-Ru Lee , Jiang-Chuen Chen , Cheng-Yuan Lin, Research and developments of a multi-modal MIR engine for commercial applications in East Asia, Journal of the American Society for Information Science and Technology, v.55 n.12, p.1067-1076, October 2004
acoustic interfaces;relevance ranking;melody recall;music retrieval
597143
QoS Management in Educational Digital Library Environments.
Advances in multimedia computing technologies offer new approaches to the support of computer-assisted education and training within many application domains. Novel interactive presentation tools can be built to enhance traditional teaching methods with more active learning. Since a variety of user expectations are possible in such an environment, research must address the incorporation of these factors into presentation tools. During an interactive learning/training process, presentation tools must be able to handle various types of delays. A flexibly adjustable quality of service (QoS) should thus be supported. In this paper, we investigate a framework and systematic strategies for supporting the continuous and synchronized retrieval and presentation of multimedia data streams in a client/server distributed multimedia environment for educational digital libraries. Specifically, we establish a practical framework for specifying multimedia objects, tasks, schedules, and synchronization constraints between media streams. We identify the QoS parameters critical to the support of multimedia presentations for learning and training activities. Based on the proposed framework and QoS specifications, we develop presentation scheduling and buffer management strategies which can enforce the specified QoS requirements in an educational digital library environment.
Introduction Currently available computer hardware and devices can support the processing of data in various media, including video, audio, animation, and still images. Many multimedia standards for software and hardware are already in place for uniform handling of multimedia data. These technologies have made it possible to deliver graphs, voice, images, and diagrams through computers. Substantial research has been directed toward the support of multimedia data processing within operating systems and network architectures [RV93, Ste90, AH91, RRK93, GR93, ZF93]. Recently, research involving multimedia data management in database systems has also been highly active [TK95, MKK95, CGS95, GZ96, ZM96]. Through these research activities, new behavioral concepts required for multimedia data have been identified and mechanisms have been proposed to enhance conventional data processing, storage, synchronization, and communication mechanisms. Using these mechanisms, audio, video, and image objects are supported through which multimedia streams can be segmented into pieces and then stored in the multimedia database. In this way, audio, video, and image data stored in the database can be flexibly retrieved and presented to users. These advances in multimedia data technologies have led to the possibility of developing multi-media presentation tools in many application domains. For educational digital library applications, books can be electronically captured for user to have on-line access to the full collection. Image, audio, and video materials can be electronically stored, and their content can be extracted and indexed. Users can navigate and browse through a large collection of multimedia education materials and identify the relevant materials. In addition, to enhance traditional learning methods, interactive learning tools can be built to support on-line access to education/training materials. The interactive learning tools can include a materials-review and problem-exercise tool and a set of question-answering tools. Through the proposed learning tools, users can conveniently review both lecture (or tutorial) and supplementary materials. A user can also practice skills through interactive problem-solving and question-answering. In order to support these novel features in an educational digital library environment, special requirements on synchronization, buffer management, and human interaction must be addressed. To re-present the original data streams to users from media object bases, synchronization constraints among media objects must be specified and maintained. Such synchronization is usually termed intra-stream synchronization. An additional complication arises with the timing relationships that may exist among the different types of media data streams. In educational digital library applications, such as recording and playback of lecturing video and audio, slide presentations, and distance learning, require the synchronized display of multiple media data streams. As such media data streams may not be merged prior to storage in databases, the synchronization of multiple media data streams, termed inter-stream synchronization, becomes an essential prerequisite to successful multimedia presentation applications [LG90b, LG90a]. Buffer management within the multimedia presentation system is essential to ensure the maintenance of the intra- and inter-stream synchronization requirements of multimedia data presentations. To facilitate a hiccup-free presentation, we must ensure that an object is present in memory before it is displayed. If the loading rate of a media stream from disk to memory is less than the delivery rate of the media stream, preloading of the stream prior to delivery would be necessary to ensure continuous presentation. If multiple media streams are synchronously presented, the buffer space must be sufficient to simultaneously hold all these streams. Furthermore, an appropriate allocation and replacement strategy must be provided to anticipate the demands of delays and user interactions. Such a strategy must minimize the response time of multimedia presentations while guaranteeing that all continuity and synchronization requirements are satisfied. Thus, the central issues in this context involve the provision of efficient preloading and replacement mechanisms for caching media objects. These mechanisms are intended to ensure that the defined continuity and synchrony of media streams will be preserved to the greatest extent possible, even if there are user interactions and loading delays. Along with synchronization and buffer management, there are also important human interaction factors which are particular to education/training applications. These factors define specific requirements that must be considered in building the learning tools. In particular, the learning tools must be able to handle various types of delays and to support user interactions such as skip, pause, and fast forward/backward in a manner that is acceptable to on-line users. To effectively and efficiently support these functions, a flexibly adjustable quality of service (QoS) [LG90a] must be supported. Since these specific needs may be different from those of other multimedia applications, tools that integrate these particular QoS parameters must be developed. In this paper, we present an innovative on-line learning environment for education and training applications. We investigate a framework and systematic strategies for supporting the continuous and synchronized retrieval and presentation of multimedia data streams in a client/server distributed multimedia environment for educational digital libraries. Specifically, we establish a practical framework for specifying multimedia objects, tasks, schedules, and synchronization constraints between different media streams. We identify the QoS parameters critical to the support of multimedia presentations for learning and training activities. Based on the proposed framework and QoS specifications, we develop presentation scheduling and buffer management strategies which can enforce the specified QoS requirements in an educational digital library environment. The remainder of this paper is organized as follows. Section 2 introduces the client-server distributed multimedia architecture for educational digital library environments. In Section 3, we introduce a framework to specify multimedia data, task, and synchronization constraints. In Section 4, we discuss QoS parameters and introduce the correctness criteria to preserve the quality of media presentations. Section 5 presents the scheduling principles and algorithms to ensure the synchronous presentation of media streams in the event of delays. Section 6 discuss buffer management strategies. Section 7 sets forth our experimental results. Concluding remarks are offered in Section 8. System Architecture The system architecture under consideration is illustrated in Figure 1. This architecture includes a distributed multimedia database management system (multimedia server), a set of multimedia databases, and a set of clients which access the server. The multimedia database management system is distributedly superimposed on top of a set of database management systems (DBMSs) and file systems. As certain media streams may be represented and stored in different formats, the underlying DBMSs or file systems can be heterogeneous. The main function of each client at a workstation is to display multiple media data to the user in the specified format. Such an architecture can provide adequate database support for multimedia applications demanding script-based interactive multimedia presentations [TK95]. A client-server model wherein the client performs the playout management locally is an ideal candidate for implementing the playout management service. The integration of the multimedia playout management and database systems make it possible to efficient interplay between playout management components and database management system components. Media DB DBMS Media DB DBMS Client 1 Client 2 Client n Network Server Server Server Media DB DBMS Figure 1: System architecture As shown in Figure 1, the distributed multimedia database management system server contains two main modules: a multimedia task language (MTL) interpreter and a media manager (MM). The multimedia task language MTL interpreter allows users to specify a set of tasks associated with a multimedia task, including intra- and inter-synchronization requirements on component tasks. A multimedia task specified in MTL is then processed by the interpreter, and data accesses are sent to both the MM and the underlying DBMS or file system for processing. The MM component at each server site supports the multi-user aspect of media data caching and scheduling. It maintains real-time retrieval of media data from the multimedia database and transfer the data to the client sites through network. The MM at a client site ensures that media data stored in the multimedia database will be available on demand in the local buffer and the synchronous presentation of multiple media streams. 3 Data and Synchronization Models In this section, we introduce the data and synchronization specification models that will be used in the rest of the paper. 3.1 Objects A media stream can be viewed abstractly at several levels. At the lowest level, a media stream is viewed as an unstructured BLOB (binary large objects) into several higher-level object classes. Objects from different media streams may also be spatio-temporally combined into multimedia objects. Several conceptual data models which follow this general scheme have been proposed. However, few efforts have been made to formalize a multimedia data model at the task management level for the purpose of scheduling media data operations. In the proposed data model, we assume that each media stream is broken into a set of atomic objects. Higher levels of object classification need not to be considered in this context. Each atomic object represents a minimum chunk of the media stream that bears some semantic meaning. Atomic objects in different media streams may have different internal structures. For example, a continuous video stream can be segmented into a set of atomic objects, each of which contains a set of video frames with specific semantic meaning. Similarly, a continuous audio stream can be segmented into a set of atomic objects, each of which contains a set of audio samples with specific semantic meaning. The atomic objects within a media stream are linked together through intra-synchronization time constraints. These constraints may specify discrete, continuous, overlapping, or step-wise constant time flow relationships among the atomic objects. For example, some multimedia streams, such as audio and video, are continuous in nature, in that they flow across time; other data streams, such as slide presentations and animation, have discrete, overlapping, or step-wise time constraints. It may, for example, be necessary to display two distinct slide objects jointly within a single slide presentation stream. In general, the temporal relationship between two atomic objects in a single stream may conform to any of the thirteen temporal relationships described in [All83]. In our representation, each atomic object is associated with a relative start time and a time interval which specifies the duration of its retrieval, with the initial atomic objects in the media stream assumed to start at time zero. The actual start time of a media object is usually dynamically determined. Once a media stream is invoked, it is associated with an actual start time; each media object within that stream will similarly be associated with an actual start time. We use ! o; t; 4t ? to denote that object o is to be delivered at time t and will last time period 4t. 3.2 Multimedia Tasks Media objects from different data streams may need to be linked through time constraints to specify their synchronization; such time constraints are termed inter-synchronization requirements. For example, in slide presentation applications, an audio object must be played along with a slide object. The temporal relationship between two atomic objects from different media streams may also conform to any of the thirteen temporal relationships described in [All83]. Inter-synchronization requirements may be specified as meta-data or specified in task programs. In some cases, the relative time and time interval associated with an atomic object may need to be adjusted to conform with these inter-synchronization requirements. We will now discuss the proposed multimedia task model. Since our primary concern with multimedia data involves retrieval rather than update, our model will consider only delivery operations of atomic objects. We shall now introduce the concept of a task. For the elements of a task, we assume the availability of three basic operations: start(t), end(t), and deliver(o; t), where start(t) and end(t) are beginning and termination operations at a relative time t, and deliver(o; t) is a delivery operation of object o at relative time t. A task is then defined as a partial order of start, end, and delivery operations which contain exactly one start operation that is the minimum (first) element in the partial order, one end operation that is the maximum (last) element in the partial order, and all delivery operations executed on a given data stream. A multimedia task consists of a set of tasks upon which synchronization constraints are specified on the delivery operations to enforce both intra- and inter-synchronization requirements. We define a schedule to be the execution of multimedia tasks. We define a synchronization point to be a point held in common by delivery operations from all participating tasks within a single multimedia task needing to be synchronized. A scheduler must ensure the correct execution of multimedia tasks. A schedule of a multimedia task may differ from the multimedia task because the dynamic time constraints of the former differ from the static relative time assignments of the latter. Additionally, the tolerance parameters given for a schedule will permit further deviations from the multimedia task. 3.3 Synchronization Specification we propose an approach to the specification of synchronization constraints among the component tasks of a multimedia task. As indicated above, both data and task operations are associated with time constraints. Synchronization constraints may also exist among the component tasks of a multimedia task. Since synchronization constraints are implicitly imposed by the specification of time constraints, the maintenance of the latter would ideally guarantee the maintenance of the former. 1. 2. 3. 4. 5. 6. 7. A A A A A A A Figure 2: Typical temporal relationships. However, while the scheduler should make every effort to enforce the time constraints defined on task operations, even minor delays may create great difficulties in scheduling. Experimental experience demonstrates that such delays are frequent. Thus, the explicit specification and enforcement of synchronization constraints is necessary. Synchronization dependencies among the delivery operations in a multimedia task are dynamically generated on the basis of the intra- and inter-synchronization constraints placed on the media streams. Such dependencies are intended to facilitate scheduling by efficiently describing the synchronization constraints existing among the tasks of each multimedia task. Let a multimedia task be defined as a set of tasks which represent the synchronized presentation of media streams Each media stream consists of a set of objects and each object is specified as loss of generality, we assume that the synchronization constraints are implied in the definition of time constraints on objects. The synchronization relationship between any two objects in either a single media stream or two media streams follows the thirteen temporal relationships outlined in [All83]; these are given in Figure 2. Inverse relationships are not listed in the figure. In general, these synchronization relationships can be easily generalized to the synchronization relationships among n media objects Three relationships, namely before, after, and equal, are used to define the temporal ordering of one object with respect to another. The temporal relationships between two objects are categorized as: (1) is said to start before is said to start after is said to start equal to is said to end before said to end after is said to end equal to We say that two objects starts before a single media stream are neighboring each other if there is no object We introduce three types of synchronization points within media streams, as follows: has an intra-synchronization point there exist two neighboring objects ! that s +4t, where has an inter-synchronization point there exists an object o 1i in m 1 and another media object ! (may or may not be in m 1 ) such that starts equal to o jk or ends equal to o jk . has a middle-synchronization point p 1 if there exists another media object ! or may not be in The synchronization relationships given in Figure 2 can be categorized into three classes, according to their synchronization points: cases 1 and 2 have intra-synchronization points; cases 5, 6, and 7 have inter-synchronization points; and cases 3, 4, 5, and 6 have middle-synchronization points. We define the granularity of a media object to be the size of the object and the granularity of the synchronization between a set of media streams to be the number of synchronization points that must be identified. Clearly, the finer the object granularity, the more synchronization points will need to be identified. Thus, the design of a higher-level data model for the decomposition of media objects determines the minimum granularity of the synchronization between the media streams. However, at the level of multimedia task management, the granularity of the synchronization can be defined more finely. At this level, additional synchronization points can be defined in the midst of objects to permit finer synchronization control among media streams. As the decomposition of media objects is not the main concern of this paper, this subject will not be discussed further at this point. Quality-of-service Requirements and Correctness Criteria In this section, we will first discuss QoS parameters and the effect of these parameters in the scheduling of multimedia presentations. We will then define correctness criteria for the executions of multimedia tasks. As illustrated below, QoS parameters must be considered in the definitions of these correctness criteria. The scheduling of multimedia tasks includes the scheduling of time-dependent delivery oper- ations, synchronized delivery enforcement among multiple media streams in a multimedia task, concurrent execution of multimedia tasks, and delivery delay recovery. A correctness criterion in this context must verify that delivery operations are performed according to a predefined synchronization pace and within the time constraints imposed on tasks. Since the correctness of time-based presentations depends on the accuracy of timing that must be maintained on media streams, the execution result of a multimedia task is a question of quality rather than consistency. We must thus formulate new correctness criteria for the executions of multimedia tasks which define acceptable quality in real-time. Several important QoS parameters must be considered in these correctness criteria. Little and Ghafoor [LG90a] have proposed several parameters to measure the QoS for multimedia data presentation. The following parameters have been listed: (1) average delay, (2) speed ratio, (3) utilization, (4) jitter, and (5) skew. The average delay is the average presentation delay of each object in a time interval. The speed ratio is the actual presentation rate to the nominal presentation rate. The utilization equals the actual presentation rate to the available delivery rate of a set of objects. Ideally, both the speed and utilization ratios should equal 1. During the presentation of a video stream, frame duplication leads to utilization values greater than 1, while dropping frames would lead to values less than 1. The jitter is the instantaneous difference between two synchronized streams. The skew is the average difference in presentation times between two synchronized objects over n synchronization points. Clearly, average delay, speed ratio, and utilization are used to measure the quality of individual media stream presentations, whereas jitter and skew are used to measure the quality of presentation among multiple media streams. While the delivery of each media stream would ideally minimize the average delay and maintain the parameters of speed ratio and utilization to be close to 1, the achievement of these three goals is actually in conflict. There must therefore be trade-offs between these goals during scheduling. Consider a synchronous presentation of audio and video streams. If the scheduler attempts to minimize the average delay of audio objects, it must then, in case that an audio object is delayed, drop some video frames in the corresponding video object to maintain synchronization between the two objects. If the scheduler tries to maintain the utilization of video objects close to 1 when delays occur, it must decrease the speed ratio of these objects and, consequently, increase the average delay. Thus, it is generally impossible for all parameters to achieve an ideal state for all applications. There must be trade-offs among different QoS parameters. Multimedia presentations in the domain of education or training are normally instruction- oriented. Such presentations should usually last two to three hours. The media streams involved in a single presentation may include a combination of audio and slides, or a combination of audio and video as well as text. Preserving synchronization requirements on such presentations must be the top priority in defining QoS services. Distortion between synchronized media objects may result in misunderstanding of the teaching materials. Figure 3 demonstrates an experimental example of the presentation of audio and video streams. Table 1 provides the measurement of average delay, jitter, and skew. In this experiment, synchronization constraints are implicitly imposed by the specification of time constraints on media objects. As the synchronization points are not explicitly enforced in the presentation, delays occurred in the individual objects resulted in mismatches among the displayed media objects from different streams. High values in jitter and skew are reported in the table. Such mismatches may cause confusion in understanding the materials.1 (a) (b) Time Audio Figure 3: Presentation of audio and video streams : (a) nominal, (b) actual presentation Parameter Average Delay 1.0 - 0.75 - 1.75 - 2.50 - 2.50 - Skew 2.0 - 1.5 - 2.5 - 4.5 - 5.0 - Jitter - 2.0 - 2.0 - 4.0 - 5.0 - 5.0 Table 1: Parameter values for presentation without synchronization Thus, our primary goal on formulating acceptable QoS parameters should be to avoid any deviations from the synchronization constraints associated with the media streams. We assume that maximum allowable delays for individual media streams are pre-specified. These measures provide the permissible ranges for average delay and speed ratio. In addition, we assume that maximum allowable skips for individual media streams are also pre-specified. These measures provide the permissible ranges for utilization. Upon these measures, we require that the presentation tools will minimize the possibility of jitter and skew. We will now define a correctness criterion for the execution of a multimedia task and then identify those schedules to be considered to be correct. As with conventional database query executions, the semantics of a multimedia task determine the correctness of its execution. Unlike conventional database query executions, however, the time constraints defined within multimedia tasks assume a position of prime importance. We thus introduce the following semantic correctness criterion: Definition 4 (Correct execution) The execution of a multimedia task T is correct if the time constraints specified within T are preserved. This semantic correctness criterion is theoretically applicable to the executions of multimedia tasks. However, in a practical, delay-prone system, this criterion cannot be applied directly by the scheduler to enforce the execution of multimedia tasks. Given the pervasive nature of delays, a strict application of this rule would result in the aborting of the vast majority of multimedia tasks. A more realistic scheduling criterion is therefore needed. We introduce the concept of acceptable schedules by incorporating the effect of delays into the definition of schedules. Definition 5 (Acceptable execution) The execution of a multimedia task is acceptable if and only if all delays occurring at the defined synchronization points are within the permissible QoS ranges. Note that the scheduler at a client site need not consider the concurrent execution of multiple multimedia tasks. It must control the presentation of multiple media streams to a single user. There is need to have a central scheduler to manage the real-time executions of all multimedia tasks at the server site. This paper will primarily focus on the schedulers at client sites. 5 QoS Guaranteed Presentation Scheduling In this section, we will investigate the principles guiding the scheduling of the delivery of multiple media data streams at each client site. We shall assume that the given transmission and the server provide sufficient support for delivering media objects. A framework will be developed to permit efficient synchronization of multimedia presentations which incorporates the effects of QoS requirements. 5.1 Basic Scheduling Strategy We assume that there is a permissible delay constraint that defines the maximum tolerable delay for each media stream participating the execution of multimedia task T . Thus, as long as the delay of the presentation of each stream is within the permissible delay range, we consider the presentation is acceptable. We now present a basic scheduling strategy that minimizes the possibility of jitter and skew. In this context, the threefold categorization of synchronization points summarizes the most critical scheduling information. Additional synchronization points could be specified between these synchronization points within the shared intervals. While a finer granularity of stream synchronization improves the synchronization of media stream presentation, it also increases the control-related scheduling overhead. Thus, there is a trade-off between the quality of the presentation and the system overhead. We associate each media object with two events: a START event, denoted by , and an END event, denoted by e . All START and END events are then classified into layered GROUPs based on the time constraints pertaining to the events. The lowest-layer GROUP 1 contains all START events which are the events at the starting time of the entire presentation, and the highest-layer GROUP n contains all END events which are the events at the ending time of the presentation. All events occurring at a given time belong to the same GROUP. Thus, each GROUP contains all START and END events that must be simultaneously executed. Within each GROUP, all the END events and the START events are related by the before relationship. Events between two consecutive groups are related by the after relationship. At each middle-synchronization point, the object ij to which there are other objects that start or end in the middle will be split by assigning a START and an END event at the middle- synchronization point. The following example demonstrates an application which uses the specification described above. Example 1 Consider an application involving on-line computer-assisted learning in undergraduate education. Without loss of generality, we assume that there are two media streams, audio and slides (or video), in each multimedia task. Intra-synchronization within the slide stream may require that two objects either overlap or be sequentialized. Intra-synchronization within the audio stream requires only that objects be sequentialized. Additional inter-synchronization requirements between the two media streams are specified among slides and audio objects. These requirements between the slides and audio objects follow the thirteen temporal relationships outlined in [All83]. Let a multimedia task contain two tasks, one of which accesses the slide stream and the other the audio stream. In order to successfully deliver both streams to a student, the system must ensure that all time constraints placed on the individual delivery operations and the synchronization between slides and audio objects are preserved. Let a particular application is given in Figure 4. In this application, a set of layered GROUPs, denoted GROUP 1 ,., GROUP 7 , are identified. We will now discuss the generation of acceptable schedules. Following Definitions 1, 2, and 3, at each intra-synchronization point, there exist an END event and a START event; at each inter- synchronization point, there is one START event; at each middle-synchronization point, there may exist either one START event or an END event and a START event. Synchronization points of all three types can coexist at a given synchronization point; in such a case, the synchronization point must be ensured to be both continuous and synchronous with other specified synchronization points in different media streams. The scheduler ensures that only synchronous schedules will be generated by controlling the invocation order of events in the formulated layered GROUPs of each multimedia task. Let a Time GROUP2 GROUP3 GROUP4 GROUP5 slides audio o22 o23 GROUP6 GROUP7 Figure 4: Layered GROUPs. multimedia task T have n layered GROUPs. Assuming no distortion, the basic invocation policy for the execution of T is as follows: assume that all START events in GROUP 1 have been invoked. (1) The events in GROUP i\Gamma1 always have a higher invocation priority than those in GROUP i , for any i such that (2) All START events in a GROUP i (1 - i - n) are invoked simultaneously. (3) All END events in a GROUP i (1 - i - n) are terminated simultaneously. events in a GROUP i (1 - i - n) can only be invoked after all END events in the same GROUP have terminated. Items (1) and (4) ensure the intra- and middle-synchronization points specified in T , while items (2) and (3) ensure the inter- and middle-synchronization points specified in T . The effects of a variety of delays, including network delays and storage delays, are not considered in the above policy. As was noted earlier, such effects must be incorporated into the scheduling policy to generate acceptable schedules. In the above basic scheduling strategy, we incorporate the effect of delays into the scheduling policy by propagating delays into the invocation of successive delivery operations. Thus, if a delivery operation is delayed, then the END event in the corresponding GROUP will be delayed and, consequently, all END and START events in the same GROUP will be delayed. By propagation, all the ensuing delivery operations and events in the higher-layer GROUPs will be delayed. A full consideration of delay recovery will be presented in the next section. We assume that each media stream has a permissible delay constraint and the minimum value of all permissible delay constraints given in the media streams defines the maximum tolerable delay for the multimedia task. If a larger delay occurs, then timeout will be used by scheduler. If the scheduler finds that it has been waiting too long for the completion of a delivery operation, then it aborts the execution of the multimedia task. Clearly, the basic scheduling strategy enforces all defined synchronization points by controlling the invocation of START events. Both jitter and skew are thus minimized. As delays are propa- gated, no data are lost in presentations, utilization is equal to one. In addition, timeout is used in case a delivery operation is delayed beyond the permittable delay. Thus, this approach generates only acceptable schedules. 5.2 Scheduling with Delay Recovery In Section 5.1, a basic solution was presented in which delays are simply propagated to the ensuing delivery operations. We will now systematically investigate a novel and more effective delay recovery approach. Our discussion of delay recovery will consider not only the constraints of synchronization but also the parameters of average delay, speed ratio, and utilization. The proposed basic scheduling strategy guarantees that no temporal deviation will occur within the simultaneous presentation at synchronization points. Since delays that may occur between these synchronization points are not considered, such a synchronous execution may actually fail to preserve the time constraints defined on the delivery operations within tasks. There may therefore be a temporal deviation between the delivery operations of different tasks during these intervals. However, any asynchronization caused by delays will be recovered at the next synchronization point. Thus, a synchronous execution of a multimedia task may allow enormous delays between the delivery operations of different tasks during some intervals. We shall now investigate the principles involved in the scheduling of multimedia tasks with delay recovery. A framework will be developed to permit efficient resynchronization of the presentation of multiple media streams in the event of delays. Let two parameters, maximum delay, denoted 4d max i , and maximum skip, denoted 4s max be specified for each media stream m i . These two parameters provide users with flexibility in achieving the above goals. If maintenance of good utilization is of highest interest in a particular instance, then the amount that can be skipped should be specified as a relatively small figure. If it is more important to minimize the average delays, then the delay allowed for the media stream should be set at a relatively low level. In our context, users may have different expectations for various presentations of learning materials. Thus, the choices of QoS parameters may vary in different stream presentations. Within the given QoS parameters, our approach will maximize utilization and minimize the abortion rate of multimedia tasks in order to preserve the quality of the presentations. Consider a synchronous presentation of media streams and a set of media objects from these streams are currently synchronously delivered. Let 4d i (1 - i - n) denote the delay that is occurred in the object belonging to m i . We may have the following situations for these media objects: i for all integer i in the range 1 (2) For all n g) and there exists some 4d i n) such that 4s max (3) There exists some 4d i (1 - i - n) such that 4d In case (1), synchronous presentation can be restored by simply skipping by the interval by which the delayed media streams lag behind. In case (2), since there exists some media object such that its delay is larger than its permittable skip, simply skipping the delayed objects may not be applicable. However, this difficulty can be circumvented by a compromise between skipping and pausing. Similar to the situation discussed in Section 5.1, we assume that the timeout period is the minimum value of all permittable delay constraints given in the media streams belonging to the multimedia task. Within the permittable timeout period, we calculate the maximum difference between the delay and the allowable skip for delayed objects: If the amount of PAUSE is less than the permittable timeout period, then the period of PAUSE will be paused in order for those delayed operations to catch up for the maximum possible period. After this PAUSE period, if there exists some unfinished operation, then it must be within its permittable skip period. Therefore, such an operation can be skipped. Thus, in case of delays during the execution of GROUP i\Gamma1 , the following rule is added to the basic invocation policy given in Section 5.1: (4) Pause the START events in GROUP i for a period defined in (a) before invocation. In case (3), the execution of the multimedia task must be aborted. The detailed algorithm of this approach is offered in Algorithm 1. Note that the calculation of WAIT in Algorithm 1 is slightly different from PAUSE, since the first completed END event might be delayed and this delay effect must be added to WAIT while performing tolerance check. Similar to the basic scheduling strategy, the scheduling with delay recovery enforces all defined synchronization points by controlling the invocation of START events. Both jitter and skew are minimized. However, delays are recovered instead of propagated. Thus, utilization may not be equal to one, but within the permissible QoS range. Thus, this approach also generates only acceptable schedules. 6 QoS Guaranteed Buffer Management In this section, we will present a framework which generates the required start times for media objects. This framework guarantees the continuity of media stream presentation while minimizing buffer utilization at both client and server sites. Furthermore, an appropriate allocation and replacement strategy must be provided to anticipate the demands of delays and user interactions. 6.1 Start Times of Media Streams Buffer management is needed in both client and server sites to ensure that the loading of media objects will not cause the delay of their presentation. At the client sites, to facilitate a hiccup-free presentation, we must ensure that an object is present in local memory before it is delivered. At the server sites, we must ensure that once a media stream is started to be retrieved and transmitted, this retrieval and transmission will be performed in a desirable rate. Normally, the loading of a media stream from disk to memory is much faster than the display of the media stream. However, both network and storage delays must be considered in determining the preloading time of a media stream. We first consider the situation of the entire stream. Let t m l s be the time at which the loading of media stream m begins and loading function Lm (t; t m l s ) be the total number of media objects of m read at time t. Let t m cs be the time at which the consumption Algorithm 1: Input: multimedia task T with l number of layered GROUPs; allowable SKIP and DELAY for media objects in T . Coordinator for a multimedia task invoke All START events in GROUP i to l do if there exist END events in GROUP i whose START events are in GROUP 1 to GROUP then wait for e / the first END event to complete on timeout begin abort T ; return end; for the rest of END events do WAIT / the maximum difference between the current delay and SKIP among the delayed media objects /* delay of e would be 0 if the first END event is not delayed */ the delay of e - min(fd max; d max; :::; d max l g) then wait for WAIT send STOP signals to all delayed END events in GROUP elseif WAIT+ the delay of e ? min(fd max; d max; :::; d max l g) if there exist START events in GROUP i then invoke all START events in the GROUP i . endfor terminate all Participants return Participant for an individual task do if receive START signal from Coordinator execute delivery operation send END signal to Coordinator elseif receive STOP signal from Coordinator terminate delivery operation elseif receive TERMINATE signal from Coordinator return forever of data stream m begins and consuming function Cm (t; t m cs ) be the total number of media objects consumed at time t. The number of media objects that must be buffered at any given time is then given by cs l s l s l s cs , l s cs cs . (1) Given D max as the amount of buffer for delay recovery in the presentation of media stream m, this amount must be added to consumption to determine the start time of displaying or delivering the stream. Suppose that a solution is to begin display or delivery at time x. That is, Bm (t; x) is at least zero for any time x l f l f is the time at which the loading of data stream m is completed. If we compare Bm (t; x) with Bm (t; t m l s ) in the range x l f , we see that Bm (t; l s l s l s l s l s l s If Bm (t; t m l s in the range t m l s l f , then Bm (t; l s . Thus, the start time of stream m can be t m l s . We now consider the situation that Bm (t; t m l s may be negative in the range t m l s l f . Let Bm (t; t m l s must be the minimum start time such that l s Thus, x can be determined when both consuming function and the loading time are given. This start time assumes that the entire stream will be continuously loaded. However, in our context, we assume that the data unit to be accessed is media object rather than the entire stream. Thus, after the display or deliver time of stream m is determined, the deliver time of each media object within the stream must also be precisely determined. 6.2 Start Times of Media Objects In order to ensure a hiccup-free presentation based on pre-determined time, the loading of each media object must guarantee that there is enough object data to be consumed at its consuming time. The presentation of each object can thus be divided into two phases: (a) a loading phase and (b) a consumption phase. Let t im l s be the time at which the loading of object o im of stream begins and loading function L im (t; t im l s ) be the amount of object o im of stream m read at time t. Let t im cs be the time at which the consumption of object o im of stream m begins and consuming function C im (t; t im cs ) be the amount of object consumed at time t. The amount of buffer space that must be allocated for object o im at any given time t is given by cs l s l s l s cs , l s cs cs . In similar manner to the derivation given above, we can derive the relationships between the loading and consuming times for each media object l s cs l s l s l s l s l s cs Let k im be determined by B im (t; t im l s max is the amount of buffer for delay recovery in the presentation of the object We then have l s cs Thus, for each object o im in stream m to be successfully presented at time cs , it must be loaded into memory at a time satisfying Formula (6). In case that the consuming function is linear, that is, Cm (t; c is the consuming rate of stream m. We then have the start time of the first object of the stream m based on Formula (3): l s c and the preloading times for the rest of the media objects based on Formula (6): l s c Depending on the loading delays and the amount of data that has to be loaded, t im l s can belong to any of the time periods in which previous media objects are consumed. 6.3 A Prefetching Strategy We now propose a prefetching technique which is based on the principles discussed above and satisfies the requirement of continuity and synchrony in the presentation of multimedia objects while minimizing the number of buffer faults. To incorporate the buffer management into the proposed scheduling algorithms, prefetching of the media objects must be performed before invoking their START events. The START event of an object corresponds to t im cs , and the END event to t im Each object must be prefetched before its START event is invoked. To minimize buffer requirements, all objects are not prefetched at the same time. The start of prefetching of object o im can be calculated by using Equation 9. These prefetching times are associated with a GROUP depending on the membership of the GROUP. A simple and effective prefetching strategy is to use a variation of the Least Recently Used (LRU) strategy called the Least Recently Displayed (LRD) strategy that replaces the object with the smallest t c f in the buffer with the new object. In other words, the object that finished consumption the earliest is removed first from the buffer. Using an LRD replacement strategy helps in dealing with delays more gracefully. In the event of delays, the last presented object in the faster stream is most likely to be presented over and over again (object duplication) to correct the skew in presentation. An LRD strategy guarantees that the most recently displayed objects are always in the buffer. The reader is referred to [GZ96] for a detailed discussion of the LRD strategy. Algorithm 2 reflects the addition of buffer management to the scheduling strategies detailed in the previous sections. Note that this algorithm provides only a rough sketch of the exact procedure. In particular, the loading of objects in each interval [GROUP are performed in a lump rather than at each individual loading time. We have shown a prefetching algorithm that maintains synchronization constraints thereby minimizing skew and jitter [LG90a] in a presentation. Furthermore, the algorithm handle delays in the presentation more gracefully by using an LRD replacement strategy for buffer replacement. This allows us to minimize the buffer faults and hence average delays in the presentation, thereby decreasing the additional buffer size required to store the delayed objects and make the presentation continuous. 7 Experimental Results This section will present our experimental results based on the approaches proposed in the previous sections. In our experiments we have video-clips, audio-clips and images available as database objects. The presentation script is stated in the application program that runs on top of the multimedia server. At script realization time, methods of the media objects are invoked at the respective points in time. The playout management is implemented in a multi-threaded environment in which the Algorithm 2: (delay recovery with buffer management) Input: multimedia task T with l number of layered GROUPs; allowable SKIP and DELAY for media objects in T the maximum buffer Coordinator for a multimedia task l s foreach obj 2 S do Prefetch(obj; i) invoke All START events in GROUP i to l do if there exist START events in GROUP i l s foreach obj 2 S do Prefetch(obj; i) invoke all START events in the GROUP i endfor terminate all Participants return if buffer size+jobjj - Bmax then BUFFER / BUFFER [fobjg buffer size / buffer size+jobjj else replace a minimal set of objects with smallest t cf in BUFFER with obj buffer size / buffer size +jobjj \Gamma jobjectsj return functions of the buffer manager, scheduler and the presentation of the media streams are managed by threads. We measured five QoS parameters including average delay, speed ratio, skew, jitter, and utilization during the presentation of the three media streams; these streams consisted of audio, video, and images, respectively. Two sets of experiments are illustrated in this section; one involves audio and image streams and the other involves video and audio streams. In the examples presented below, QoS parameters are measured at client sites. In the first set of the experiments, as in a typical slide presentation, objects from the audio and image streams were presented together. Each presentation of an audio or image object is for a duration of five seconds followed by a time gap of two seconds. Figure 5(a) shows the defined presentation of both the media streams. The presentation without delay recovery is illustrated in Figure 5(b). Figure 5(c) shows the actual presentation using Algorithm 1. It was found that the image stream consistently lagged in the presentation, possibly due to the additional overhead involved in creating the image and writing it into a window. When delay recovery is not implemented, the delay is allowed to propagate through the presentation. However, the synchronization between the two streams is still maintained, since the synchronization constraints enforce the simultaneous presentation of objects from both the media streams. For the interval (t 0 , Figure 5, the average delay for the nominal case is 0. In the scenario without delay recovery, the average delay is 1.0, 1.71, and 11 in the intervals (t 0 , t 1 These values are presented in the first row in Table 2. Similarly, the speed ratio in the interval (t 0 , t 1 ) for the case without delay recovery is 0.89. This is because only two-thirds of the audio object 2 is presented in (t 0 , t 1 ). In the interval (t 1 , t 2 ), the speed ratio is 0.78. Since all the objects delivered are presented without object loss, the utilization ratio is 1 for all time intervals. Note that the delayed stream, that is, the image stream, does not require any frame duplication to pause its presentation. Hence the value of utilization is 1 and not greater than 1. Furthermore, no difference in presentation times between an audio and image objects is observed. Therefore, the skew is 0 for all the intervals. The corresponding values when delay recovery is considered are shown in Table 3. The allowable skip for the image stream is set to a high value of 2 seconds, allowing the object to skip the entire delay. This is made possible by the non-temporal nature of images, so that information is not lost by decreasing the display time of an image object. Such a scheme results in the presentation schedule shown in Figure 5(c). Note that the utilization level does not decrease as a result of omission of the display of a non-temporal object. In contrast, if the delivery of an audio object were to be skipped or dropped, there would be a drop in the utilization level, as the actual data presented is less than the data made available. This difference is highlighted in the second set of experiments involving two temporal streams. From Figure 5(c), one can clearly see that the average delay has been reduced to 0 for all intervals. The speed ratio for all intervals is equal to unity, as all necessary audio objects are presented in all intervals. Since all the temporal (audio) objects delivered are presented without Nominal Presentation Actual presentation without delay recovery Actual presentation with delay recovery Time Audio Audio Audio Image Image Image (a) (b) (c) Figure 5: Presentation of audio and image streams : (a) nominal, (b) without delay recovery and (c) with delay recovery object loss, the utilization ratio is 1 for all time intervals. As in the scenario without delay recovery, skew is observed to be 0 in all the intervals. Parameter Average Delay 1 1 1.71 11 Speed Ratio 0.89 0.78 0.9 - Utilization Skew 0/3 0/3 0/3 0/3 Table 2: Parameter values for presentation without delay recovery In the second set of experiments, we presented a video stream along with an audio stream. The video clips are MPEG encoded streams [SZ94, ZTSY95, ZLS95]. The nominal presentation schedule is shown in Figure 6(a). Unlike the slide presentation, the presentation of both the streams is continuous. The allowable skip for both the video and audio stream is set to 0.50 seconds. Similar to the previous case, QoS parameters were measured with and without delay recovery. Tables 4 and 5 respectively present the QoS parameters for the case with and without delay recovery. Unlike in the previous case where the delays occurred in the image stream, presentation delays occurred in the both the streams. These delays were either due to system load and other extraneous conditions or the imposition of the presentation schedule on the delivery of a media stream. Since both audio and video are temporal in nature, we do see a decrease in the utilization as frames are dropped or skipped to maintain synchronization and decrease in average delay, skew Parameter Average Delay Speed Utilization Skew 0/3 0/3 0/3 - Table 3: Parameter values for presentation with delay recovery (a) (c) (b) Time Audio Audio Audio Figure Presentation of audio and video streams : (a) nominal, (b) without delay recovery and (c) with delay recovery and jitter in the presentation. The delay in the presentation could also be corrected by decreasing the speed ratio of the faster stream and thereby letting the slower stream catch up. For the interval (t 0 , Figure 6, the presentation of the video object was delayed while the presentation of that of the audio object was on time. In the absence of delay recovery, this delay was allowed to propagate to the following presentation intervals. This made the average delay substantial in each interval. For example, in intervals (t delay was 1.25 and 2.25 seconds respectively. In contrast, with delay recovery, audio and video objects can be skipped as long as the skip is within the tolerable range for the presentation. This reduces the average delay to 0.62 and 1.12 seconds in (t this trend. Besides, speed ratio also increases when delay recovery is performed since the actual presentation rate approaches the nominal presentation rate. Skew was observed in all intervals there was no delay recovery in place. This skew was reduced or eliminated when delay recovery was incorporated in the scheduling strategy. Without delay recovery, none of the video frames or audio samples were dropped. Hence, the utilization was considered 1 across the presentation with no delay recovery. However, with delay recovery some portions of the delayed stream, either audio or video or both, are skipped. This leads to a decrease in the utilization in all Parameter Average Delay 1.25 - 2.25 - 2.25 - 3.5 - 3.0 - Speed Utilization Skew Jitter Table 4: Parameter values for presentation without delay recovery Parameter Average Delay 0.62 - 1.12 - 0.75 - 0.25 - Speed Utilization 0.95 - 0.95 - 0.95 - 0.90 - 1.0 - Skew Jitter Table 5: Parameter values for presentation with delay recovery the intervals as shown in Table 5. In the case without delay recovery, jitter was observed at times in the presentation. Using delay recovery jitter is reduced to 0.5 seconds at times t 1 and t 2 and is eliminated at t 3 From the experiments performed, we observed that although our scheduling algorithms minimize jitter and skew by invoking the synchronization events simultaneously, the system-level differences between two invoked participants may still result in the occurrence of jitter and skew. By using delay recovery, such occurrence can be reduced, as the amount of objects to be dealt with is reduced. We have shown that the implementation of the proposed synchronization algorithms minimizes jitter, skew and delays in a presentation. Furthermore, a buffer management strategy is also presented along with the synchronization algorithm. This allows us to minimize the average delays in the presentation, thereby increasing speed ratio. A playout management functionality allows the user to define an application specific presentation script. Moreover, the service greatly enhances the user's ability to generate acceptable schedules at various levels of granularity of synchronization and choose the right schedule. Conclusions In this paper, we have introduced a framework for QoS management in education digital library environments. This framework includes a vehicle for the specification of multimedia data, tasks, schedule, and synchronization constraints. A multimedia task consists of a set of tasks upon which synchronization dependencies are specified on the delivery operations to enforce both intra- and inter-synchronization constraints. A schedule of the multimedia task is acceptable only if it satisfies the synchronization constraints defined on the multimedia task with the allowable QoS ranges. Several parameters, including average delay, speed ratio, utilization, jitter and skew are used to set up permittable QoS ranges. The framework also includes the principles and algorithms of scheduling and buffer management to ensure synchronous presentations of multiple media streams. Experimental results are also provided based on the implementation of the proposed approaches. Through this research, we have observed that multimedia presentations in the educational digital libraries require specific QoS management to ensure the quality of service in this domain. In order to prevent the misunderstanding of the learning or training materials, distortion between synchronized media objects must be minimized. Thus, preserving synchronization requirements on such presentations is the top priority in defining QoS services. As a result, the presentation tools proposed in this paper minimize the possibility of jitter and skew. Our experimental results have demonstrated that the proposed approaches are effective and efficient in preserving these goals. This paper has primarily focused on the specification, scheduling and buffer management at client sites. We have assumed that the server provides sufficient support for delivering media objects to client sites. In fact, the proposed principles of buffer management can also be applied to the server with different values to be defined on delays. Further research needs to be done to investigate the admission control at the server sites while distributed database systems or file systems are accessed. --R A Communication Media I/O Server and Its Synchronization Mechanisms. Maintaining Knowledge about Temporal Intervals. Avoiding Retrival Contention for Composite Multimedia Objects. Continuous Retrievals of Multimedia Data Using Parallelism. Buffer Management in Multimedia Database Systems. Network Considerations for Distributed Multi-media Object Composition and Communication Synchronization and Storage Models for Multimedia Objects. L/MRP: A Buffer Management Strategy for Interactive Continuous Data Flow in a Multimedia DBMS. Performance of Inter-Media Synchronization in Distributed and Heterogeneous Multimedia Systems Efficient Storage Techniques for Digital Continuous Multimedia. Synchronization Properties in Multimedia Systems. Playout Management - An Integrated Service of a Multimedia Database Management System A Network Level Channel Abstraction for Multimedia Communication in Real-time Networks Video Parsing and Browsing Using Compressed Data. Implementation of Video Presentation in Database Systems. Automatic Parsing and Indexing of News Video. --TR --CTR Harald Kosch , Ahmed Mostefaoui , Lszl Bszrmnyi , Lionel Brunie, Heuristics for Optimizing Multi-Clip Queries in Video Databases, Multimedia Tools and Applications, v.22 n.3, p.235-262, March 2004
digital libraries;quality of service QoS;synchronization;multimedia
597195
Optimal Scheduling for Parallel CBR Video Servers.
Parallel video servers are necessary for large-scale video-on-demand and other multimedia systems. This paper addresses the scheduling problem of parallel video servers. We discuss scheduling requirements of constant bit rate (CBR) video streams. Optimal algorithms are presented for conflict-free scheduling, delay minimization, request relocation, and admission control. With these algorithms, video streams can be precisely scheduled for Quality of Service requirements. Performance of these algorithms is also presented.
Introduction There is an increasing demand on capacity of video servers in large-scale video-on- demand systems [9, 3]. Parallel video servers become inevitable to provide large capacity required by the system that can service thousands of concurrent clients. There are two major types of parallel video servers: shared memory multiprocessors and distributed memory clustered architectures. Figure 1 shows the diagram of shared-memory architecture. In this architecture, a set of storage nodes and a set of computing nodes are connected to a shared memory. The video data is sent to the memory buffer through a high-speed network or bus, and then to the clients. A mass storage system has presented the capacity of supporting hundreds of requests [13]. However, it is not yet clear that a multiprocessor video server can be scalable. A clustered architecture is easy to scale to thousands of server nodes. In such a system, a set of storage nodes and a set of delivery nodes are connected by an interconnection network. Data is retrieved from the storage nodes and sent to the delivery nodes which send the data to clients. Figure 2 shows the diagram of the clustered architecture. A number of works describe clustered systems [18, 14, 15]. The clustered architecture can be extended to the direct-access architecture which provides an interface between the storage system and the network [4, 7]. Figure 3 shows the diagram of direct-access architecture. It eliminates the delivery nodes in the clustered architecture. Storage nodes send video data directed to the high speed WAN through a network interface. If a video file is not stored in a single storage node this architecture cannot guarantee the order of data arrival from different storage nodes. This problem is solved in project MARS by using a chain connection, an ATM-based interconnection within the server to connect storage devices to an ATM-based broadband network [4]. Storage node Storage node Storage node Storage node Memory banks Processors High Speed WAN network interface Figure 1. Shared-memory Architecture for Video Servers. Storage node Storage node Storage node Storage node node Delivery node Delivery node Delivery node Delivery High Speed WAN Interconnection Network Figure 2. Clustered Architecture for Video Servers. OPTIMAL SCHEDULING FOR PARALLEL CBR VIDEO SERVER 3 Storage node Storage node Storage node Storage node High Speed WAN network interface Interconnection Network Figure 3. Direct-access Architecture for Video Servers. In this paper, we evaluate scheduling strategies for the clustered architecture. As shown in Figure 2, an interconnection network connects storage nodes and delivery nodes. The storage nodes are responsible for storing video data in some storage medium, such as disks. Each storage node deals with its disk scheduling problem separately to provide the specified bandwidth. The delivery nodes are responsible for client's requests. On receiving a request from a client, the delivery node will schedule it to a time interval and deliver appropriate data blocks within some time deadline to the client during the playout of a video. Each delivery node has an output buffer as the interface to the high-speed WAN. If the WAN has congestion and the output buffer becomes full, a feedback signal is sent to corresponding storage nodes to stop sending video blocks. The logical storage and delivery nodes can be mapped to different physical nodes of the cluster. This configuration is called the "two-tier" architecture in [18]. Also, a node can be both a storage node and a delivery node, called the "flat" architecture. In this paper, the flat architecture is assumed. Scheduling policies are critical to performance of video servers. Currently, there are not many scheduling algorithms for parallel video servers, in particular, for clustered video servers. Without a good scheduling algorithm, video streams may conflict each other, resulting in delays and rejections. A larger buffer size may be required to tolerate this delay. Good scheduling algorithms can guarantee the quality-of-service, efficiently utilize resources and reduce the buffer size, and increase system throughput. This paper is organized as follows. Section 2 briefly describes an underlying model of a parallel CBR video server. A conflict-free scheduling algorithm and delay minimization are presented in sections 3 and 4. In section 5, a request relocation algorithm is presented. Admission control is discussed in section 6. Performance comparison is presented in section 7. Section 8 gives related works and section 9 discusses future works. 2. System Architecture and Background In this section, we model the scheduling problem for video servers. First, we assume wide striping, that is, video data is striped across all nodes in a round-robin fashion. Different video files start from different nodes for a balanced load. For example, the first file starts at node 0, the second file starts at node 1, etc. The results obtained here can be extended to short striping, which distributes video blocks to a subset of nodes. Depending on a selected block size s and the base stream rate R, time is divided into time cycles, where the length of a cycle is t s=R. The time to access n blocks, one from each storage node, is called time period. Thus a time period includes n time cycles. In general, the data transfer rate of a single disk or a disk array can be much higher than base stream rate R. Therefore, in a time cycle, multiple video streams can be serviced by a storage node while the individual stream rate is still preserved. The time cycle is thus divided into time slots, where the length of the slot, t s , is equal to or longer than the time required for retrieving a block from the storage node or transmitting to the delivery node, whichever is larger. The value of t s can be determined by experiments. Similar to other Quality-of-Service (QoS) problems, there are two type of guarantees, the deterministic guarantee and statistical guarantee. Deterministic guarantee determines t s by using the the worst case numbers. Such an approach is described in [15]. This approach guarantees QoS for all requests but the system may be underutilized. The statistical guarantee determines t s by using the the average numbers over a period of time. It increases the system utilization but some data may miss its deadline and more buffer space is necessary to smooth the delay jitter. The number of slots in a cycle, m, is determined by is adjusted to t f =m. A similar model has been used in the Tiger system [7]. The experiment results showed that this model worked well on real systems. Assume that a video server consists of N storage nodes and N delivery nodes, interconnected by a high-speed network. An individual request r is handled by a delivery node node i is responsible for delivering the data blocks retrieved from storage nodes to the client via network during the entire life-time of request r unless request relocation is required. The blocks of a video file is consecutively distributed in all N storage nodes. If request r, at time cycle t, retrieves a data block from storage node retrieve a data block from node (S(r; t Video block scheduling can be illustrated by a simple example. Figure 4 shows a schedule, where 3. For a balanced load, each video stream can start from different storage nodes. An entry in the figure shows the request OPTIMAL SCHEDULING FOR PARALLEL CBR VIDEO SERVER 5 slot node 0 node 3 node 2 node 1r 0 r 43 r r 90 time cycle 0 r 01 r r 91 time cycle 1 r r r 92 time cycle 2 r r 42 r 81 r 93 time cycle 3 delivery node i request r k storage node j Figure 4. A Complete Video Schedule in a Time Period. number r k , the delivery node number i, and the storage node number j. Request retrieves a block from storage node j to delivery node i. A video stream has its access pattern listed horizontally in a row. The blocks of a single stream are separated by m time slots. For example, request r 0 is scheduled to time slot 0 in the first row. For this request, delivery node 0 retrieves a block from storage node 1 in time cycle 0. It then retrieves blocks from storage nodes 2, 3, and 0 in next three cycles. The schedule table is wrapped around. At most (N \Theta m) requests can be scheduled. In a time slot, if more than one request needs to retrieve blocks from the same storage node, they compete for the resource. In order to avoid such a conflict, only the requests that access different storage nodes can be scheduled onto the same time slot. Thus, in every time slot, at most N requests can be scheduled, each retrieves a block from different storage nodes. Once the first cycle has a conflict-free schedule, the following cycles will not have conflict. Therefore, when discussing the scheduling problem, we can only show the first time cycle as long as the access patterns of video streams do not change. The same model can be extended to scheduling of interactive operations, such as fast forward and rewind. The access patterns of interactive operations are irregular. A set of scheduling algorithms have been designed which can retain the access order of storage nodes [20]. Now, we define the conflict-free schedule as follows. 6 MIN-YOU WU AND WEI SHU Definition 1: Conflict-free schedule. A conflict-free schedule is a schedule where in each time slot, no two video streams request a block from the same storage node. 2 A conflict-free schedule imply two constraints. The first one is imposed by the disk retrieving bandwidth of storage nodes which is measured by the total number of requests retrieving blocks from storage node j, at time cycle t: Because no more than one request can access the same storage node in each time slot, no more than m requests can access the same storage node in a time cycle. The second one is limited by the I/O bandwidth of delivery nodes. Within a time slot, a delivery node cannot handle more than one stream from different storage nodes. The total number of requests handled by delivery node i is bounded by m. These requests may access arbitrary storage nodes which are not necessarily distinct. These two constraints are summarized in the following Lemma. Lemma 1: The necessary condition for a conflict-free schedule in a time cycle is Now, the question is that whether the necessary condition is also the sufficient condition. In the other word, given a set of requests satisfying this necessary condition, does there exist a conflict-free schedule? In the next section, we will prove that Lemma 1 is also the sufficient condition for a conflict-free schedule by giving an algorithm to find out a conflict-free schedule. 3. Conflict-free Scheduling of Video Streams We are going to generate a conflict-free schedule for a given set of requests such that v t greedy algorithm has been proposed in [15], which schedules requests in their arriving order. Whenever a request arrives, the next available slot that is not in conflict with the existing ones will be assigned to the request. An example illustrates this algorithm. Example 1: Assume a set of requests arrive in the order as shown in Figure 5(a). The greedy algorithm schedules these requests as shown in Figures 5(b) to (d). Request r 1 cannot be scheduled to slot 0, so it is scheduled to slot 1; same is r 3 . Requests r 4 and r 7 must be scheduled to slot 2. Requests r 8 are not able to be scheduled. Thus, only nine requests have been scheduled. 2 The greedy algorithm cannot schedule some requests even if the Lemma 1 is satisfied. By rearranging the allocation of some existing requests, more requests can be accommodated. Let's revisit Example 1. In Figure 5(c), when request r 8 arrives, it cannot be scheduled to the only empty slot, slot 1, due to its conflict with r 3 . However, if we exchange r 3 and r 7 , r 8 can be scheduled to slot 1 as shown in Figure 6(a). Then r 9 is scheduled to slot 2 as shown in Figure 6(b). When OPTIMAL SCHEDULING FOR PARALLEL CBR VIDEO SERVER 7 node 0 node 3 node 2 node 1 r r r 11 slot node 0 node 3 node 2 r 01 r 11 r r 42 r 53 r 62 r 73 r 9 slot r r r3 11 node 0 node 3 node 2 r 01 r 11 r r 42 r 53 r 62 r 7 slot r r r r3 118 100 (b) (a) (c) (d) r r delivery node i request r storage node j Figure 5. Example of Greedy Scheduling Algorithm. request r 10 arrives, it cannot be scheduled to slot 2 since it conflicts with r 9 . The table is rearranged by moving r 2 from slot 0 to slot 2 and r 3 from slot 2 to slot can be scheduled to slot 0 as shown in Figure 6(c). Finally, r 11 is scheduled to slot 2 as shown in Figure 6(d). This example shows that a better schedule can be achieved by rearranging requests. We need a systematic approach to schedule requests without conflict. Now, we present an optimal algorithm for the conflict-free scheduling problem. This algorithm converts the scheduling problem to a matching problem on bipartite graphs. Then, the perfect matching algorithm can be applied to solve the problem. Algorithm 1: Conflict-free scheduling. Construct a bipartite graph G with bipartition (X; Y ), where joined to y j if and only if delivery node i handles a request that retrieves a block from storage node j. Because each delivery node handles requests and there are m requests retrieve blocks from storage node j, the constructed graph is an m-regular bipartite graph. For the first time slot, whether there exists a set of requests each of which accesses a different storage node from a different delivery node is equivalent to find a perfect matching in G. According to the marriage theorem [12], if G is a k-regular bipartite graph with k ? 0, then G has a perfect matching. After determining a perfect matching for time slot 0, eliminate the matched edges, the original problem of scheduling Nm requests to m time slots is reduced to a problem of scheduling N (m \Gamma 1) requests to (m \Gamma slots. Thus, applying the perfect matching algorithm m times, a schedule for all time slots can be generated. 2 The perfect matching algorithm, so called the Hungarian method, can be found in [2]. Here we give a brief description of the algorithm. Start with an arbitrary matching M . If M is not a perfect matching yet, an M-unsaturated node u is chosen. We search for an M-augmenting path with origin u to construct a larger matching. This procedure is repeated until a perfect matching is found. An example of the conflict-free algorithm is shown in Figure 7. It uses the same set of requests in Figure 5. After three iterations, the resultant schedule is shown in Figure 7(d) which is equivalent to Figure 6(d). This algorithm can also be used for the situation that less than Nm requests exist. When v t requests can be inserted. From this algorithm, it is easy to see that Lemma 1 is also the sufficient condition of conflict-free scheduling. This algorithm should be called when a request arrives but there is no conflict-free slot. When multiple requests arrive simultaneously, these requests are scheduled to empty slots one by one. When a conflict occurs, this algorithm is called to scheduling all the requests instead of only a single request. OPTIMAL SCHEDULING FOR PARALLEL CBR VIDEO SERVER 9 node 0 node 3 node 2 r 01 r 42 r 53 r 62 r 71 r r 8 slot r r r3 11 node 0 node 3 node 2 r 01 r 42 r 53 r 62 r 71 r r r 9 node 0 node 3 node 2 r 00 r 42 r 53 r 62 r 71 r 81 r 21 r 33 r 9 r 11 node 0 node 3 node 2 r 00 r 42 r 53 r 62 r 71 r 81 r 21 r 33 r 9 r33r 11 (b) (d) (a) slot r r3 11(c) slot Figure 6. Improvement of Example 1. node 0 node 3 node 2 r 43 r 91 r r 00 r 12 r r 22 r 73 r 6 r33r 11 slot delivery node storage node delivery node storage node delivery node storage node (a) slot 0 (b) slot 1 (c) slot 2 (d) optimal schedule Figure 7. Bipartite Graph for Request Set in Example 1. OPTIMAL SCHEDULING FOR PARALLEL CBR VIDEO SERVER 11 4. Request Delay Minimization Now consider the situation that the total number of requests is less than or equal to Nm and w there exists some j such that v t m. In this case, only m requests can be fulfilled by storage node j, and (v t must be delayed. Here, node j is called a "peg." On the other hand, there can be other storage node j where v t m. That leaves spaces in node j which is called a "hole." The "peg" requests can be fulfilled by delaying them to "holes". In a large system, the delay can be significant. The problem is how to minimize the delay of these "peg" requests. This problem can be solved with a simple peg-and-hole algorithm which is presented as follows. Algorithm 2: Peg-and-hole. Let R(j; hold the kth requests with for node i for each of (v i p m) extra requests remove request x from node i p while (v i h found a hole it to node i h ;In this algorithm, each request r i is represented by fS(r stands for the number of cycles to be delayed on request r i and initialized to zero. An entry of the two-dimension array R(j; indicates the kth request on storage node j. Variables i p and i h are indices pointing to the "peg" and "hole" storage nodes, respectively. Basically, a request that cannot be fulfilled in the current time cycle is delayed to its nearest unpacked time slot. This algorithm guarantees the minimum delay. Example 2: A set of requests are given as shown in Figure 8(a), where v 2. Thus storage nodes 1 and 2 are pegs while storage nodes 0 and 3 are holes. Requests r 6 and r 11 are delayed by two time cycles; request r 8 is delayed by one time cycle, as given in in Figure 8(b). The resultant schedule is shown in Figure 8(c). 2 r 01 r 11 r 22 r r 42 r 5r 63r 71 r r 9 r103r 11 (a)1 r 8r 62r 21 r r 9 r103r r 52 r 72 r 111 r 4 slot start of request (b)1 r 33 r 52 r r 93 r 70 r 42 r 00 r 73 r 21 r 92 r r 00 r 11 r 43 r r 90 r 21 r 70r 01 r103r r 43 r 92 r 7 node 0 node 3 node 2 node 1 time cycle 0 delivery node i request r storage node j Figure 8. Example for Request Delay OPTIMAL SCHEDULING FOR PARALLEL CBR VIDEO SERVER 13 5. Request Relocation In this section, we consider the situation where the load is unbalanced. The definition of load balance is different from the traditional definition because the video stream scheduling is a real-time problem. In this system, as long as every w i - m, it is considered as a balanced load. Otherwise, some requests need to be relocated. We assume that the total number of requests is less than or equal to Nm. In the case where the total number of requests is more than Nm, only Nm requests can be fulfilled. Many existing load relocation algorithms can be applied to this problem. The objective is to move requests from those overloaded nodes to the underloaded nodes with minimal cost. RIPS [17], runtime incremental parallel scheduling, is an algorithm designed to balance independent tasks on large-scale parallel machines. The algorithm can be so modified for parallel video servers that every node that presently handles more than m requests will send excess load to its nearest underloaded nodes. In Figure 9, we present a modified algorithm with assumption that the nodes are arranged in a linear chain. Algorithms for other topologies can be developed similarly. The first step is to obtain the accumulated number of requests by using the scan with sum operation from node N \Gamma 1 to node 0. Each node records a partial sum . In the second step, each node calculates an accumulation quota This algorithm can be seen as another "peg-and-hole" algorithm, where the "peg" is the overloaded node and the "hole" is the underloaded node with respect to its quota. The corresponding flows are also calculated. A positive flow means that a flow from node i \Gamma 1 to node i and a negative flow means that a flow from node i to node i \Gamma 1. In the third step, proximities are calculated which are the distance from nearest "hole" nodes. Assume every hole has unlimited capacity, the minimal flow f i\Gamma1;i is the result of deliverying every extra work to its nearest hole, in case of a tie, to its left-nearest hole. Hence, there is no flow across any hole node. Therefore, between nodes the resultant minimal flow f i\Gamma1;i can be determined only by all nodes from its left-nearest hole to its right-nearest hole, which are bounded by indices from b l i to b r . That is, f i\Gamma1;i is a summation of possible flows from its left-handed nodes if node b r i is their nearest hole and its right-handed nodes if node b l i is their nearest hole. In the fourth step, with two flows y i\Gamma1;i and f i\Gamma1;i available, we can construct an optimal flow x i\Gamma1;i such that it is closed to f i\Gamma1;i as much as possible, but does not overload any hole node. In the case of T , the flow y i\Gamma1;i is an optimal one. Otherwise, an auxiliary variable g i is used to record how many streams can be adjusted. Initially, g 0 is the maximum number of streams allowed to be adjusted. Once g i becomes zero, the rest of optimal flows, f must be the same as y According to the values of x, the workload is exchanged so that each node has no more than m requests. The number of communication steps in this algorithm is 5N , where step 1 takes N steps to calculate T i , step 3 takes 2N steps, one for calculating p, one for f , and step 4 takes 2N steps, one for calculating x, one for load exchange. This algorithm minimizes the number of communications and communication distance. It also maximizes locality. 14 MIN-YOU WU AND WEI SHU Algorithm 3: Request Relocation. Let w i be the number of video streams in node i, where 1. Global Reduction: Perform the scan with sum operation of w 2. Quota Calculation: An accumulation quota and corresponding flow for each node are computed: 3. Proximity Calculation: For each node i, its proximity to the left/right-nearest hole is defined as p l as follows: l For each node i, a segment from its left-nearest hole to its right-nearest hole are bounded by indices from b l i to b r l Assume every hole has unlimited capacity, the minimal flow f i\Gamma1;i is the result of delivering every extra work to its nearest hole, and in case of a tie, to its left-nearest hole. For l 4. Load Exchange: For to receive x i\Gamma1;i tasks from node i \Gamma 1. to receive jx i;i+1 j tasks from node i + 1. tasks to node i \Gamma 1. tasks to node i + 1. Figure 9. Request Relocation Algorithm for a Chain. OPTIMAL SCHEDULING FOR PARALLEL CBR VIDEO SERVER 15 Example 3: Table 1 and Figure 10 show an example for the load-balancing algo- rithm, where are calculated in steps 1 and 2. In step 3, p l are calculated so that by comparing their values each overloaded node can determine its intention of sending extra load, which is the value of f . For example, node 3 intends to send a request to node 2 so that f \Gamma1. Similarly, node 4 intends to send a request to node 5 so that f 4;5 = 1. When p l , the node intends to send its extra load to left. In step 4, the value of x is calculated according to the values of g. Since the value of x must be in range (y \Gamma g; y), the final flow could be different from the value of f . For example, node 4 intends to send a request to node 5 according to the value of f , but finally it sends a request to node 3. Otherwise, nodes 5, 6, or 7 would be overloaded. 2 Table 1. Example for Request Relocation 29 26 22 22 17 12 11 3 28 y i\Gamma1;i l l x i\Gamma1;i Figure 10. Example for Request Relocation. The complexity of each algorithm is listed below: Conflict-free scheduling O(mN log N ) Request delaying O(mN ) Request relocation O(N ) 6. Admission Control With the conflict-free scheduling algorithm, request delaying algorithm, and load-balancing algorithm, we are ready to define the admission control policy for new requests. A new request can be admitted if and only if it can be scheduled without conflict. It could be scheduled to a time slot immediately upon arrival at a delivery node if there is a conflict-free time slot available. Otherwise, the new request must be delayed, or other video streams need to be rescheduled to accommodate the new request. Admission Rejection Request Request Relocation Delaying Conflict-free Scheduling T<=Nm? empty slot? new request find an Figure 11. Admission Control Algorithm The admission control algorithm is shown in Figure 11. Let T 0 be the current total number of video streams being serviced. When one or more requests arrive, the condition T - Nm is checked, where r is the number of newly arrived requests. If the condition holds, the requests are admitted. Otherwise, only r requests can be admitted and others must be rejected. For the admitted requests, it is to test whether some delivery nodes are overloaded. If so, some requests are to be relocated. The next step is to check whether some storage nodes are overloaded. If so, some requests are to be delayed. Finally, it is to check whether there are non-conflict time slots for the new requests. If not, the conflict-free scheduling algorithm is applied to rearrange video streams. The admission control algorithm deals with the single request and the multiple requests separately. The following steps are applied to multiple requests arriving the system simultaneously: ffl if for any delivery node i, w i ? m, the request relocation algorithm is applied; ffl if for any storage node j, v t m, the request delay algorithm is applied; OPTIMAL SCHEDULING FOR PARALLEL CBR VIDEO SERVER 17 ffl if any request cannot find an empty conflict-free slot, the conflict-free scheduling algorithm is applied. In the situation that only a single request arrives the system, a simple policy can be applied which is described as follows: ffl assume the new request r k arrives, if w i ? m, the left-nearest and the right- nearest underloaded nodes of node i are searched and the new request is transferred to its nearest underloaded node; m, the request is to be delayed to its nearest hole; ffl if there is a conflict-free time slot for the new request, it is scheduled to the time slot, otherwise the conflict-free scheduling algorithm is applied. The policy that schedules multiple requests together can reduce the scheduling overhead and sometime lead to a better schedule. 7. Simulation and Performance We have conducted a simulation study on various scheduling algorithms, which include Greedy algorithm, Conflict Free Scheduling (CFS), CFS with Delay (CFS/D), CFS with Delay and Relocation (CFS/D&R). The simulation is configured with five parameters: the total number of storage/delivery nodes N , the number of slots per time cycle m, the load measurement L based on the available capacity, the average file size Z specified in terms of number of slots required to retrieve the entire file, and the duration of simulation in terms of number of time cycles. In the following simulation, the average file size is 200 time slots, and the simulation duration is cycles. The arrival rate, R, can be calculated from the following equation: Z At each step, the probability that there are exactly r new requests is given by: where, ae can be calculated as: R =X The simulation proceeds step by step for each time cycle as follows: (a) At each step the number of new requests is calculated according to probability ae. (b) For each new request, randomly generate its delivery node, its starting storage node where the first block of the file is stored, and the size of the file in terms of number of slots. (c) The admission control policy is applied to determine which requests are to be admitted or rejected, and if admitted, the scheduling algorithm is used to schedule the requests. If a single new request is generated in this step, the algorithms for the single request are employed. If more than one new requests are generated, the algorithms for multiple requests are employed. At the end of the simulation, statistics obtained include the total number of requests generated, the number of rejected requests, the number of delayed requests, the number of relocated requests, etc. The different versions of the CFS algorithm have first been studied. They are tested with different arrival rates. Table 2 shows performance of algorithms CFS, CFS/D, and CFS/D&R on different loads. For each instance, listed in the table are: (1) the percentage of delayed requests, (2) the average delay per delayed request in terms of time cycles, (3) the percentage of relocated requests, (4) the average distance per relocated request in terms of hops, and (5) rejection rate, which is the ratio of the number of rejected requests and the total number of requests. Here, items (2) and (4) give more detailed information about the delayed requests and the relocated requests, respectively. It is shown that when the system is lightly loaded, the delay is around one time cycle. As the load increases, the average delay may increase to a few time cycles. The number of delayed requests and the average delay of the CFS/D&R algorithm are substantially larger than the CFS/D algorithm, because CFS/D&R admits much more requests that are rejected by CFS/D. These requests must be relocated and delayed. Also, the number of relocated requests and the average distance of the CFS/D&R algorithm increase with the load. For a heavily-loaded system, such as 90% or more, CFS or CFS/D exhibits a high rejection rate, whereas CFS/D&R can reduce the rejection rate significantly. The penalty paid for a low rejection rate is the large number of relocations and delays to be enforced for incoming requests due to the highly saturated system. Next, we compare performance of Greedy algorithm and different versions of the CFS algorithm. Figure 12 shows performance for different values of m, the number of time slots in a time cycle. When m increases, the rejection rate for all four algorithms decreases. The partially reason for this phenomenon is that when each delivery node handles more requests the difference between the number of requests arrived becomes smaller. Figure 13 shows performance for different number of nodes, N . There is no substantial change in rejection rates when N varies for the Greedy, CFS, and CFS/D algorithms. But for CFS/D&R the rejection rate decreases when N increases, since there could be more chances to relocate the newly arrived requests. Finally, Figure 14 shows performance for different loads. Obviously, the rejection rates of all four algorithms become high as load increases. For CFS/D&R, the rejection rate remains around 0 until the load becomes 80%, and at load of 80%, the rejection rate is 0.64%. In general, a rejection rate of less than 1% is considered to be acceptable. OPTIMAL SCHEDULING FOR PARALLEL CBR VIDEO SERVER 19 Table 2. Performance Variances with Different Loads for m=10 and N=16. Load Algorithms Delayed Avg. delay Relocated Avg. distance Rejection requests per delayed requests per relocated rate request request 30% CFS/D .08% 1.00 - 0.12% CFS/D&R .08% 1.00 .12% 1.00 0.00% 40% CFS/D .70% 1.00 - 0.72% CFS/D&R .70% 1.00 .72% 1.00 0.00% 50% CFS/D 2.25% 1.07 - 2.12% CFS/D&R 2.54% 1.09 2.32% 1.00 0.00% CFS/D&R 6.49% 1.28 5.49% 1.04 0.00% 70% CFS/D 7.65% 1.24 - 8.43% CFS/D&R 13.1% 1.58 11.8% 1.11 0.05% 80% CFS/D 11.7% 1.36 - 13.32% CFS/D&R 31.4% 2.36 31.7% 1.49 0.64% 90% CFS/D 14.1% 1.44 - 15.97% CFS/D&R 42.4% 2.89 42.1% 1.75 2.57% 100% CFS/D 17.0% 1.55 - 21.27% CFS/D&R 53.3% 3.69 52.6% 2.19 8.25% 0% 5% 10% 15% 20% 30% 40% Rejection Rate Greedy CFS CFS/D CFS/D&R Figure 12. Rejection Rate as Number of Time Slots Varies. 0% 5% 10% 15% 20% 30% Rejection Rate Greedy CFS CFS/D CFS/D&R Figure 13. Rejection Rate as Number of Storage Nodes Varies. OPTIMAL SCHEDULING FOR PARALLEL CBR VIDEO SERVER 21 30% 40% 50% 60% 70% 80% 90% 100% Load 0% 5% 10% 15% 20% 30% Rejection Rate Greedy CFS CFS/D CFS/D&R Figure 14. Rejection Rate as Load Increases. 22 MIN-YOU WU AND WEI SHU 8. Related Work During the past few years, several research projects investigated techniques for designing video servers. Related issues include disk layout and scheduling strategies, admission control strategies, real-time support, etc. [5, 10, 16, 19, 6]. Most research works assumed single disk storage system. Several research projects investigated the design techniques for parallel video servers [15, 4, 13, 18, 14, 7, 11]. Video data stripping schemes have been studied [15, 1, 5, 10, 7, 11]. However, video stream scheduling problem has not been formally addressed. Many systems rely on statistical multiplexing which cannot truly guarantee the Quality of Service. The system resources cannot be fully utilized without a sophisticated scheduling strategy. Not arranging the video streams properly, large buffer space is required. In particular, the prefetch technique requests huge memory space [8]. A greedy scheduling for clustered architectures has been proposed by Reddy [15]. Our approach aims at precise scheduling of video streams to maximize system throughput and to minimize the usage of buffers. Mitra, a scalable media server, is a cluster of multi-disk workstations connected using an ATM switch [11]. The data is partitioned into many blocks, each of them is distributed across d disks. Each piece of this block is termed as fragment. The time period is fixed for all media types. In each time period, the scheduler issues a read request for the block to the d disks. Then each disk transfers its fragment to the client. No scheduling has been applied to the transfer of these fragments. Tiger, a direct-access architecture, uses the wide striping strategy to balance the load and the similar delay strategy described in this paper. It assumes that all of the files have the same bit rate [7]. However, Tiger does not have a conflict-free scheduling algorithm to avoid unnecessary delay. Instead of scheduling to the current time slot, a newly arrived request is delayed to next available slot. For a large system, the delay can be significant. After the system load reaches 50% to 80%, the delay increases drastically. Our algorithms can be applied to direct-access architecture equally well. By using the conflict-free scheduling algorithm, only requests that exceed the disk capacity are delayed. Our experimental result shows that if a request has to be delayed, the average delay is less than three time cycles and rejection rate is less than 3% when the system load is 90%. 9. Conclusion and Future Work This paper addressed the scheduling problem for parallel CBR video servers. A number of algorithms including conflict-free scheduling, request delay minimiza- tion, request relocation, and admission control have been presented. Combining these algorithms, we are able to achieve optimal scheduling in distributed memory clustered architectures. Most current scheduling techniques are based on statistical multiplexing. To guarantee timely video signal delivery, a system is not able to reach its maximum capacity with statistical multiplexing. Our method precisely schedules video streams for Quality of Service requirement. This method maximizes the video server capacity, OPTIMAL SCHEDULING FOR PARALLEL CBR VIDEO SERVER 23 and minimizes the delay time. It can minimize the buffer size required to reduce the effect of unpredictable network delay. The scheme described in this paper has been extended to support interactive operations such as fast forward and rewind [20]. We did not discuss the network conflict problem in this paper. Network traffic scheduling is an important issue to be addressed. For some topologies such as the Omega network and hypercube network, once a set of requests has been scheduled without conflict for a time cycle, there is no conflict for other cycles. However, for other network topologies, it might be necessary to do scheduling for each individual time cycle. The paper only addressed scheduling problem for the CBR video. In some appli- cations, clients may request the retrieval of variable bit rate encoded media streams. Scheduling this type of requests is much more difficult which is to be addressed in the future work. Acknowledgments The authors would like to thank Xin He for his helpful discussion and Karthikeyan Samuthiram for his simulation work. This research was partially supported by NSF grants CCR-9505300 and CCR-9625784. --R Staggered striping in multimedia information systems. Graph Theory with Applications. Hierarchical storage management in a distributed VOD system. Scalable video data placement on parallel disk array. Storage subsystem in a large multimedia server for high-speed network environments The Tiger video fileserver. The SPIFFI scalable video-on-demand server Multimedia storage servers: A tutorial. Continuous retrieval of multimedia data using paral- lelism A scalable continuous media server. On representatives of subsets. Performance of a mass storage system for video-on-demand Techniques for scheduling I/O in a high performance multimedia-on-demand server Scheduling and data distribution in a multiprocessor video server. Runtime Incremental Parallel Scheduling (RIPS) on distributed memory computers. Design and performance tradeoffs in clustered multimedia servers. Admission control algorithm for multimedia on-demand servers Scheduling for interactive operations in parallel video servers. --TR --CTR Min-You Wu , Su-Jun Ma , Wei Shu, Scheduled video delivery for scalable on-demand service, Proceedings of the 12th international workshop on Network and operating systems support for digital audio and video, May 12-14, 2002, Miami, Florida, USA Harald Kosch , Ahmed Mostefaoui , Lszl Bszrmnyi , Lionel Brunie, Heuristics for Optimizing Multi-Clip Queries in Video Databases, Multimedia Tools and Applications, v.22 n.3, p.235-262, March 2004 Chow-Sing Lin , Yi-Chi Cheng, P2MCMD: A scalable approach to VoD service over peer-to-peer networks, Journal of Parallel and Distributed Computing, v.67 n.8, p.903-921, August, 2007 Min-You Wu , Wei Shu , Chow-Sing Lin, Odyssey: a high-performance clustered video server, SoftwarePractice & Experience, v.33 n.7, p.673-700, June
Quality of Service QoS;video servers;video streams;constant bit rate CBR;large-scale VoD;conflict-free scheduling
597201
Audio Partitioning and Transcription for Broadcast Data Indexation.
This work addresses automatic transcription of television and radio broadcasts in multiple languages. Transcription of such types of data is a major step in developing automatic tools for indexation and retrieval of the vast amounts of information generated on a daily basis. Radio and television broadcasts consist of a continuous data stream made up of segments of different linguistic and acoustic natures, which poses challenges for transcription. Prior to word recognition, the data is partitioned into homogeneous acoustic segments. Non-speech segments are identified and removed, and the speech segments are clustered and labeled according to bandwidth and gender. Word recognition is carried out with a speaker-independent large vocabulary, continuous speech recognizer which makes use of n-gram statistics for language modeling and of continuous density HMMs with Gaussian mixtures for acoustic modeling. This system has consistently obtained top-level performance in DARPA evaluations. Over 500 hours of unpartitioned unrestricted American English broadcast data have been partitioned, transcribed and indexed, with an average word error of about 20%. With current IR technology there is essentially no degradation in information retrieval performance for automatic and manual transcriptions on this data set.
Introduction With the rapid expansion of different media sources for information dissemination, there is a need for automatic processing of the data. For the most part todays methods for transcription and indexation are manual, with humans reading, listening and watching, annotating topics and selecting items of interest for the user. Automation of some of c Publishers. Printed in the Netherlands. these activities can allow more information sources to be covered and significantly reduce processing costs while eliminating tedious work. Radio and television broadcast shows are challenging to transcribe as they contain signal segments with various acoustic and linguistic natures. The signal may be of studio quality or have been transmitted over a telephone or other noisy channel (i.e., corrupted by additive noise and nonlinear distortions), it can contain speech in the presence of background music and pure music segments. Gradual transitions between segments occur when there is background music or noise with changing volume, whereas abrupt changes are common when there is switching between speakers in different locations. The speech is produced by a wide variety of speakers: news anchors and talk show hosts, reporters in remote locations, interviews with politicians and common people, unknown speakers, new dialects, non-native speakers, etc. Speech from the same speaker may occur in different parts of the broadcast, and with different channel conditions. The linguistic style ranges from prepared speech to spontaneous speech. Two principle types of problems are encountered in transcribing broadcast news data: those relating to the varied acoustic properties of the signal, and those related to the linguistic properties of the speech. Problems associated with the acoustic signal properties are handled using appropriate signal analyses, by classifying the signal according to segment type and by training specific acoustic models for the different acoustic conditions. This process, known as audio partitioning is described in the next section. Section 3 describes the process for automatically transcribing the speech data. Section 4 presents an evaluation of the word transcription quality and the performance of an information retrieval system using the automatic transcriptions of the data from the 1999 TREC-8 Spoken Document Retrieval task [5]. 2. Data Partitioning While it is evidently possible to transcribe the continuous stream of audio data without any prior segmentation, partitioning offers several advantages over this straight-forward solution. First, in addition to Audio Partitioning and Transcription for Broadcast Data Indexation 3 Segmentation with Energy Constraint fewer clusters no change Segmentation Audio Stream Music / Background Segments Chop in Small Segments Speech/Music/Backgd and Reestimation Bandwidth and Gender Speech Partition Map GMM clustering with 3 GMMs Segmentation Train a GMM for each Segment Unpartionned Figure 1. Partitioning algorithm. the transcription of what was said, other interesting information can be extracted such as the division into speaker turns and the speaker identities. Prior segmentation can avoid problems caused by linguistic discontinuity at speaker changes. By using acoustic models trained on particular acoustic conditions, overall performance can be significantly improved, particularly when cluster-based adaptation is performed. Finally by eliminating non-speech segments and dividing the data into shorter segments (which can still be several minutes long), reduces the computation time and simplifies decoding. 4 Gauvain Lamel Adda The segmentation and labeling procedure introduced in [9] is shown in Figure 1. First, the non-speech segments are detected (and rejected) using Gaussian mixture models. The GMMs, each with 64 Gaussians, serve to detect speech, pure-music and other (background). The acoustic feature vector used for segmentation contains 38 parameters. It is the same as the recognition feature vector described in the next section, except that it does not include the energy, although the delta energy parameters are included. The GMMs were each trained on about 1h of acoustic data, extracted from the training data after segmentation with the transcriptions. The speech model was trained on data of all types, with the exception of pure music segments and the silence portions of segments transcribed as speech over music. In order to detect speech in noisy conditions a second speech GMM was trained only on noisy speech segments. These model are expected to match all speech seg- ments. The music model was trained only on portions of the data that were labeled as pure music, so as to avoid mistakenly detecting speech over music segments. The silence model was trained on the segments labeled as silence during forced alignment, after excluding silences in segments labeled as containing speech in the presence of background music. All test segments labeled as music or silence are removed prior to further processing. A maximum likelihood segmentation/clustering iterative procedure is then applied to the speech segments using GMMs and an agglomerative clustering algorithm. Given the sequence of cepstral vectors corresponding to a show the goal is to find the number of sources of homogeneous data (modeled by the p.d.f. f(\Deltaj- k ) with a known number of parameters) and the places of source changes. The result of the procedure is a sequence of non-overlapping segments associated segment cluster labels Each segment cluster is assumed to represent one speaker in a particular acoustic environment. In absence of any prior knowledge about the stochastic process governing (K; N) and the segment lengths, we use as objective function a penalized log-likelihood of the form Audio Partitioning and Transcription for Broadcast Data Indexation 5 log f(s i The terms ffN and fiK, which can be seen as segment and cluster penalties, correspond to the parameters of exponential prior distributions for N and K. It is easy to prove that starting with overestimates of N and K, alternate Viterbi re-estimation and agglomerative clustering gives a sequence of estimates of (K; with non decreasing values of the objective function. In the Viterbi step we reestimate (N; - k ) so as to increase )\GammaffN (i.e. adding a segment penalty ff in the Viterbi search) whereas in the clustering step two or more clusters can be merged as long as the resulting log-likelihood loss per merge is less than fi. 1 Since merging two models can reduce the number of segments, the change in segment penalty is taken into account during clustering. The process is initialized using a simple segmentation algorithm based on the detection of spectral change (similar to the first step used in [17]). The threshold is set so as to over-generate segments, roughly 5 times as many segments as true speaker turns. Initially, the cluster set consists of a cluster per segment. This is followed by Viterbi training of the set of GMMs (one 8-component GMM per cluster). This procedure is controlled by 3 parameters: the minimum cluster size (10s), the maximum log-likelihood loss for a merge (ff), and the segment boundary penalty (fi). When no more merges are possible, the segment boundaries are refined using the last set of GMMs and an additional relative energy-based boundary penalty, within a 1s interval. This is done to locate the segment boundaries at silence portions, attempting to avoid cutting words (but sometimes this still occurs). Speaker-independent GMMs corresponding to wide-band speech and telephone speech (each with 64 Gaussians) are then used to identify telephone segments. This is followed by segment-based gender identi- fication, using 2 sets of GMMs with 64 Gaussians (one for each band- width). The result of the partitioning process is a set of speech segments This clustering criterion is closely related to the MDL or BIC criterion. 6 Gauvain Lamel Adda Figure 2. Spectrograms illustrating results of data partitioning on sequences extracted from broadcasts. The upper transcript is the automatically generated segment type: Speech, Music, or Noise. The lower transcript shows the clustering results for the speech segments, after bandwidth (T=telephone-band/S=wide-band) and gender (M=male/F=female) identification. The number identifies the cluster. with cluster, gender and telephone/wide-band labels, as illustrated in Figure 2. We evaluated the frame level segmentation error (similar to [11]) on the 4 half-hour shows in the DARPA Hub-4E eval96 test data [4] using the manual segmentation found in the reference transcriptions. The NIST transcriptions of the test data contain segments that are not scored, since they contain overlapping or foreign speech, and occasionally there are small gaps between consecutive transcribed segments. Since we consider that the partitioner should also work correctly on these portions, we relabeled all excluded segments as speech, music or other background. Table I(top) shows the segmentation frame error rate and speech/non- speech errors for the 4 shows. The average frame error is 3.7%, but is much higher for show 1 than for the others. This is due to a long and very noisy segment that was deleted. Averaged across shows the gender labeling has a 1% frame error. The bottom of Table I shows measures of the cluster homogeneity. The first entry gives the total number of speakers and identified clusters per file. In general there are more clusters than speakers, as a cluster can represent a speaker in a Audio Partitioning and Transcription for Broadcast Data Indexation 7 Table I. Top: Speech/non-speech frame segmentation error (%), using NIST labels, where missing and excluded segments were manually labeled as speech or non-speech. Bottom: best cluster coverage (%). Show Frame Error 7.9 2.3 3.3 2.3 3.7 #spkrs/#clusters 7/10 13/17 15/21 20/21 - Coverage 87.6 71.0 78.0 81.1 78.7 given acoustic environment. The second measure is the cluster purity, defined as the percentage of frames in the given cluster associated with the most represented speaker in the cluster. similar measure was proposed in [3], but at the segment level.) The table shows the weighted average cluster purities for the 4 shows. On average 96% of the data in a cluster comes from a single speaker. When clusters are impure, they tend to include speakers with similar acoustic conditions. The "best cluster" coverage is a measure of the dispersion of a given speaker's data across clusters. We averaged the percentage of data for each speaker in the cluster which has most of his/her data. On average, 80% of the speaker's data goes to the same cluster. In fact, this average value is a bit misleading as there is a large variance in the best cluster coverage across speakers. For most speakers the cluster coverage is close to 100%, i.e., a single cluster covers essentially all frames of their data. However, for a few speakers (for whom there is a lot of data), the speaker is covered by two or more clusters, each containing comparable amounts of data. 3. Transcribing Partitioned Broadcast Data The speech recognizer uses continuous density hidden Markov models (CD-HMMs) with Gaussian mixture for acoustic modeling and n-gram 8 Gauvain Lamel Adda statistics estimated on large text corpora for language modeling [8]. For acoustic modeling, 39 cepstral parameters are derived from a Mel frequency spectrum estimated on the 0-8kHz band (0-3.5kHz for telephone speech models) every 10 ms. The LPC-based cepstrum coefficients are normalized on a segment cluster basis using cepstral mean removal and variance normalization. Each resulting cepstral coefficient for each cluster has a zero mean and unity variance. Each context-dependent phone model is a tied-state left-to-right CD-HMM with Gaussian mixture observation densities (about the tied states are obtained by means of a phonemic decision tree. Gender-dependent acoustic models were built using MAP adaptation of speaker-independent seed models for wide-band and telephone band speech [6]. The acoustic models for American English were trained on about 150 hours of Broadcast News data. Language models (LMs) were obtained by interpolation of back-off n-gram language models trained on different data sets: Broadcast news transcriptions, North American Business newspapers and Associated Press Wordstream texts, and transcriptions of the broadcast news acoustic training data. The interpolation coefficients of these 4 LMs were chosen so as to minimize the perplexity on a set of development texts. The recognition vocabulary contains 65122 words and has a lexical coverage of about 99% on the development and test data. The pronunciations are based on a 48 phone set (3 of them are used for silence, filler words, and breath noises). A pronunciation graph is associated with each word so as to allow for alternate pronunciations, including optional phones. Compound words for about 300 frequent word sequences subject to reduced pronunciations were included in the lexicon as well as the representation of frequent acronyms as words. In order to address variability observed in the linguistic properties, we analyzed differences in read and spontaneous speech, with regard to lexical items, word and word sequence pronunciations, and the frequencies and distribution of hesitations, filler words, and respiration noises. As a result of this analysis, these phenomena were explicitly modeled in both the acoustic and language models as described in [8]. The word decoding procedure is shown in Figure 3. Prior to decod- ing, segments longer than 30s are chopped into smaller pieces so as to Audio Partitioning and Transcription for Broadcast Data Indexation 9 Chop into Segments Smaller than 30s for each Segment Cluster Variance Normalization Cepstral Mean and Audio Stream Final Transcription Word Graph Generation MLLR Adaptation & Decoding MLLR Adaptation Initial Hypotheses Generate with Partition Map Figure 3. Word decoding. limit the memory required for the 4-gram decoding pass [8]. To do so a bimodal distribution is estimated by fitting a mixture of 2 Gaussians to the log-RMS power for all frames of the segment. This distribution is used to determine locations which are likely to correspond to pauses, thus being reasonable places to cut the segment. Cuts are made at the most probable pause 15s to 30s from the previous cut. Word recognition is performed in three steps: 1) initial hypothesis generation, graph generation, final hypothesis generation. The initial hypothesis are used for cluster-based acoustic model adaptation using the MLLR technique [14] prior to the 2nd and 3rd decoding passes. The final hypothesis is generated using a 4-gram language model. The first step generates initial hypotheses which are used for cluster-based acoustic model adaptation. This single pass decoding makes use of a trigram backoff language model (about 8M trigrams and 17M bi- grams) and gender-specific sets of 5416 position-dependent, cross word triphones with about 11500 tied states. Band-limited acoustic models are used for the telephone speech segments. The second decoding step generates accurate word graphs. Unsupervised acoustic model adaptation (both means and variances) is performed for each segment cluster using the MLLR technique [14]. The mean vectors are adapted using a single block-diagonal regression ma- trix, and a diagonal matrix is used to adapt the variances. Each segment is decoded with the trigram language model and an adapted version of the larger set of acoustic models 28000 position-dependent, cross word triphones with about 11500 tied states (350K Gaussians). The final hypothesis is generated using a 4-gram language model, and the large set of acoustic models adapted with the hypothesis from the second decoding step. Broadcast news transcription systems have been also developed for the French and German languages, partially supported by the LE4 Olive project. The same partitioning and recognition algorithms have been successfully applied in conjunction with language-specific lexicons. and acoustic and language models. The French and German lexicons are represented with 37 and 51 phones respectively, including specific phones for silence, breath and fillers. The acoustic models for each language were trained on about 20 hours of audio data from radio and television broadcasts. Trigram backoff language models are formed by interpolation of individual LMs estimated on the transcriptions of the acoustic training data and on texts from newspapers and newswires. The out-of-vocabulary (OOV) rate is 1.15% for the French 65k lexicon, and 4.5% for the German 65k lexicon. The lower lexical coverages than for English are due to the large number of verb forms, and number and gender agreement for French and German and for case declension and compounding in German. Audio Partitioning and Transcription for Broadcast Data Indexation 11 Table II. Summary of broadcast news transcription word error rates for 3 test sets. *Only the 1996 system used a manual partition. All other results are with an automatic partition. Test set System 1.8 hours 3 hours 3 hours 1996 system 27.1* 1997 system 25.3 18.3 1998 system 19.8 13.9 13.6 4. Evaluation This section presents an evaluation of the broadcast news transcription system both in terms of transcription accuracy, and the potential for using the automatic transcription for information indexing and retrieval. 4.1. Speech recognizer word accuracy In Table II reports the word recognition results on DARPA evaluation test sets from the last three years. Each data set contains a few hours of broadcast audio data selected by NIST [4]. The commonly used error metric is the "word error" rate defined as: %word error = %substitutions %insertions %deletions. The results shown in bold are the official NIST scores obtained by the different systems. For the 1997 system our main development effort was devoted to moving from a manual to an automatic partitioning process. This system nevertheless achieved a performance improvement of 6% on the eval'96 test data. The 1998 system [10] has more accurate acoustic and language models, and achieves a relative word error reduction of over 20% compared to the 1997 system. These tests were carried out without any restriction on the computation time and required over 100 hours to process each hour of data. Even though it is usually assumed that processing time is not a major issue since computer processing power increase continuously, 2 it is also known that the amount of data appearing on information channels is increasing at a close rate. Therefore processing time is an important factor in making a speech transcription system viable for audio data mining. Transcribing "found" data requires significantly higher processing power than what is needed to transcribed read speech data by speaker adapted dictation systems. This is due to the lack of control of the recordings and linguistic content, which on average results in lower SNR ratios, a poorer fit of the acoustic and language models to the data, and as a consequence a need for larger models. Processing time constraints significantly change the way we select our models. For each operating point, the right balance between model complexity and search pruning level must be found. Two fast systems were optimized for decoding at 10 and 1.4 times real-time (RT), including audio par- titioning. On the eval'98 data set the word error rates are 14.2% for the 10xRT system and 24.7% for the 1.4xRT on a Compaq XP1000 500MHz machine. Figure 4 shows an example portion of an SGML file created from the automatically generated word transcription, taking into account the information available from the partitioning process. Each audio segment starts with a !segment? tag with its start and end times as well as labels for the signal type, gender and speaker. The word transcription is given, with an illustration of the word time codes. Although not shown, a word level confidence score can optionally be associated with each word. The French and German transcription systems have been evaluated on about 1.5 hours of data. The French data come from television news shows (ARTE) and radio station (France Inter). The German data consist of TV news and documentaries from ARTE. The average word error on the French data is under 20%. The average word error on the German news data is about 20%, and lower than the error on documentaries which is closer to 35%. This difference can be partially 2 It is common practice to develop systems that run in 100 times real-time or more, especially to evaluate the absolute quality of the acoustic and language models. Audio Partitioning and Transcription for Broadcast Data Indexation 13 !audiofile filename=CSPAN-WJ-960917 language=English? !segment type=wideband gender=female spkr=5 stime=81.6 etime=84.2? do you know if that mr. nader's on the ballot in florida !segment type=telephone gender=male spkr=1 stime=84.72 etime=86.09? !wtime stime=84.72 etime=84.97? i !wtime stime=84.97 etime=85.22? don't !wtime stime=85.22 etime=85.47? know !wtime stime=85.47 etime=85.63? i'm !wtime stime=85.63 etime=86.09? sorry !segment type=wideband gender=female spkr=5 stime=86.09 etime=87.59? !wtime stime=86.09 etime=86.21? if !wtime stime=86.21 etime=86.41? he !wtime stime=86.41 etime=86.67? is !wtime stime=86.67 etime=86.79? will !wtime stime=86.79 etime=86.94? you !wtime stime=86.94 etime=87.16? vote !wtime stime=87.16 etime=87.32? for !wtime stime=87.32 etime=87.59? him !segment type=telephone gender=male spkr=1 stime=87.59 etime=106.22? would if it . Figure 4. Example SGML format for the system output. For each segment the signal type, gender and speaker labels, and start and end times are given, as well as the word transcription. For simplicity not all time codes are shown. attributed to the better language model representivity for the news data. 4.2. Experiments with Spoken Document Retrieval One of the main motivations for automatic processing of the audio channels of broadcast data is to serve as a basis for automatic disclosure and indexation for information retrieval (IR) purposes. The aim of the 14 Gauvain Lamel Adda Olive project 3 was to develop an archiving and retrieval system for broadcast data to enable efficient access to large multimedia libraries, such as the French INA audio-visual archive [13]. Disclosure of video material plays an important role for the user organizations, but is too costly to carry out manually for all broadcast data. As a result, the vast majority of data is archived with only minimal annotations. The audio stream is automatically partitioned and the speech segments transcribed and time-coded using the methods described above. The transcription is used to generate an index which is linked to the appropriate portions of the audio or video data. Olive also developed tools for users to query the database, as well as cross-lingual access based on off-line machine translation of the archived documents, and online query translation. We have assessed the performance in spoken document retrieval (SDR) on 600 hours of audio data (100 hours from TREC-7 SDR'98 and 500 hours from TREC-8 SDR'98). Although for IR purposes the story boundaries are assumed to be known, this information is not used by the speech recognizer. Most of the development work was carried out using the SDR'98 test data (100h), consisting of about 2800 documents with the associated 23 queries. The SDR'99 test data (500h) consists of 21750 documents with an associated set of 50 queries. It should be noted that the reference transcripts of the SDR'98 data are detailed manual transcriptions, whereas for the SDR'99 data these are closed captions. In order for the same IR system to be applied to different text data types (automatic transcriptions, closed captions, additional texts from newspapers or newswires), all of the documents were preprocessed in a homogeneous manner. This preprocessing, or tokenization, is the same as the text source preparation for training the speech recognizer language models [7], and attempts to transform them to be closer to the observed American speaking style. The basic operations include translating numbers and sums into words, removing all the punctuation symbols, removing case distinctions and detecting acronyms and 3 The LE4-8364 Olive project (http://twentyone.tpd.tno.nl/olive) was funded by the European Commission under the Telematics Application Programme in the sector Language Engineering. Audio Partitioning and Transcription for Broadcast Data Indexation 15 spelled names. However removing all punctuations implies that certain hyphenated words such as anti-communist , non-profit are rewritten as anti communist and non profit . While this offers advantages for speech recognition, it can lead to IR errors. To avoid IR problems due to this transformation, the output of the tokenizer (and recognizer) is checked for common prefixes, in order to rewrite a sequence of words as a single word. The prefixes that are handled include anti , co, bi , counter . A set of rewrite rules covering compound words formed with these prefixes and a limited number of named entities (such as Los-Angeles) is used to transform the texts. Similarly all numbers less than one hundred are treated as a single entity (such as twenty-seven). In order to reduce the number of lexical items for a given word sense, each word is mapped to its stem (as defined in [2, 16]) or, more generally, into a form that is chosen as being representative of its semantic family. The text of the query may or may not include the index terms associated with relevant documents. One way to cope with this problem is to do query expansion based on terms present in retrieved documents on the same (Blind Relevance Feedback) or other (Parallel Blind Relevance data collections [19]. We combined the two approaches in our system. For the latter 6 months of commercially available broadcast news transcripts from the period of June through December 1997 [1] were used. This corpus contains 50 000 stories and 49.5 M words. For a given query, the terms found in the top 15 documents from the baseline search are ranked by their offer weight [18], and the top 10 terms are added to the query. Since only the terms with best offer weights are kept, the terms are filtered using a stop list of 144 common words, in order to increase the likelihood that the resulting terms are relevant. The information retrieval system relies on a unigram model per story. The score of a story is obtained by summing the query term weights which are the log probabilities of the terms given the story model once interpolated with a general English model. This term weighting has been shown to perform as well as the popular TF\LambdaIDF weighting scheme [12, 15]. Table III gives the IR results in terms of mean average precision (MAP), as is done for the TREC benchmarks. Four experimental con- figurations are reported: baseline search (base), query expansion using blind relevance feedback (BRF), query expansion with parallel blind relevance feedback (PBRF) and query expansion using both BRF and PBRF. The results clearly demonstrate the interest of using both BRF and PBRF expansion techniques, as consistent improvements are obtained over the baseline system for the two conditions (R1 and S1). Average precisions of 57% and 54% respectively were obtained on the SDR'98 and SDR'99 test sets using the automatic transcriptions. These values are quite close to the average precisions obtained on manual transcripts, even though the 10xRT recognizer transcripts have an estimated 20.5% word error rate. Using transcriptions generated with the system (word error rate of about 32%), the baseline MAP is 41% and the MAP with query expansion is 49% for the SDR'99 test conditions. Table III. Mean average precision (%) for the SDR'98 and data sets using unigram term weightings. R1: reference transcript. S1: automatic speech transcription obtained with a 10xRT system. dataset base BRF PBRF BRF+PBRF 98-S1 45.58 51.21 58.84 57.45 99-S1 44.12 53.02 49.43 53.98 5. Conclusions In this paper we have presented our recent research in partitioning and transcribing television and radio broadcasts. These are necessary steps to enable automated processing of the vast amounts of audio and video data produced on a daily basis. The data partitioning algorithm makes use of Gaussian mixture models and an iterative segmentation and Audio Partitioning and Transcription for Broadcast Data Indexation 17 clustering procedure. The resulting segments are labeled according to gender and bandwidth using 64-component GMMs. The speech detection frame error is less than 4%, and gender identification has a frame error of 1%. Many of the errors occur at the boundary between seg- ments, and can involve silence segments which can be considered as with speech or non-speech without influencing transcription performance. Word recognition is carried out in multiple passes for each speech segment progressively using more accurate models. The generation of word graphs with adapted acoustic models is essential for obtaining word graphs with low word error rates, particularly in light of the variety of talkers and acoustic conditions. On unrestricted American English broadcast news shows the word error rate is about 20%. Due to the availability of large, transcribed corpora available through the LDC our initial work focused on American English, however, in the context of the LE4 Olive project the transcription system system has been sucessfully ported to the French and German languages with word error rates under 20% for news shows. Our experience is that radio news shows are usually easier to transcribe than television news shows, probably due to the fact that only the audio channel is used to transmit the information, whereas for television the audio stream is supported by visual data. Broadcast news data is also easier to transcribe than documentaries. A complete indexing system has been built by applying text IR techniques on the output of our broadcast news speech recognizer. Quite comparable average precisions were obtained on manual and reference transcriptions (which for the SDR'99 data were closed captions), indicating that the transcription quality is not the limiting factor on performance for current IR techniques. Some existing applications that could greatly benefit from this technology are the creation and access to digital multimedia libraries (dis- closure of the information content and content-based indexation), media monitoring services (selective dissemination of information based on automatic detection of topics of interest) as well as new emerging applications such as news-on-demand and Internet watch services. Acknowledgements This work has been partially financed by the European Commission and the French Ministry of Defense. The authors gratefully acknowledge the participation Martine Adda-Decker in the development of the recognition systems and of Mich'ele Jardino, Yannick de Kercadio, R'emi Lejeune and Patrick Paroubek to the SDR work. --R Environment and Channel Change Detection and Clustering via the Bayesian Information Criterion. Design and Preparation of the The TREC Spoken Document Retrieval Track: A Success Story. Maximum a Posteriori Estimation for Multivariate Gaussain Mixture Observation of Markov Chains. The LIMSI Nov93 WSJ System. The LIMSI Nov96 Hub4 System. The LIMSI Segment Generation and Clustering in the HTK Broadcast News Transcription Sys- Audio Partitioning and Transcription for Broadcast Data Indexation 19 tem Olive: Speech Based Video Retrieval. Maximum likelihood linear regression for speaker adaptation of continuous density hidden Markov models. BBN at TREC7: Using Hidden Markov Models for Information Retrieval An Algorithm for Suffix Stripping. Automatic Segmentation A probabilistic model of information retrieval: development and status. Improving subject retrieval in online catalogues: 2. --TR --CTR Alexander Haubold , John R. Kender, Augmented segmentation and visualization for presentation videos, Proceedings of the 13th annual ACM international conference on Multimedia, November 06-11, 2005, Hilton, Singapore
audio segmentation;speech recognition;audio indexation
597208
Determination Based on Video and Audio Features.
Determining automatically what constitutes a scene in a video is a challenging task, particularly since there is no precise definition of the term scene. It is left to the individual to set attributes shared by consecutive shots which group them into scenes. Certain basic attributes such as dialogs, settings and continuing sounds are consistent indicators. We have therefore developed a scheme for identifying scenes which clusters shots according to detected dialogs, settings and similar audio. Results from experiments show automatic identification of these types of scenes to be reliable.
Introduction Depending on their length, shots are either the letters or words of video productions. Hence, they contain little semantic information: information in the image track can often be reduced to a simple keyframe or panorama [25], while in the audio track it is usually either incomplete (like a part of a dialog) or very limited (like a cry). In order to partition a video into semantically richer entities, shots must be grouped together based on content. This procedure is often denoted as shot clustering 2 . In general, shot clustering can be performed more easily when restricted to a certain type of film genre. For exam- ple, clustering shots in newscasts often boils down to finding anchor shots [17][19][30]. News stories (or scenes) are then determined by grouping all shots in between two anchor shots including the first anchor shot. However, we did not restrict our shot clustering work to a specific film genre. Preferring as universally applicable an approach as possible, our work focuses on shot clustering in a genre-independent fashion. The ultimate goal is to automatically determine shot clusters which a human would judge as "scenes". A scene is "usually composed of a small number of interrelated shots that are unified by location or dramatic incident"[4]. In the literature these are also called "video paragraphs" [9], "story segments"[25] or "story units"[6]. Unfortunately, the clustering of shots into "scenes" depends on subjective judgements of semantic correlation analogous to the "clustering" of (text) sentences into paragraphs. At school simple rules for forming paragraphs might be "No longer than about 7 lines" or "Describe just one idea". Despite these general rules a text given to different people will yield different paragraphs. The same is true for video scenes. Experiments, however, showed that some basic units are clustered by all viewers: contiguous shots of the same setting, dialogs and shot sequences combined by audio such as continuing music background. In this paper, we present our algorithms for automatic determination of scenes. We begin with a discussion of related work in Section 2. Section 3 gives an overview of our own system. The automatic determination of shots is addressed in Section 4. This Section is kept short because it concerns a rather well-examined subject. The clustering of shots depends on the attribute which stands in the foreground. Each attribute is calculated via one or more content features which are deemed important for representing the attribute: audio content is described in Section 5.1, face and dialog determination in Section 5.2 and like setting information based on color and orientation hints in Section 5.3. All of these features yield a normalized table of distances between the shots of a video, which is exploited for clustering in Section 6. We present experimental results for the algorithms in Section 7 prior to concluding the paper with a discussion about further research in this area. 1.This research was mainly performed while the author was at University of Mannheim, Praktische Informatik IV, 68131 Mannheim, Germany 2.This term is actually a misnomer since clustering of contiguous shots is only one aspect of shot clustering ably. Thus, frames being part of a dissolve or fade are removed from the shots. 5 Feature Calculation 5.1 "Audio Sequence" Determination Great semantic changes in videos occurs usually occur in conjunction with profound changes in the audio track. Therefore we define an "audio sequence" to be a sequence of shots in which very similar audio signal sequences recur. Examples include music continuing over several shots, ongoing dialog or ongoing noise like the cheering of a crowd. We define two types of audio sounds, each of which is handled differently: background and foreground. Background sounds in a video give a general feeling of the atmosphere of a scene. They do not carry information necessary to an understanding of the film story - otherwise they would be in the foreground such that the audience could easily hear and understand them. However, background sounds are just as dynamic as foreground sounds. Treated in the same manner as foreground sounds they cause many audio sequence endpoints that are not intended as they are of no interest. Therefore, the first step in determining audio sequences is to determine time periods containing exclusively background sounds. We call such periods "background segments". Background segments are disregarded during the further processing. Only foreground segments are analyzed further for their spectral content. Great changes are being registered as "audio cuts". During their calculation, a characteristic vector is calculated for each time period between two audio cuts. These time periods are called "audio shots". The vectors are then used to calculate the table of distances between (video) shots. Sequential (video) shots whose audio shots differ greatly belong to different audio sequences and must therefore be assigned a large distance value. Profound changes in the audio track may also occur within shots, an example would be explosions. Such changes are not a problem and do not disturb the measure for two reasons. First, other audio shots are usually also part of the same (video) shot and enter the distance measure giving a small distance. Second, several sequential (video) shots are compared for their similarity so that the odd one out does not disturb the big picture. 5.1.1 Features AUDIO BACKGROUND. Whenever sounds in a video are meant to be in the background, their loudness is reduced substantially. Therefore, background segments can be determined via a loudness threshold. Our implementation first calculates a perception-based loudness measure from the amplitude values of the audio track of a video[22]. Then, we determine the maximum loudness value . It is used to calibrate the digitization level of the sound file. A percentage of this maximum loudness value gives the loudness threshold value . This percentage is critical to the analysis, but an automatic determination is difficult. We have used values between 0.05 and 0.5 for . The percentage depends on the average loudness level of the movie. If there are great amounts of quietly spoken speech, then we have to choose a very low level in order not to declare this speech as background. The audio file is analyzed in windows of size which are advanced in steps of size . Windows which do not contain loudness values above the threshold are considered background windows. The size of is dependent on the desired minimaum resolution of background segments: selection of a small window might mean detecting small breaks between words as background segments, selecting a big window, the skiping of small but important background segments between scenes. We found good choices for between 50 and 250 ms with close to the same value. An alternative method of determining background segments would be to calculate signal power on the analysis windows. This measure works similar to the loudness measure except that we calculate signal power on the windows and perform thresholding on the calculated power values. We experimented with it but it did not work as well as the loudness thresholding. Signal power does not seem to be a good feature to describe background segments. AUDIO CUTS. Audio cuts are time instances which delimit time periods with similar sound. Hereto, a sliding Hamming window of size 100 ms is used to calculate the Fourier transform. Then the complex Fourier coefficients are converted into real values by calculation of decibels. The resulting real-valued feature vector for each window is called an audio feature vector . represents the distribution of the intensities of the frequencies within window l The term "shot clustering" denotes two fundamentally different kinds of shot grouping: The first kind aims at finding groups of similar shots from within the entire video without any thought of temporal order (see e.g. [2][14][31]). Useful similarity measures were considered in detail in [16]. Our approach in this paper belongs to the second type of shot clustering: grouping contiguous shots according to their semantic correlation. Much work has been published on this type of shot clustering via video analysis features. Yeo and Yeung have proposed a scheme to recover story units from video using time-constrained clustering [26][27][28]. The basic idea is to assign the same label to shots that are similar and then analyze the patterns of the resultant strings. Three different kinds of temporal events are extracted from those label patterns: dialog, action, and story unit. Each event can be regarded as a scene in the video. Yeo and Yeung use color histograms as the measure of similarity. They never compare their computed scenes against handmade scenes. Aoki, Shimotsuji, and Hori used labelled keyframes to represent the content of shots and to cluster them [1]. In general, keyframe-based systems suffer from their ignorance of the dynamic aspects of shots such as the duration of events/actions and the time they take place in the shot (for example, the appearance of a new actor at the end of a shot). There are only few approaches that determine scenes based on "audio" analysis. Confusingly, they do not use the digitized audio as their basis, but the written transcript or the closed captions [14][19]. In many cases a transcript or closed captions are either not available or do not exist, as for home videos. In order to make our approach as general as possible we do not use this information. Therefore, our work concentrates on the more ambitious task of analyzing the digitized audio directly. An idea very similar to our approach for audio sequence determination has been presented by Saraceno and Leonardi [24]. They segment and classify the audio track of videos into silence, speech, music and noise segments, using the segments to support the detection of shot boundaries. On top of the information calculated hereby, they proposed to merge shots into scenes, but - to our knowledge - never implemented or tested their proposal. The Informedia TM project combines audio and image analysis in order to determine scenes [9]. They determine so-called audio paragraphs based on the analysis of the audio-aligned transcript and match these paragraphs to the nearest shot boundaries to determine video paragraphs. Video paragraphs are defined as a collection of shots adhering to the same context. Our approach also employs both: audio and video information, although in a different manner. It surpasses the Informedia TM approach in that it also uses setting and dialog information for scene determination. 3 System Overview Our system proceeds in several steps as follows: In a first step, the shots are recovered from the video. They are the atomic units of our clustering system. Then the values for each semantic feature are calculated. Currently we determine audio features, color features, orientation features and faces appearing in the shots, as they are important for the types of scenes we want to determine. The system can be extended at any time by additional features. Next, we determine the distances between shots with respect to each feature. We do not integrate the different features into one distance measure for three reasons. Firstly, it is not possible to determine a fair integrated distance measure for the different features. Some features may be more important than others, but at this stage, it is not possible to say which are and which are not. Secondly, an integrated distance measure would destroy the semantic message of each individual feature. It is easy to separately judge the correctness of clusters based on each single feature, but nearly impossible if they are combined. Thirdly, the semantics of different features may conflict with each other. For instance, a continuous audio track is often used to move smoothly from one setting to another. Thus, the shot clustering results of the respective features are contradictory. Finally, based on the calculated shot distance tables, we are able to merge shots for each feature separately but by means of a single algorithm. 4 Determination of Shots Shots are defined as "one uninterrupted image with a single static or mobile framing" [7]. Many algorithms have been proposed for shot boundary detection (see [29] and the references therein), however, only few try to determine the type and extent of edits precisely. Algorithms that are able to detect, classify and determine the extent of hard cuts, fades, and dissolves have been proposed in [14]. We use them here since it is necessary to eliminate all editing effects which concatenate shots. Edits may bias the similarity measure between contiguous shots unfavor- t. The window is advanced by about 3/4 of the total window size to calculate the next audio feature vector. A forecasting vector is calculated by exponential smoothing forecasting, i.e by where is called the smoothing constant (here set to 0.2) and is the audio feature vector of the very first window . The forecast is the weighted sum of the last observation and the previous forecast. The forecasting vector therefore contains values similar to previous vector values. It represents the distribution of the intensities of the frequencies of all previous windows and therefore constitutes a template for the regarded audio shot. The speed at which the forecasting vector adapts to new feature values is controlled by the smoothing constant. The decision about an audio cut is based on the difference between a new feature vector and the forecasting vec- tor. The difference is calculated via the Euclidean distance. We have two difference thresholds: a high threshold which directly determines a cut (because there was a significant difference) and a lower threshold which determines similarity (i.e. the difference is only small). If too many consecutive feature vectors are classified as similar, we also deduce a cut. After a cut, calculation of the forecasting vector starts again with . Audio cuts determine audio shots, whose spectral content is represented by their last forecasting vector. Such a vector is also calculated on background segments. Normalized versions of these vectors are used in the calculation of the distance table. Thus, the background and audio cut algorithms result in a table of audio shots which are described by the vector , where specifies the frame sequence covered by the audio shot , , and is a vector of real values between which signifies the audio content of the audio shot. The normalization to is performed as a calibration in order to get values that are independent of loudness influences, and in order to produce distance values between when comparing two audio shots. 5.1.2 Calculation of Distance Table A table of distances between (video) shots is calculated from the audio shots by comparing all spectral content vectors of each shot based on the normalized Euclidean distance metric. The closest vectors define the dis- tance. It is interesting to note that if an audio shot overlaps two consecutive shots, their distance will be 0 because it has been calculated on the same spectral content vector. 5.2 Dialog Determination A special scene type is a dialog. The form in which dialogs are presented can differ. Some dialogs show the dialog partners in turn, one at a time, in a frontal view. This pattern is called the shot/reverse shot pattern. In other dia- logs, the dialog partners are all visible in the scene, typically from the side. Other dialog setups are possible. We concentrate on the very widely used shot/reverse shot pattern. To detect it, our shot grouping system must understand where the actors appear in the video. Therefore, we have implemented a face detection algorithm and a method of recognizing the face of the same actor across shot boundaries. 5.2.1 Feature: Frontal Face Detector One of the most reliable face detectors in digital images was developed by Rowley, Baluja, and Kanade [23]. Their system detects about 90% of all upright and frontal faces while hardly ever identifying non-faces as faces. We have recreated their neural-network-based frontal face classification system for arbitrary images (e.g. photos, newspapers, and single video frames) as a basis for our frontal face detector in video sequences. To widen the range of detectable faces, our detector also searches for slightly tilted/rotated faces ( degrees). This is necessary because the faces of the actors in motion pictures are always moving, in contrast to the faces in typical still images such as portraits and photographs of sports teams where they are usually depicted upright. However, this more general face search increases by a factor of three the number of patterns which have to be tested in each image. To speed up processing, the candidate frontal face locations are drastically reduced in an extremely fast pre-filtering step: Only locations whose pixel colors approximate human skin colors [11] and which show some structure (such as nose, mouth and eyes) in their local neighborhood are passed to the face detector. This pre-filter reduces the number of candidate face locations by 80%. Moreover, only every third frame of the video sequence is investigated. Each face detected is described by the vector . It specifies the frame , in which a face of size s (in pixels) was detected, as well as the x- and y-coordinates (x pos , y pos ) of its center and its angle of inclination . So far, each detected face is isolated and unrelated to other faces in the video. The next task is to classify frames { } AS k- with similar faces in order to find groups of frames showing the same actors. Such a group of related frames is called a face-based class. In a first step, faces within shots are related to each other according to the similarity of their position and size in neighboring frames, assuming that these features change only slightly from frame to frame. This is especially true for dialog scenes. In addition, we dispose of accidental mis-classifications by the face detector by discarding all face-based classes with fewer than three occurrences of a face, and by allowing up to two drop-outs in the face-tracking process. This simple grouping algorithm works very well within shots and is computationally cheap. It does not demand complex face recognition algorithms such as described in [13]. In a second step, face-based classes with similar faces within the same shot are merged by the Eigenface face recognition algorithm [21] in order to obtain the largest possible face-based classes. The same face recognition algorithm is used to identify and merge face-based classes of the same actor across shots throughout the video, resulting in so-called face-based sets. They describe where, when and in what size the actors appear in the video. However, the Eigenface face recognition algorithm cannot guarantee that all face groups of the same actors merge together. An actor's face varies too much throughout a video. Our grouping algorithm typically splits the main actors into a few distinguished face-based sets. 5.2.2 Dialog Detection It is easy to detect typical shot/reverse-shot dialogs and multi-person dialogs with the frontal face detector. A sequence of contiguous shots of a minimum length of three shots is denoted as a dialog if (1) at least one face-based class is present in each shot no further apart from its neighbor than 1 second and (2) the Eigenface-based shot-overlapping relations between face-based classes interlink shots by crossings. The length of the dialog is cut down to the first and last face-based set that has a shot-overlapping relation. An example of a detected dialog is shown in Figure 1. 5.3 Setting Determination A setting is defined as a locale where the action takes place. Often, it can be detected by the repetitive appearance of the same background in a constant illumination. This makes it possible to use color and structure information to determine a setting. 5.3.1 Features: CCV and Orientation CCV. Shots with very similar color content usually belong to a common setting because they share a common background. The color content changes more dramatically from setting to setting than within a single setting. Color content is usually measured by some sort of refined color histogram technique such as the color coherence vector (CCV)[20]. The CCV makes use of spatial coherence and discriminates much better than the basic color histogram. Instead of counting only the number of pixels of a certain color, the CCV additionally distinguishes between coherent and incoherent pixels within each color class j depending on the size of the color region to which they belong. If the region (i.e. the connected 8-neighbor component of that color) is larger than a threshold t ccv , a pixel is regarded as coherent, otherwise as incoherent. Thus, there are two values associated with each color . , the number of coherent pixels of color j and . , the number of incoherent pixels of color j. Then, the color coherence vector is defined as the vector normalized by the number of pixels. Two CCVs and are compared by Figure 1: A dialog and its shot-overlapping relation a j In experimental results this measure outperformd the Euclidean distance when retrieving images similar to a given image from a large database [20]. The distance values range from 0 to about . ORIENTATION. Orientation of structures in images is another feature that is suitable to characterize a scene to some extent. For instance, in pictures of city scenes with many buildings, one can expect many vertical edges. In a frontal view many horizontal lines are visible, too. In contrast, this type of orientation is much more unlikely in images of humans or natural scenes [8]. Thus, it may be reasonable to describe a picture by the orientation it con- tains. Moreover, orientation might be especially suitable to describe characteristics of background settings. The prototype of local orientation is defined as an image structure in which the gray or color values change only in exactly one direction, but remain static in the orthogonal direction. Orientation, however, does not distinguish between direction and . Consequently, it varies only between 0 and , unlike direction which ranges from 0 to [12]. The various algorithms to determine local orientation commonly operate on gray-scale images. Before computation it is useful to increase the global contrast in order to prevent structures from emerging inadequately in dark or bright images. The minimum and maximum gray-scale value, which occur with at least a certain significance (i.e. their frequency exceeds a threshold value), are determined by a gray-scale histogram and used to scale the pixels' gray-scale values to the full gray-scale range. The determination of orientation is carried out on such histogram- normalized images. We derived orientation via the inertia tensor [5][12]. It allows neighborhoods of constant gray values to be distinguished from neighborhoods with isotropic structures or local orientation. The following presentation is based on the approach in [5]. A detailed derivation can be found in [12]. Designating the gray-scale value of a pixel at the position (x, y) by I(x, y), the gradients along the x and y directions by and the Gaussian filter by G(x,y). The second momentum window matrix at position (x, y) is computed by with , . Let and , denote the eigen values of J(x,y). Then, the orientation of the eigen vector associated with can be determined by It measures the angle of orientation of the image structure around the location (x, y). The relation of the eigen values to each other can be used as a certainty measure of the estimated orientation. Three cases can be distinguished There is an orientation in direction . 2. : The gray-scale values change similarly in all directions, and thus, the structure is isotropic. 3. : The local environment has a constant gray-scale value. Only pixels with dominant local orientation are considered further. In addition to the question how local orientation can be determined, it is also important to find a suitable aggregated feature that captures the characteristics of local orientation in the entire image. A standard approach would be to summarize local orientation by an orientation histogram. Although histograms are robust against slight changes in camera view and local object motion, they have little discriminating power and are therefore not suitable for large video databases. A typical proposal to overcome this drawback is to divide an image into several rectangular regions or into a foreground and a background region for each of which a histogram is calculated. a j 1 a j- a j I x y G x y I T x y { } l 1 tan However, such approaches have to deal with the problems caused by important orientations which are close to the boundaries of regions and which result in accidental assignments to one or another region. We took another approach which captures the local orientation of an image independently of translations and small or middle scalings. Local orientation of an image is captured by an orientation correlogram. It is defined - like the color correlogram in [10] - as a table indexed by an orientation pair <i,j>. The kth entry of an orientation pair <i,j> specifies the probability that within a distance of k of an orientation i the orientation j can be found in the image. Thus, the orientation correlogram describes how the spatial correlation of orientation pairs changes with distance. As a feature it is more robust than the detailed raw orientation image while avoiding the poor discriminating power of highly aggregated features such as histograms of local orientation. In defining orientation correlograms, the orientation is discretized in n classes : , . Using d different distances the space requirements come out as . In the experiments, we chose . The distance between two orientation correlograms is measured based on the probability of the components by 5.3.2 Calculation of Distance Tables The distance between two shots with respect to their color or orientation content is measured based on the disaggregated set representation of the shots, using the minimum distance between the most common feature values (see [16] for more details), i.e. each shots is described by the set of features values derived from each of its frames and compared with by . 6 Scene Determination The question now is how to use the distance matrix to determine scenes. Two issues arise. Firstly, although scenes are defined by a common feature this does not imply that the feature has to be present in each shot of the scene. In many cases a set of feature values describes a scene which cannot be presented in each shot. One example of this is the setting. The three-dimensional space is usually introduced by shots from different perspectives. Thus, one must look not only at neighboring shots but also several shots ahead. Secondly, it is easy for humans to judge whether two shots are similar with respect to some feature, however, our algorithm requires a decision function. We considered two possible decision functions: (1) Absolute thresholding or (2) Adaptive thresholding. There are two possibilities for adaptive thresholding: choose the threshold based either on the distance matrix of the video by specifying the number of scenes or based on the distance values in a temporal neighborhood. How- ever, it is not clear how the temporal neighborhood should influence the threshold. Higher distance values could either mean that distances between the shots in the scene are greater in that part of the movie, such that adaptation of the threshold would be correct. But it could also mean that the story in this part of the movie is developing very rapidly, so the shots have nothing in common. An example are different short views of different landscapes implying that the actors undertook a long journey. If the like setting determination would adapt the threshold, it would reduce its threshold and thereafter group settings which are dissimilar. We tested each clustering scheme, and absolute thresholding worked best. For the two movies which we analyzed, we determined optimal absolut thresholds automatically. Refer to the experimental results for details. For the loo- kahead, we have chosen a value of 3 shots. Our scene determination algorithm works as follows: A shot cluster comprises all shots between two shots which are no further apart than the lookahead and their distance is below the threshold. Overlapping shot clusters are grouped into scenes. { } O { } I 1 I 2 Orientation dist S 7 Experimental Results 7.1 Setup The proposed individual shot clustering algorithms and their combination have been implemented in C++. Experiments were performed on a video database consisting of two full-length feature films: "Groundhog Day" and "Forrest Gump". The former was digitized in motion JPEG from German TV at a resolution of 360x270 and a compression rate of 1:15, while the latter was extracted as an MPEG-1 video from a CD-I. For the audio tracks, a sampling rate of 8000 Hz, mono, coded in 8 bit -law was sufficient because most of the audio content is present in the frequency bands below 4000 Hz. For each feature film we calculated the features and performed the shot clustering, as described above. 7.2 Methodology The task of shot clustering or scene determination can be formulated either as the task of finding the scenes or of eliminating shot boundaries. Both formulations - in the result - are equivalent to each other. Here, in the experimental results section it is more convenient to use the shot boundary elimination view. In order to judge the results of our clustering algorithms, we determined "by hand" for each feature the ground truth telling which shots belong together and which do not. We stored a "1" for a shot boundary in the reference track, if the two associated shots belong to the same scene and a "0" otherwise. The reference track was constructed jointly by the authors after intensive discussion at some critical points. The performance of the different features for shot clustering is measured by three basic numbers. For their definition we use the term "scene boundary" as a place holder for dialog, audio sequence and setting boundaries: . hit rate The hit rate h specifies the percentage of correctly detected scene boundaries in relation to their actual number. . miss rate m: The miss rate m determines the percentage of missed scene boundaries in relation to their actual number, i.e. 1.0 - h . false hit rate f:The false rate f gives the percentage of falsely detected scene boundaries in relation to their actual number. The hit and false hit rates of the three shot clustering algorithms are influenced by their respective parameters. In general, if the change of a parameter increases the hit rate, the false hit rate also increases. Thus, it is difficult to define optimal parameters. There is always a trade-off between hit rate and false hit rate. In Section 7.3, we will show how the performance changes with the parameters. A visualization of the performance of the different shot clustering algorithms gives a more intuitive overview of their quality than do quantitative data. We therefore constructed a tool which compares the detected clusters with the manually produced reference clusters. Figure 2 shows the results for the beginning of "Groundhog Day" for the audio setting. Each rectangle specifies a shot with its specific length. Each row shows the shots which have been clustered manually into a scene by humans with respect to the chosen semantic feature. No gap between two shots signifies clustering by our algorithm. If two automatically clustered shots overflow a manual cluster end, an arrow is painted. Analogous to the evaluation of performance of image or text databases tens of thousands of shots and scenes are needed to evaluate the performance of any video comparison algorithms reliably. Unfortunately, building up such a large video database and determining the ground truth presently exceeds the possibilities of our multimedia lab. Thus we had to restrict our experiments to a much smaller database. 7.3 Results 7.3.1 Quality of Audio Sequence Determination At first, we performed some tests on the distance table in order to determine the optimum distance threshold for the clustering algorithm. This lead us to a threshold of 0.087 for "Groundhog Day" (see Figure 3). This value was also set for the analysis of "Forrest Gump". With this threshold, we compared the resulting audio sequences with the manually determined ones. The resulting hit, miss and false hit rates are shown in Table 1. The first column in the table specifies the number of (automatically detected) shot boundaries. The second column gives the number of boundaries which were clustered manually in the reference database. The three following columns give the performance as described above. For "Groundhog Day", the hit rate was 81% at a false hit rate of 17%. We found 47 (unconnected) audio Movie # shots #sequences #hits / hit rate # missed hits / miss rate # false hits / false hit rate Groundhog Day 713 586 474 / 81% 112 / 19% 99 / 17% Forrest Gump 918 809 530 / 66% 279 / 34% Table 1: Performance of the audio setting determination Figure 2: Interface of the performance visualization tool1030507090 Audio Feature hit rate false rate miss rate Figure 3: Performance of the audio setting determination in dependence on the absolute threshold sequences, which calculates to 94 semantic units based on audio sequences if intermediate shots are integrated into one semantic unit. This implies a reduction of the number of shots by 87%. For "Forrest Gump", the hit rate was 66% for a suboptimal parameter setting at a false hit rate of 7%. We get 76 unconnected audio sequences implying a reduction in semantic units by 83%. A qualitative assessment via the performance visualization tool and the scene overview shows that audio sequences which are based on continuing music do not necessarily imply a scene boundary. Often, music in movies is used in transitions from one scene to the next in order to facilitate an emotional change or to intensify an existing mood [3]. The audio sequence operator then deletes a shot limit which may be fundamentally important as a semantic break. However this does not happen often, because such music is often accompanied by a soft edit such as a dissolve or a fade causing the audio sequence boundary to fall within the following shot. Difficult to determine are audio sequences based on speech. Speech is very dynamic in its general structure as it is often interrupted by short breaks and its spectral composition changes very quickly. Semantic examination of the audio stream by determination of music, speech and noise parts, similar to [18], can overcome this difficulty. 7.3.2 Quality of Video Setting Determination Again, we first performed some tests on "Groundhog Day" in order to obtain an optimal choice of the distance threshold for the clustering algorithm on the distance table (see Figure 4 (a) and (b)). This process led us to a threshold of 0.025 for orientation and 0.10 for color. At this threshold, the hit rate for settings was 82%, and 76% for orientation and color, respectively, at false hit rates of 15% and 10%. We found 28 (unconnected) like settings via orientation and 52 via color. For "Forrest Gump", the same thresholds were used, leading to hit rates of 90% and 58% at false hit rates of 10% respectively 42%. We found 75 like settings via orientation and 82 via color (see Table 2 and Table 3). Qualitatively speaking, is seems that the settings are either determined with a high precision by the algorithm - and this is the general case - or are completely screwed up. Movie # shots # settings #hits / hit rate # missed hits / miss rate # false hits / false rate Groundhog Day 713 580 475 / 82% 105 / 18% 90 / 15% Forrest Gump 918 680 613 / 90% 67 / 10% 195 / 28% Table 2: Performance of the setting determination with orientation Movie # shots # settings #hits / hit rate # missed hits / miss rate # false hits / false rate Groundhog Day 713 580 438 / 76% 142 / 24% 56 / 10% Forrest Gump 918 680 391 / 58% 289 / 42% 69 / 10% Table 3: Performance of the setting determination with color1030507090 hit rate false rate miss rate Figure 4: Performance of the setting determination by (a) CCV or (b) orientation in dependence of the absolute threshold1030507090 Orientation hit rate false rate miss rate (a) (b) 7.3.3 Quality of Dialog Determination Unlike the other features, the dialog detection requires no additional parameter since the feature detector already made that binary decision. The hit rate for shot/reverse shots dialogs was 35% and 60%, respectively. The false hit rates were about 5% and 118%. 7.3.4 Quality of Scene Determination We also combined the scenes of the dialog detection, setting detections and audio sequence to construct even better setting scenes. The algorithm proceeds by combining the determined clusters into clusters of maximum size. Whenever two clusters overlap, they form one bigger cluster. Then, all scenes were split up if two shots were combined by a fade since fades always separate scenes. Finally, the "gaps" in between clusters were merged into scenes of their own. This scene merge procedure resulted in 35 scenes for "Groundhog Day" and in 83 scenes for "Forrest Gump". The percentages of shot boundaries which our algorithms have correctly found to be mid-scene ones is quite impressive: 96% and 92% (see Table 5). This means, that we have deleted most of the mid-scene boundaries which a human would also delete. However, we have also deleted 18% respectively 11% more. 8 Conclusion and Outlook We have presented four features which allow shots to be clustered into audio sequences, settings and dialogs. Each scene type provides important information about the structure of a video. We measured the performance of our shot clustering approach against the ground truth manually created by the authors. The hit rate ranged from 35% to 90% at false hit rates between 5% to 118% for the two feature films "Groundhog Day" and "Forrest Gump". To our knowledge, this is the first time that the performance of a shot clustering algorithm was evaluated against a ground truth. In general, the performance depends mainly on the feature and much less on the type of clustering algorithm employed. The better a feature or a feature set captures the semantics of certain kinds of scenes, the more correct are the constructed scenes. Thus, in the future we will try to improve the features which capture audio setting, the setting in general and the dialogs. Moreover, we are working on using the distance tables to construct a hierarchical video representation, which would lead to an intuitive video table of contents (VToc) by finding acts, scenes, and shots. Browsing, abstracting and video annotation applications could benefit from such an automatically generated VToc . --R A shot classification method of selecting effective key-frames for video browsing Directing Television and Film. Dictionary of Film Terms. Recognition of Images in Large Databases Using a Learning Framework. Video Query: Research directions. Film Art: An Introduction. "at a Glance" Image Indexing Using Color Correlograms. Locating and tracking of human faces with neural networks. Digital Image Processing. Face Recognition: A Convolutional Neural Network Approach. VISION: A digital video library. Methods of Content Analysis Towards a Visual Grep: A systematic analysis of various methods to compare video sequences. An Automatic News Video Parsing Enhanced Video Handling based on Audio Analysis. Broadcast News Navigation Using Story Segmentation. Comparing Images Using Color Coherence Vectors. The importance of perceptive adaptation of sound features for audio content processing. Human face recognition in visual scenes. Audio as a Support to Scene Change Detection and Characterization of Video Sequences. PanoramaExcerpts: Extracting and Packing Panoramas for Video Browsing. Video Browsing using Clustering and Scene Transitions on Compressed Sequences. Video Content Characterization and Compaction for Digital Library Applications. A Feature-Based Algorithm for Detecting and Classifying Scene Breaks Automatic Parsing and Indexing of News Video. Clustering Methods for Video Browsing and Annotation. --TR --CTR Wen Wen Hsieh , Arbee L.P. Chen, Constructing a bowling information system with video content analysis, Proceedings of the 1st ACM international workshop on Multimedia databases, November 07-07, 2003, New Orleans, LA, USA Wen Wen Hsieh , Arbee L. Chen, Constructing a Bowling Information System with Video Content Analysis, Multimedia Tools and Applications, v.26 n.2, p.207-220, June 2005 Cees G. M. Snoek , Marcel Worring, Multimodal Video Indexing: A Review of the State-of-the-art, Multimedia Tools and Applications, v.25 n.1, p.5-35, January 2005
shot clustering;content-based video analysis;audio-based video analysis;scene detection;dialog detection
597241
Heterogeneous CPU Services Using Differentiated Admission Control.
We present an adaptive rate-controlled scheduler for heterogeneous applications running on general purpose computers. Our scheduler can effectively support diverse application requirements. It employs uniform rate-based sharing. Application heterogeneity is satisfied by partitioning CPU capacity into service classes, each with a different criterion for admission control. As a result, we are able to provide at once guaranteed performance, flexible allocation of rates with excellent scalability and intermediate service classes offering tradeoffs between reserved rate utilization and the strength of guarantees. Our scheduler has been implemented in Solaris 2.5.1. It runs existing applications without modifications. We present experimental results showing the scalability, efficiency, guaranteed performance, and overload performance aspects of our scheduler. We demonstrate the importance of priority inheritance implemented in our scheduler for stable system performance.
Introduction Emerging continuous media (CM) applications have well defined quality of service (QoS) constraints. These applications have stringent resource requirements and can benefit from non-interference. It is not possible to run them in a closed or embedded system environment [11]. Instead, many will continue to run on general purpose machines, where applications of diverse characteristics run concurrently. QoS requirements of applications in an open and general purpose computing environment requires further research. Appropriate admission control and scheduling policies must be investigated to avoid long term resource overload, and to provide forms of progress guarantees. The resources should be carefully scheduled. CPU time is one bottleneck resource, if we consider the processor requirements of applications like software media codes. We have designed and implemented a CPU scheduling framework that conforms to the following service objectives 1. CPU scheduling should satisfy diverse classes of application requirements. At one extreme, there are applications with stringent progress constraints, for which missed deadlines can significantly degrade their perceived quality. Audio processing in a tele-conferencing system is an example. At the other extreme, there are best-effort applications that have no specific real-time properties, but for which some non-zero progress rate is desired. For flexibility, some form of proportional sharing of CPU time among these applications can be provided. Network file transfers and email processing belong to this type of applications. Between the two extremes, there are applications that have well defined QoS requirements, but can tolerate periods of system overload by graceful D. Yau was supported in part by the National Science Foundation under grant numbers EIA-9806741 and CCR-9875742 (CAREER); B. Bhargava was supported in part by the National Science Foundation under grant numbers CCR-9901712 and CCR-0001788, and in part by CERIAS. An earlier version of this paper appears in Proc. IEEE International Conference on Multimedia Computing and Systems, Florence, Italy, June 1999 [22]. load shedding. Video playback is an example. When the system is busy, some users of video applications may be happy to settle for a lower frame rate, as long as the video maintains good continuity. 2. CPU scheduling should provide suitable firewall protection among service classes, as well as among threads within the same service class, the progress guarantees given to a service class or thread are independent of how other service classes or threads make scheduling requests. The applications with stringent QoS requirements must be protected from each other, and from applications in other service classes. The class of best-effort applications should be protected from other more "demanding" service classes, so as to ensure an acceptable level of progress rate. It is counter-productive, however, to have strong firewall protection between best-effort applications themselves. For system scalability, we do not want CPU scheduling to be the limiting factor in how many best-effort applications can be admitted by the system. This implies that actual progress rates of existing best-effort applications will become lower as more such applications join the system, and become higher as some such applications leave the system. 3. Certain service classes will require CPU reservations to prevent long term system overload. Since the actual resource requirement of an application may not be known, apriori, or may depend on its current context of execution, the system should provide feedback to applications on their actual resource demands. With such information, reservations can be dynamically re-negotiated between applications and the system to reflect the actual resource needs. 4. CPU scheduling should not unnecessarily restrict the progress rates of admitted applications. In particular, reserved but unused CPU cycles should not be left idle, but be made available on-demand to applications. 5. To be competitive with existing round robin schedulers, a CPU scheduler providing diverse service classes should do so with little extra overhead. 6. Since different organizations may have different characteristic workloads, a system administrator should be allowed to configure the service classes according to the needs of their organization. The scheduling framework evolves from our earlier work on Adaptive Rate-Controlled (ARC) scheduling. It retains ARC's central features of rate-based sharing with firewall protection, and provision of system feedback for resource re-negotiation. It improves over ARC by providing improved scalability for best-effort applications, and offering explicit tradeoffs between reserved rate utilization and the strength of guarantees for adaptive applications. In this paper, we present our design innovations and discuss our experience in the evolution of ARC scheduling. In addition, we provide extensive performance results and illustrate the salient aspects of our current prototype. These results demonstrate the soundness and practical utility of our approach. 1.1 Contributions and related work CPU scheduling for multimedia applications is an active area of research. Solutions designed for embedded real-time systems are not applicable on general purpose computers [1, 12]. The use of static priorities [9] is generally susceptible to "runaway" applications. Rate-based resource sharing is widely used. Many rate-based systems, however, target only for flexible resource allocation, but do not consider guaranteed QoS through admission control [3, 6, 7, 8, 19]. Lack of system feedback on application performance makes it difficult to determine suitable rates.A highly flexible resource model is proposed in [18], but offers only probabilistic performance. A resource model specific to protocol processing is proposed in [5], which yields guaranteed performance without using threads. This approach does not immediately extend to general computation. Hierarchical schedulers have been advanced to support heterogeneity of applications [4, 6]. They employ leaf schedulers of diverse types. Classical real-time schedulers like rate-monotonic or earliest-deadline-first lack the firewall property [11, 15]. To adapt to dynamic application behavior, certain scheduling algorithms require close application participation, and sophisticated schedulability tests [14]. Other systems have appealed to policing mechanisms external to the scheduling algorithm, such as priority depression [10, 13, 17]. We propose a solution that uniformly applies the well proven technique of rate-based scheduling for diverse application requirements. By considering scheduling algorithms with a provable firewall property, we offer protection among applications without resorting to complicated machinery. Heterogeneity of applications is handled by configuring service classes with different criteria for admission control. As a result, our system achieves at once guaranteed performance, flexible resource allocation with excellent scalability, and intermediate services offering tradeoff between reserved rate utilization and the strength of guarantees. A new rate-based scheduling algorithm suitable for use in our framework is defined. In addition, we present system implementation in a general purpose operating system, and introduce the use of proxied scheduling to account for inexact rate control in a real system. We provide performance evaluations using a real multimedia workload. 1.2 Paper organization In Section 2, we discuss ARC's rate-based sharing with firewall protection as a basis of this research. We discuss the issue of progress fairness, and define a new CPU scheduling algorithm with good fairness properties. Extending ARC to accommodate a heterogeneous services framework is presented in Section 3. Section 4 discusses the importance of priority inversion in CPU scheduling. The use of proxied class to achieve predictable performance in a real system environment is given in Section 5. We present performance evaluations of prototype implementations using a real multimedia workload in Section 6. scheduling This section summarizes the main features of ARC scheduling details are in [23]. ARC defines a family of schedulers, each having the following three properties: (i) reserved rates can be negotiated, (ii) QoS guarantees are conditional upon thread behavior, and (iii) firewall protection among threads is provided. Firewall protection is effected through periodic rate control. Hence, we execute a rate-based scheduling algorithm at certain rescheduling points, as follows: When the currently running thread exits or becomes blocked, the algorithm is executed for it (a block event). When a system event occurs that causes one or more threads to become runnable, the algorithm is executed for each thread that becomes runnable (an unblock event). When a periodic clock tick occurs in the system, the algorithm is executed for the currently running thread (a clock tick event). The initial RC scheduling algorithm (Figure 2a) that we chose for a proof-of-concept experiment in the ARC framework is simple and efficient. Using RC, a thread, say i, can request CPU reservation with rate r period In Figure 2a, event denotes which one of the three rescheduling events triggered the algorithm, Q is the thread for which RC is executed, r(Q) and p(Q) denote Q's reserved rate and period, respectively, curtime is the real time at which RC begins execution, finish(Q) is the expected finishing time of previous computation performed by Q, and val(Q) is an RC value of Q. The system schedules threads in a non-decreasing order of their RC values. Under the assumption of an idealized execution environment [23], Theorem 1 guarantees progress for a punctual thread, say j, in the system. it generates at least (k seconds of work over time interval [0; kp j ], for Theorem 1 If thread j is punctual and i r i 1, then j is scheduled by RC to run for at least (k time Notice that when p j is smaller, rate guarantees are provided over finer time intervals, but with concomitant increase in context switch overhead. Conversely, when p j is larger, the number of context switches becomes smaller, but rate guarantees are now provided over coarser time intervals. Hence, p j in RC allows the tradeoff between context switch overhead and time granularity of rate guarantees to be specifiable by applications, according to their own needs. We have performed experiments to validate Theorem 1 for an actual system running the existing multimedia applications [23]. We show that CM applications such as video and audio can meet their deadlines using ARC, when competing with a variety of best-effort applications (see, for example, Fig. 1). Simultaneously, best-effort applications are able to achieve satisfactory progress despite the demands of CM applications. Firewall protection among applications is achieved without significantly degrading CPU efficiency and utilization. (a) (b)501502503500 100 200 300 400 500 600 700 800 Inter-frame time (ms) Frame103050700 500 1000 1500 2000 2500 Inter-frame time (ms) Frame Figure 1: Times between pictures sent by a application running under (a) Unix TS and (b) ARC, in the presence of competing compute-intensive applications started at about frame 250. Algorithm RC(Q, event) L1. if (event = unblock) L2. finish(Q) := max(finish(Q); curtime); else L3. runtime := time Q has run since RC was last executed for it; L4. finish(Q) := finish(Q) L5. if (event 6= block) L7. val(Q) := start(Q) Algorithm FRC(Q, event) L1. if (event = unblock) L2. vtime L3. finish(Q) := max(finish(Q); vtime); L4. := else L5. runtime := time Q has run since FRC was last executed for it; L7. if (event = block) L8. := fQg; Figure 2: Specification of (a) Algorithm RC, and (b) Algorithm FRC. 2.1 Progress Fairness We show in [23] that RC exhibits the punishment phenomenon. The threads that have overrun their resource reservations can later be punished (i.e. not scheduled) for an extended time period, when a thread with little or no resource overrun joins the system. We show in [23] how rate adaptation can be used by long-running CM applications to avoid the punishment phenomenon, by carefully matching reserved rate to actual execution rate. We have, however, explicitly designed the ARC framework to be highly modular and flexible. As a result, we have been able to incorporate scheduling algorithms with diverse fairness properties into our prototype system. In particular, we have designed a fair rate-controlled algorithm with improved fairness over RC. FRC allows threads to reserve for guaranteed CPU rates. As in RC, FRC calculates for each thread a finish value giving the time at which previous computation by the thread would finish had it been progressing at its reserved rate. The system then schedules runnable threads in a non-decreasing finish value order. FRC is outlined in Figure 2b. Observe that in RC, as a thread, say R, overruns its reserved rate, finish(R) may increase much beyond the real time. Hence, when a new thread, say S, later joins the system, finish(S) will be set to the current real time by L2 of Figure 2a. It may then take unbounded time for finish(S) to catch up with finish(R). To solve the problem, Fig. 2b (line L3) uses a virtual time value, vtime - calculated in L2 to closely match the finish values of existing runnable threads - to determine the finish value of a newly runnable thread. In addition, the algorithm uses , initially empty, to keep track of the current set of runnable threads in the system. We discuss the progress properties of FRC. For notational convenience, we adopt the following in our exposition: denotes the finish value of thread i. q (in s) denotes the period of system clock tick. We first prove Lemma 1, which bounds the difference in finish values between two runnable threads scheduled by FRC. Such a bound implies progress fairness by limiting how long a thread can run before another runnable thread will be given a chance to use the CPU. Lemma 1 The following is invariant: If i and j are both runnable, then f i f j q=r i . Proof: The invariant is true when the first thread becomes runnable. We show that the invariant is preserved after each rescheduling point. In the proof, and f i denote the set of runnable threads and the finish value of thread i, respectively, before the rescheduling point. 0 and f 0 i denote the set of runnable threads and the finish value of thread respectively, after the rescheduling point. 1. When a system clock tick occurs for thread i. Since i was chosen to run, f i f j 0, for all j 2 . By L6, 2. When thread k becomes blocked. This does not affect the finish value of any runnable thread. Hence, trivially, 3. When thread i becomes runnable. Consider two cases. Case Case j be the finish value of thread j when i last blocked (notice that f 00 . Moreover, since where the last inequality follows from the fact that the invariant holds before the rescheduling point. From Theorem 2 proves guaranteed throughput for FRC scheduling. Theorem 2 For any time interval [t; t 0 ], if i is continuously runnable throughout the interval, then it will be scheduled by FRC to run for at least (1) time, where is the set of threads that are ever runnable in [t; t 0 ]. Proof: Let W j denote the total amount of time j runs in the interval [t; t 0 denote the finish value of j when j first becomes runnable in [t; t 0 ], and f 0 j the finish value of j at time t 0 . By Lemma 1 and the fact that f i is non-decreasing, we have From (2) and (3), By L3 and L6, for j 6= i, From the fact that i is continuously runnable, we have Since i is continuously runnable, the CPU is busy throughout [t; t 0 ]. Hence, From (6) and (7), following corollary is immediate, which states guaranteed progress when CPU time is not overbooked, i.e. when r i 1. Notice that when t 0 t becomes large, a continuously runnable thread has a CPU rate that converges to the reserved rate. Corollary 2.1 For any time interval [t; t 0 ], if i is continuously runnable throughout the interval and j r j 1, then i will be scheduled by FRC to run for at least time, where is the set of threads that are ever runnable in [t; t 0 ]. 3 ARC Scheduling for Heterogeneous Services The experience with ARC is that while it performs well in guaranteeing progress to diverse applications, it suffers from some practical problems. One observation is that we accommodate best-effort applications by giving each such application a very low rate (say 0.02). This approach has reasonable scalability, since the low rates add up slowly, and we can admit a good number of best-effort applications before being rejected by the admission control. However, CPU scheduling using ARC still imposes an artificial limit on the number of best-effort applications that can be admitted at the same time. Moreover, best-effort and real-time applications compete for the same pool of reserved rate. This may not always be desirable. ARC for heterogeneous services (ARC-H) is an extension to ARC to overcome practical limitations. Its major departure from ARC lies in its explicit recognition of diverse classes of applications discussed in Section 1. ARC-H still retains the use of an integrated scheduling algorithm (such as RC or FRC described in Section 2.1). Heterogeneity of applications is supported by differential admission control. An ARC-H system administrator can partition the total CPU capacity into rates for m service classes, i.e., service class k is allocated rate R k m, such that R k > 0 and R 1. For m, an overbooking parameter, Thread j can request from service class k a reservation specified by two parameters: nominal rate ^ r j and period . The request is granted if where C k denotes the subset of threads already admitted into service class k. After thread j has been admitted, it receives an effective rate given by where C k is the subset of threads admitted into service class k, which by now includes thread j. These effective rates, (n is the total number of threads) in ARC-H are then used as the thread rates in section 2.1. Notice that the effective rate of a thread depends not only on its own nominal rate, but also on the nominal rates of other threads admitted to its service class. However, it can be shown that Hence, Corollary 2.1 provides a hard guarantee of the effective rate r i to thread i. The overbooking parameters can be used for specifying different levels of service. For b threads in service class k get a hard guarantee of their reserved rates. This service class is called guaranteed rate or GR, and is suitable for applications with stringent timing constraints. For b class k can be used for flexible rate allocation with excellent scalability (but threads in this class receive no guarantee besides non-zero progress). This service class is called flexible rate or FR, and is suitable for conventional best effort applications. Other values of b k lead to service classes with a statistical guarantee of different strengths. Such service classes are called overbooking or OBn, where n is the percentage of overbook. They are suitable for adaptive multimedia applications which can gracefully shed work to accommodate controlled periods of system overload. In a multiprocessor operating system like Solaris, threads can contend inside the kernel for synchronization resources such as mutex locks, semaphores, condition variables, and readers/writer locks. In such a system, priority inversion inside the kernel becomes an important problem. To solve the problem, ARC-H leverages existing mechanisms in Solaris 2.5.1 to provide priority inheritance. A thread in ARC-H can inherit the finish value of another thread that it blocks. An inherited finish value is not rate controlled (i.e. it will not be increased by a clock tick). However, the original finish value of the inheriting thread is, so that CPU usage at an inherited priority is accounted for. In principle it is possible for two threads, say P and Q, to conspire with each other to hoard resources. For example, when P is running, it can acquire a lock, say L, which it then does not give up. When later, P is preempted and Q gets scheduled, Q attempts to acquire L. P , blocking Q, will inherit Q's finish value. P then runs with this inherited priority without ever giving up L. In our system priority inheritance is implemented for synchronization of resources managed by kernel code. Since kernel code is trusted, we reasonably assume that such conspiracy cannot occur. Section 6 demonstrates the practical utility of priority inheritance in our system. Besides synchronization primitives, priority inversion can also occur when different applications request service from a system server. The major problem is that using the traditional RPC, the server thread will run at a priority unrelated to the priority of its client. To tackle the problem, we have implemented a trains abstraction in Solaris. A train allows a thread of control to access services in multiple processes while carrying its resource and scheduling state intact. This ability is achieved by decoupling a thread (which we view as purely a scheduling entity) from its associated process (which provides resource context - albeit non-permanently - to the thread). Hence, while a thread still has a home process (i.e. the process in which it is created), it is free to leave a process and enter a new one, through a well-defined stop exported by the latter. A stop is exported as a secure entry point to server code, when a server offers a service. At the time of service invocation, the server additionally provides a stack for executing the new client request. We are planning to incorporate trains into real applications, and will report on their performance in a later paper. To avoid the effects of priority inversion due to interrupt processing, our scheduler is designed to work best when such processing is reduced to a minimum. Our protocol processing system of Migrating Sockets [21], for example, minimizes the use of interrupts in handling packet arrivals from the network. However, a small amount of performance critical activities, such as periodic system clock ticks for CPU rate control, is still allowed to take place at interrupt priority, higher than the priorities of ARC-H threads. 5 Proxied Class FRC can be used as a single level CPU scheduler. Theorem 2 says that a runnable thread with effective rate r may not get scheduled in a time interval of length (n 1)q is the number of threads admitted into the system. Since q is non-negligible in a real system (we expect it to have value from 1 ms to 10 ms), this time interval can become excessive when n is large. The presence of best-effort applications is of particular concern, since their service class is explicitly designed to be highly scalable. To solve this, our system allows a service class to be configured as a proxied class. A proxied class introduces two-level scheduling into ARC-H: the system level and the class level. At the system level, a proxied class is represented by a proxy thread that can join the ARC-H system dispatch queue and hence compete for system CPU time. At the class level, a proxied class maintains a private dispatch queue of all runnable threads in the class, in and increasing finish value order. A proxy thread is considered running if any thread in its class is running. If it is not running, then it is runnable if at least one of the threads in its class is runnable. Otherwise, it is blocked. It has effective rate equal to the configured Algorithm L1. if (event = unblock) L2. vtime L3. finish(Q) := max(finish(Q); vtime); L4. if L5. call FRC(C:proxy, unblock); L6. C: := C: else L7. runtime := time Q has run since PRIVATE FRC was last executed for it; L8. finish(Q) := finish(Q) L9. if (event = block) L10. C: := C: fQg; L11. if L12. call FRC(C:proxy, block); else L13. call FRC(C:proxy, tick); else L14. call FRC(C:proxy, tick); Figure 3: Specification of Algorithm PRIVATE FRC for proxied scheduling. class rate, and has scheduling state, such as finish value, just like a usual thread. When a proxy thread is selected for execution (because it currently has a highest priority), however, it is not dispatched, but instead selects the highest priority thread from the private runnable queue of the class and dispatches it. We specify algorithm PRIVATE FRC in Figure 3 for proxied class scheduling. The algorithm is to be used in conjunction with algorithm FRC in Figure 2b, which is for a non-proxied or proxy thread, i.e. for scheduling at the system level. PRIVATE FRC itself is called when a rescheduling event occurs for a thread in a proxied class (the proxied thread). In the algorithm, Q is the proxied thread, C is the proxy class to which Q belongs, and event specifies the rescheduling event that triggered the algorithm. For the proxy class C, C: denotes the set of threads in C that are runnable, and C:proxy denotes the proxy thread that represents C in system level scheduling. Notice that PRIVATE FRC invoked for C may call FRC with C:proxy and a suitable rescheduling event as parameters. For example, when thread Q in C becomes blocked, FRC is called with a block event if Q was the last runnable thread in C, and with a tick event otherwise. To see the benefits of proxied scheduling, consider a video thread with rate r v competing with 1000 threads in the FR class for CPU time. If the FR class is not configured as a proxied class, then from Theorem 2, there is a time interval of length 999q during which the video thread may not be scheduled at all. If the FR class is proxied, however, the time interval is reduced to q 6 Experimental Results We present performance results showing the different aspects of ARC-H scheduling, including guaranteed perfor- mance, overload performance, suitability for heterogeneous services, scalability, flexible and proportional rate sharing, stability, and efficiency. The ARC-H scheduler used runs as part of Solaris 2.5.1 on a Sun UltraSPARC-1 workstation. Five applications representing a multimedia workload were used inour experiments. We measured the performance of the first four applications under various conditions. The fifth, radio xmit, ran on a computer different from the measurement platform, and was used only for sending network audio packets read by radio recv. No performance data was taken for radio xmit. We list the applications as follows: greedy: compute-intensive application that is always enabled. It repeatedly does a round of 2.5 ms of computation and prints a timestamp. periodic: an application that wakes up every performs 2.5 ms of computation, and outputs a timestamp. mpeg2play: a CM application that plays MPEG-2 encoded video at fps. The video contents played are IPPPP encoded and are a 60 second segment of tennis instruction. radio recv: a CM application that receives a PCM-encoded audio sample every 100 ms from the network. radio xmit: an audio application that captures PCM-encoded audio from a microphone and sends the audio samples to the network. Samples are generated at 100 ms intervals. They are for reading by radio recv. We have experimentally determined the CPU requirement of mpeg2play. To do this, we ran one to four copies of mpeg2play (with minimal competing load) in Solaris TS, and noted the achievable frame rates. For one or two applications, the frame rates were full per second. For three applications, the frame rates became 29.13, 29.85 and 27.61, respectively. For four applications, the frame rates further went down to 20.79, 20.59, 19.63 and 19.10, respectively. We conclude that the full CPU capacity can support up to three mpeg2play's at frames per second. Unless noted otherwise, the experimental CPU was configured with FR rate 0.25 and GR rate 0.75, and the system clock tick interval used was 10 ms. FR was configured as a proxied class, whereas GR was not. 6.1 Flexible rates and high utilization performance We performed an experiment to demonstrate that ARC-H achieves flexible allocation of rates in a graceful manner. The CPU was configured to have a GR rate of 1.0 in this experiment. Five copies of greedy and six copies of the periodic application were run, all with the same rate in the GR class. Figure 4a plots the timestamp value (relative to the first timestamp of its application) against the timestamp number for each application. Figure 4b is a close-up view of the first 100 seconds, for only the greedy applications. The graphs show how the execution rates gracefully adapted as the applications started and finished at different times (hence changing the offered CPU load). To examine system performance under high utilization, say that a periodic or greedy application in our experiment is on time if it completes at least one round of computation every ms. Since a round of computation takes about 2.5 ms, the rate requirement for an application to be on time is about 2.5 ms / a total of 11 applications running in the system, the aggregate CPU rate required for all the applications to be on time was about 0:083 To see the performance of the periodic applications under this rate requirement (the actual CPU load was 100% throughout the experiment), refer to Figure 5 (for clarity, only three applications are shown, but the profiles are representative). The reference line shows that a periodic application was mostly on time under our experimental setup. To demonstrate differential rate sharing in FR, we ran ten greedy applications in the service class. Six had nominal rate 0.05, two had nominal rate 0.1, and the remaining two had nominal rate 0.2. Figure 6 shows the execution profiles for all the applications. The figure shows that when all the applications were active, greedy with rate 0.2, 0.1 and achieved 222, 105, and 52 rounds/second, respectively. The achieved ratios of 1 are close to the expected ratios of 1 This set of experiments demonstrates that ARC-H is able to provide heterogeneous services with firewall protection among service classes. We ran two different experiments. In the first, we ran five greedy applications each with nominal rate 0.1 in the FR class, together with two mpeg2play, each with rate 0.3 in the GR class. In the second, we increased the number of greedy applications to thirteen. Figure 7a shows the execution profiles of all the applications in the first experiment. Figure 7b shows the corresponding profiles for the second experiment. As shown in Figure 7a, the greedy applications ran with a slope of 45.74 when the mpeg2play's were still running. The slope increased to 186.87 when the mpeg2play's finished execution. The equal slopes show that each greedy application was receiving the same share of the CPU. From Figure 7b, we note that, with their increased number, each greedy achieved a lower execution rate than before (notice that one of the greedy applications started earlier than the rest). The mpeg2play's, however, were unaffected, showing that the greedies in FR are sharing among their own resources. From Figure 8a, a close-up view of Figure 7a during 10-25 seconds, the mpeg2play's were not affected by starting up of the greedy Time (ms) Round greedy 3 greedy 4 greedy 5 periodic Time (ms) Round greedy 3 greedy 4 greedy 5 Figure 4: (a) Execution profile of five greedy and six periodic applications, each with a equal rate. The top-most line shows the coincided periodic applications; the other lines are for the various greedy's. (b) Execution profile of the greedy applications during the first 100 rounds - the graphs show graceful adaptation of execution rates as the offered CPU load increases.45504650475048504950150 152 154 156 158 160 162 164 Time (ms) Round periodic 6 Figure 5: Magnified view of three of the periodic applications.100030005000700090000 20 40 round number time (seconds) greedy.1 greedy.2 greedy.3 greedy.4 greedy.6 Figure applications running in the FR class showing differential rate sharing. The top line represents the coincided profiles of two applications each of rate 0.2, the middle line two applications each of rate 0.1, the lowest line six applications each of rate 0.05. greedy.2 greedy.3 greedy.4 mpeg2.1 round number time (seconds) greedy.1 greedy.2 greedy.3 greedy.4 greedy.6 mpeg2.1 mpeg2.2 Figure 7: Execution profiles of two mpeg2play's in GR running concurrently with (a) five greedy applications in FR, and (b) thirteen greedy applications in FR. In both (a) and (b), the shorter straight line is the two mpeg2play's coincided profiles. (a) (b)20040060080010 12 14 round number time (seconds) greedy.1 greedy.2 greedy.3 greedy.4 mpeg2.1 mpeg2.21030500 200 400 600 800 1000 1200 1400 1600 1800 2000 inter-frame time (ms) picture number mpeg2.1 Figure 8: (a) Close-up view of two mpeg2play's with five greedy applications during the first 100 seconds; the thin straight line shows the coincided mpeg2play's. (b) Plot of interframe times of an mpeg2play running with five greedy applications. applications. Figure 7b shows a representative plot of the inter-frame times for mpeg2play; the expected frame rate of per second was achieved. 6.3 Graceful load shedding We show that certain CM applications can gracefully adapt to CPU overload, and hence can be run in an overbooking service class. For this purpose, we configured an OB70 service class with overbook fraction 0.7. The CPU was then partitioned to have FR rate 0.1, GR rate 0.3, and OB70 rate 0.6. In our experiment, we ran three copies of mpeg2play each with nominal rate 0.3 in OB70, and obtained their execution profiles. Throughout the experiment, two greedy applications were running in the GR and FR classes, respectively. Figure 9a shows the execution profile for all of the applications. An mpeg2play achieved a frame rate of about 24 frames per second in the experiment. Figure 9b gives a plot of inter-frame times for a representative mpeg2play application. The plot shows that good picture continuity was achieved despite the reduced frame rate. greedy.FR greedy.GR mpeg2_OB70.2 inter-frame time (ms) picture number mpeg2.1 Figure 9: (a) Execution profile of three mpeg2play's running in the OB70 class together with two greedy applications in the GR and FR classes, respectively. The most slanted line is greedy in GR; the most flat one is greedy in FR; the middle one shows the coincided mpeg2play's. (b) Plot of inter-frame times for the first 60 seconds for a representative mpeg2play. 6.4 Priority inheritance To demonstrate the practical significance of priority inheritance, we turned it off in a set of experimental runs. The set of experiments used two mpeg2play (each in GR with rate 0.3), one radio recv (GR with rate 0.1) and two greedy applications (each in FR with rate 0.1). We observe that in some cases, an execution profile such as the one shown in Figure 10a is obtained. As shown, instances occurred in which a greedy application completely dominated the CPU, and no other application was able to make progress until the greedy application completed execution. In the case of Figure 10a, this occurred on about 60 to 90 seconds. To understand the problem, we collected trace information inside the kernel. Our traces show that from 60 to 90 seconds, no clock tick occurred for the dominating greedy application. Hence, the application was never preempted, since its priority was never reduced by rate control. From the kernel source code, this could occur when a clock thread in Solaris, which handles periodic clock interrupts, is blocked on a synchronization primitive. 1 When that happens, subsequent clock processing will be deferred until the clock thread returns. By collecting more trace information, we confirm that in the case of Figure 10a, the clock thread was indeed blocked (from 60-90 seconds) on a mutex lock while attempting to process high priority timer activities in the system. Further data show that one of the mpeg2play applications was holding the mutex lock in question. With priority inheritance, an mpeg2play application holding the timer lock required by the clock thread will inherit the latter's priority. As an interrupt thread in Solaris, the clock thread has strictly higher priority than any ARCH thread. Hence, the blocking mpeg2play will be quickly scheduled (preempting a running greedy application if necessary), and be able to quickly release the timer lock as a result. In turn, this ensures that the clock thread can complete its tasks, without delaying subsequent clock processing. When priority inheritance was incorporated, therefore, the kind of gaps shown in Figure 10a was no longer observed. Figure 10b shows a representative execution profile of the the same mix of applications used in the preceding paragraph. 6.5 Implementation efficiency We compare the efficiency of our prototype scheduler with Solaris TS. We ran n copies of greedy concurrently under GR, FR and Solaris TS, respectively, and noted the average completion time per application. We varied n to be 1, 15. For Solaris TS, we used its standard quantum sizes. For GR and FR, a preemption quantum of 10 ms was used. Figure 11 shows that the three schedulers have essentially the same performance: GR and FR have slightly lower times with up to 10 applications, and slightly higher times at 15 applications. To see the effects of fine- versus coarse-grained rate control, we further varied the preemption time quantum to be 10, 30, 50 and 70 ms, for GR and FR. From Figure 12, notice that for both service classes, when the number of offers true multi-threading inside the kernel and processes clock interrupts in one of its kernel threads. In certain other systems, clock activities may be handled by an interrupt handler, which cannot block on unavailable resources. 'radio_recv.500.plot'200060001000014000 round number time (seconds) mpeg2.1 mpeg2.2 greedy.1 greedy.2 Figure 10: (a) Unstable system performance without priority inheritance - the top two lines (initially coinciding) show the two greedy's. (b) Stable system performance with priority inheritance - the top line shows the coincided greedy's. In both (a) and (b), the most flat line is radio recv, while the middle line shows the coincided mpeg2play's.10.210.611 Average completion time Number of applications Solaris GR FR Figure 11: Average time to complete one greedy application using GR, FR and Solaris TS. Figure 12: Average time (in seconds) to complete a greedy application with 1, 5, 10, and 15 competing applications, and a preemption quantum size of 10, 30, 50 and 70 ms: (a) for GR class, and (b) for proxied FR class. applications is large, the completion time drops somewhat as the preemption quantum increases from 10 to 30 ms. It does not change significantly with further increase in quantum size. Conclusions We presented a CPU scheduling framework suitable for heterogeneous applications running on general purpose com- puters. We discussed how our present system has evolved from ARC scheduling. In particular, it retains ARC's central features of rate-based sharing with firewall protection, and provision of system feedback for rate re-negotiation. Its major design innovation over ARC is the definition of a heterogeneous services architecture based on uniform rate-based sharing, but service classes with different admission control criteria. Algorithm RC is adapted from VirtualClock [24], but it uses the expected completion times of previous computations, instead of computations to be scheduled, for scheduling. FRC's solution to the fairness problems is similar to several other approaches, such as virtual clock reset [20], time-shift scheduling [2], and leap forward virtual clock [16]. Other rate-based algorithms with suitable firewall protection can also be used in our framework. For system integration into a general purpose OS environment, we discussed issues such as priority inheritance and proxied scheduling. Diverse experimental results demonstrate the soundness and practical utility of our approach. Acknowledgment The authors wish to thank Sanghamitra Sinha for conducting measurements during the development of ARC-H, and for some of the results reported in this paper. --R An event-based fair share scheduler CPU inheritance scheduling. Efficient user space protocol implementations with QoS guarantees using real-time upcalls A hierarchical CPU scheduler for multimedia operating systems. The fair share scheduler. Experiences with processor reservation and dynamic QoS in Real-time Mach Scheduling algorithms for multiprogramming in a hard real time environment. QNX Software Systems Ltd. Processor capacity reserves: Operating system support for multimedia applications. The design Analyzing the multimedia operating system. Leap forward virtual clock: A new fair queueing scheme with guaranteed delays and throughput fairness. Lottery scheduling: Flexible proportional-share resource management Stride scheduling: Deterministic proportional-share resource management Delay guarantee of Virtual Clock server. Migrating sockets - end system support for networking with quality of service guarantees ARC-H: Uniform CPU scheduling for heterogeneous services. Adaptive rate-controlled scheduling for multimedia applications A new traffic control algorithm for packet switching networks. --TR
priority inversion;firewall protection;CPU scheduling;multimedia operating system;rate-based sharing;admission control
597244
Scheduling and Optimization of the Delivery of Multimedia Streams Using Query Scripts.
New techniques are necessary to satisfy the high bandwidth requirement and temporal relationships of multimedia data streams in a network environment. Clients can experience gaps between the multimedia data streams during presentations as the multimedia server services multiple clients. This variable delay occurs between the end of one multimedia stream and the beginning of the next multimedia stream because client requests are queued awaiting service. This leads to interruptions and discontinuities of the client's presentation. Special techniques are necessary to manage the temporal relationships between multimedia streams in distributed environments. In this paper we propose two scheduling algorithms for delivering multimedia streams by using the query script, which is a multimedia database interface for clients. A client can specify all the multimedia objects that make up the presentation and their temporal relationships in a query script. Once submitted, the information in the query script is used by the multimedia database system to schedule and optimize the delivery. Using simulations we analyzed the performance of the proposed delivery scheduling algorithms and the predelivery optimization method. The simulation results show that delivery scheduling algorithms satisfy the specified temporal relationships between multimedia streams while maintaining better use of system resources.
Introduction Multimedia information systems require new data modeling and delivery capabilities to specify and guarantee temporal relationships between streams [7]. These capabilities are more critical in distributed computing systems due to multimedia data's high resource require- ments. In this paper we propose the use of query scripts as the interface between clients and multimedia database systems for specifying the delivery of multimedia data. Query scripts allow clients to make a retrieval This research was supported in part by NCR, Lexis-Nexis, and NSF under Grant No. CDA-9601670. c 2001 Kluwer Academic Publishers. Printed in the Netherlands. S. T. Campbell and S. M. Chung request consisting of a set of multimedia objects and their temporal ordering to the multimedia database system. The information given in the query script enables the database system to reserve su-cient disk bandwidth, memory, and other system resources in order to meet the client's request. In our approach, a database management system (DBMS) is combined with a multimedia server. The DBMS provides the data modeling and manages key information about the multimedia data, while the media server stores and delivers multimedia data as atomic objects. For example, relational database systems can support multimedia through the use of binary large objects (BLOBs). A BLOB is an unstructured storage string that the database system treats as an atomic object. The database schema manages access to the data in the BLOB by storing a pointer to the BLOB. Object-oriented database systems can support more accurate modeling and better integration of multimedia data, but again they eventually store each multimedia data object as a sequence of data. In both cases, in order to satisfy the delivery timing requirements of multimedia streams, usually specialized media servers handle the actual storage and delivery of multimedia objects. A media server is a shared storage facility that is capable of isochronous delivery of multimedia data. Isochronous delivery guarantees that a new packet of data is available at the client in time to present the next video frame or audio data. Additionally the media server incorporates the server-push methodology as opposed to the more traditional client-pull methodology to minimize network tra-c and extraneous client read requests [23]. In the client-pull case, the client makes separate requests for each block of data. On the other hand, in the case of server-push, a single request is made by the client for a stream delivery, then the server continually transmits data blocks of the stream. Media servers extend existing le system capabilities by providing multimedia data placement strategies, bounded delivery timing, guaranteed buer and media management, and special disk retrieval techniques. Through these techniques the media server is able to handle concurrent retrieval and transmission of multimedia streams and supports multiple clients. We claim that the relationship between a media server and a multimedia database system develops just as the relationship between le systems and traditional database systems has developed. Originally the le system was the central data management component and applications managed their own logical view of data. Gradually database systems emerged to provide common data models, catalogs, dictionar- ies, indices and other tools [8]. Thus the database system extended the le system's management capability. We feel that a similar architec- Delivery Scheduling of Multimedia Streams 3 tural hierarchy exists between multimedia database systems and media servers, as shown in Figure 1. The media server provides basic storage and delivery functions for multimedia data while the database system adds necessary modeling and management functions. Additionally the media server can deliver information directly to the client application bypassing the database system. File System DBMS Media Server Application DBMS File System Application Traditional Multimedia Figure 1. Hierarchy of database systems Specialized media servers are necessary to handle the delivery of multimedia data since audio and video data are continuous. Video consists of a continuous sequence of frames, and each frame needs retrieval, processing and delivery within a strict xed time interval. Audio is a continuous sequence of samples that needs conversion in a sample interval. Delivery of multimedia data is dierent from the delivery of traditional data since multimedia data is inherently presentational. In other words, usually the purpose of multimedia data is for presentation to users rather than for additional computational processing. Since multimedia data is large, for example 10 seconds of VCR quality video is about 1.5 MB, the client can not wait for the complete retrieval of the object before beginning the presentation. Instead, the client processes multimedia data in blocks as they arrive. This sequence of data blocks delivered in regular time intervals constitutes a multimedia stream. Delivery problems are related to many subsystems, but a major bottleneck is the disk [17]. Disk subsystems do not guarantee data delivery within the bounds necessary for the presentation of video and audio. This is because the disk orders the requests to minimize seek times. Hence the exact data delivery timing is dependent upon the current set of requests and the locations of corresponding disk blocks. This leads to random delivery timing, which is unacceptable for multimedia data. Proper decoding of multimedia data requires that data always be present for decoding when needed. The most common solution is to retrieve one unit of data from the disk for each multimedia stream during each xed disk service round, as in [9]. This scheme guarantees 4 S. T. Campbell and S. M. Chung timely delivery as long as the total number of requested streams is below a certain limit. The problem with the delivery scheme using a xed disk service round is that it is characterized as best-eort delivery and can lead to a loss of the temporal ordering of the streams. With best-eort delivery the media server attempts to satisfy all accepted requests but oers no guarantees due to the stochastic nature of the retrieval process. For example, if a client wants to display two streams simultaneously and makes two separate requests, the rst can be accepted and the second rejected. This loses the desired temporal ordering between the two multimedia streams. The other major problem is large gaps between streams which are supposed to be sequential. A best-eort delivery system may accept the request for the rst stream from the client and then immediately receive several requests from other clients which ll the media server's capacity. Then, when the second multimedia stream is needed by the client, the media server is busy and can not deliver it immediately. This results in an undesired gap between the two streams (called interstream latency), as shown in Figure 2. Figure 2. Loss of temporal order Some multimedia presentation systems address these temporal synchronization problems [4, 25], but they do not deal with network based delivery systems. They assume local storage systems in which they can exert strict control over disk accesses. This assumption is not feasible in a network environment where multiple requests arrive at a media server from several clients. In the network environment, best-eort de- Delivery Scheduling of Multimedia Streams 5 livery systems can not provide the necessary synchronization between multimedia streams. Our approach enables the client to request a set of multimedia objects and specify their temporal order by using query scripts. Query scripts contain enough information for the multimedia database system to maintain the requested temporal delivery order. A query script spec- ies the entire set of multimedia objects and their temporal ordering in one request so that the system can create a delivery schedule and ensure proper delivery. This delivery scheduling minimizes the unacceptable latencies experienced with best-eort delivery systems. In the remainder of this paper, we introduce the query script and then propose two delivery scheduling algorithms, which are named scan scheduling and group scheduling. The simulation results demonstrate that the proposed delivery scheduling algorithms satisfy the specied temporal ordering between streams while maintaining high system resource utilization. We also analyze the eect of predelivery optimization on the performance of the proposed scheduling algorithms. 2. Scheduling of Delivery Using Query Scripts A query script has two parts, declaration and temporal ordering. The declaration part uses object identiers to specify the multimedia data objects to be delivered to the client. The temporal ordering part species the timing relationships between the multimedia objects. There are three basic temporal ordering actions: initiate streams, wait for streams to complete, and terminate streams. Figure 3 shows an example of a query script that declares four multimedia data objects for delivery. Here video A plays to completion, then videos B and C play simulta- neously. When video B completes, video C terminates even though it is not nished yet, and then video D plays. More details about query scripts are given in [5]. The query script can be used for the specication of synchronized presentation of multimedia objects. The temporal relationships between continuous media objects can be easily specied by using the query script because it covers all the event-based synchronization requirements [3]. Compared to other synchronization specication schemes, the query script is quite easy to use, and it can be easily extended by adding other synchronization constructs. For example, some timing operations can be added to cover interval-based synchronizations. An extensive survey and comparisons of dierent synchronization speci- cation methods are given in [3]. 6 S. T. Campbell and S. M. Chung Figure 3. Query script example A query script does not support detailed temporal synchronization semantics because it is not a presentation language such as Fire y [4], MHEG [12, 19, 20], or HyTime [11]. We expect the client applications to use these schemes to provide richer temporal and physical modeling semantics and to use query scripts to make delivery requests that include temporal relationships. The client application manages the nal presentation timing using the presentation language while the multi-media delivery system uses the query script to schedule and manage the delivery timing. The information in the query script provides the database system with enough information to properly schedule the delivery. Scheduling ensures that the query script's temporal ordering is met, no overcommitment of system resources occurs, and optimized usage of system resources. Best-eort delivery systems can not perform scheduling since only the current set of requests is known and, once the system accepts the requests, there is a contract to maintain their delivery. This leads to random rejection of streams or lengthy gaps between multimedia streams. With query scripts, the delivery manager can create a delivery schedule since the entire delivery request of each client is specied. Then the delivery manager is able to schedule the delivery of multimedia objects and guarantee the desired performance by creating a feasible schedule and using the predelivery optimization technique. The predelivery optimization consists of prefetching disk blocks during the periods of disk underutilization, so that we can start some query scripts Delivery Scheduling of Multimedia Streams 7 2.1. Scan Scheduling Delivery scheduling is the main reason for using query scripts. A delivery schedule is a consolidated list of service intervals for the streams of accepted query scripts. The delivery manager uses the information in the query script to schedule the delivery of its streams by integrating their service intervals into the current delivery schedule. A feasible schedule is one that does not have any overcommitment of system resources during the delivery of all the scheduled multimedia streams, while satisfying the temporal orderings specied in the query scripts. The media server uses this delivery schedule to control the delivery of multimedia streams to the client workstations. There are three major parts in the delivery manager of the media server: the parser, the scheduler and the retrieval manager, as shown in Figure 4. The scheduling process starts when a client sends a query script to the media server. The query script is parsed into a graph called the Script Realization Graph (SRG) [5]. The scheduler takes the request from the queue and nds a starting time that will allow all streams to be delivered according to the client's temporal ordering requirements. It does this by creating a series of test schedules in which it integrates the new request with the current delivery schedule. The scheduler selects a feasible test schedule to be the new delivery schedule. The retrieval manager reads the delivery schedule at every xed disk service round to determine which streams to service. It then identies a set of disk blocks to retrieve from the disk. Once these disk blocks are retrieved, the delivery manager then sends them to the clients. Isochronous delivery is guaranteed for each client request because all the scheduled query scripts are served at every xed disk service round. The main part of a schedule is the list of service intervals and the resource needs for each service interval. A service interval represents a period of time where the same set of streams is delivered. Therefore, the same level of resource utilization is required during the service interval. Figure 5(a) shows ve service intervals for a delivery schedule. A new service interval begins with any change in the set of active multimedia streams. Figure 5(b) shows the service intervals of a new query script. Adding the new query script to the existing delivery schedule results in the set of service intervals in Figure 5(c). The list of service intervals in the delivery schedule maintains information about future resource needs in a fashion that can be examined quickly. We developed two scheduling algorithms, which are named scan scheduling and group scheduling. We present the scan scheduling algorithm and its simulation results before introducing the group scheduling 8 S. T. Campbell and S. M. Chung Figure 4. Delivery manager Figure 5. Service intervals The scan scheduling algorithm schedules one query script at a time by progressively slipping the new query script's start time until nding the rst feasible schedule, so it is named scan scheduling. The algorithm creates a test schedule by integrating the service intervals of the new query script with the current schedule, as shown in Figure 6. This test schedule becomes the new delivery schedule if it is feasible. A feasible schedule is one in which all service intervals can receive adequate disk bandwidth, buer memory, network bandwidth and other system resources required. If the test schedule is not feasible, the algorithm repeatedly nds the next possible start time for the new query script until obtaining a feasible schedule. The algorithm can always nd a start time that results in a feasible schedule since the media server Delivery Scheduling of Multimedia Streams 9 admits only the query script that is feasible by itself. This ensures that a feasible schedule exists, even though it may start the new query script at the end of all currently accepted query scripts. Apply the admission test Integrate into a test schedule Is the test schedule feasible? Reject the query script Accept the test schedule Start Fail Pass Locate the next possible start time and update the test schedule Try the predelivery optimization Unsuccessful Successful Update the test schedule Figure 6. Scan scheduling algorithm A key to the e-cient execution of this scan scheduling algorithm is how to limit the number of possible test schedules. This requires nding a minimum set of possible start times for each new query script. Instead of sequentially incrementing the possible start time, the scan algorithm examines only the time instances where the current schedule's resource utilization level changes, i.e. the start and end points of the service intervals in the schedule. This signicantly reduces the number of test schedules. However, since only one service interval requiring an excessive amount of resources can make a test schedule infeasible, we may have an unduly long delay in starting the new query script. Thus, we need to optimize the schedule to reduce the total service time for the query scripts. S. T. Campbell and S. M. Chung 2.2. Predelivery Optimization Optimization of delivery scheduling is required to reduce the total delivery time for the query script while making better use of system resources. The delivery manager uses prefetching and buering techniques to overcome the overcommitment of system resources and to provide earlier delivery of requests. Idle disk bandwidth and buer memory are used to prefetch and buer some of the multimedia streams so that there will be no overcommitted service intervals during the delivery of query scripts. The rst step is to check the resource requirements of each service interval of the test schedule. If there is a problem, the algorithm calculates the total amount of memory space needed to correct the overcommitment. This amount is proportional to the length of the overcommitted service interval and the amount of overcommitted disk bandwidth. The algorithm then scans back through the test sched- ule's service intervals looking for available disk bandwidth and memory space. When it nds available resources, the test schedule is updated to include the prefetch operations. If all overcommitted service intervals are corrected, the updated test schedule is accepted. Otherwise a new test schedule is generated by selecting the next possible start time for the new query script. Is this media server based optimization necessary since the client workstation can perform local optimization for the delivery of its own requests? While the client workstation can perform local optimization, it can not perform global optimization because it is unaware of other client requests. Also the client may not be fully aware of the length, bandwidth requirement, or composition of the requested multimedia objects. For complete scheduling and optimization, the scheduling algorithm needs to know the properties of all multimedia objects. While the client can get this information, the delivery manager, as part of the multimedia database system, can better perform the optimization since it has detailed knowledge of the actual multimedia content. 3. Simulation To evaluate the performance of the scheduling and optimization algorithms based on the query script, we created a simulation environment. The simulation is implemented using CSIM [18], a discrete event simulator supporting concurrent processes written in C++. CSIM primitives provide multitasking capabilities, handle interprocess communications, and manage data collection. The resulting simulation is very close to the actual implementation in C++. Delivery Scheduling of Multimedia Streams 11 For comparison, we also evaluate the cases where clients release an individual request for each multimedia stream, which is called baseline approach in this article. 3.1. Simulation Model The simulation model includes three major components: clients, delivery manager, and disk manager. The client processes have three stages: request generation, request submission, and data reception. For our simulations, a client's request consists of four playback intervals where the length of each interval is determined by the longest multimedia stream in that interval. All the streams in a playback interval start together at the beginning of the interval. Each playback interval has up to three multimedia streams that are selected from a pool of 180 multimedia streams, which consists of 120 small streams and 60 large streams. The length of each stream is randomly selected from a uniformly distributed set of values where the distribution for small streams ranges from 5 to 15 seconds and the distribution for large streams ranges from 45 to 75 seconds. For the baseline cases, the client makes a request for each multimedia stream at the start of each playback interval. For the query script cases, each client submits a single query script for all the multimedia streams involved. In all the experiments, the clients wait and receive the multimedia data from the delivery manager, record the delivery times, and then initiate another cycle of requests. Both the delivery manager and the disk manager are parts of the media server. When the media server receives a query script, the delivery manager rst parses the query script and then executes the delivery scheduling routine. The scheduling routine merges the query script into the current delivery schedule by using the proposed scan scheduling algorithm. The delivery manager generates a list of disk blocks to be retrieved according to the schedule, and sends it to the disk manager. The disk manager retrieves the data blocks into memory buers, then transfers them to the client through the network. This simulation does not use network delay or network congestion models since appropriate multimedia networks should be able to handle the maximum number of 150 KB/sec streams that the current disk model supports. The disk manager simulates a HP 97560 disk following the model and methodology used in [24]. The disk model calculates seek time, rotational delay, head switch time and data transfer time for each disk request. A disk request consists of an entire track of data which is 36 Kbytes. The model uses a piecewise linear approximation of the disk's S. T. Campbell and S. M. Chung Table I. Disk drive simulation parameters Number of Cylinders 1962 Number of Tracks per Cylinder 19 Number of Data Sectors per Track 72 Sector Size (bytes) 512 Data Transfer Rate 2.3 MB/sec Rotation Speed 4002 RPM d, d < 383 cylinders Head Switch Time 1.6 ms Controller Overhead 2.2 ms actual seek time with seek distances determined by the placement of multimedia streams on the disk. In our simulation, to determine whether a schedule is feasible or not, the delivery manager uses the xed maximum number of continuous multimedia streams that the disk model can deliver concurrently. The theoretical maximum number of streams that the disk can deliver is limited by the disk bandwidth. In practice, the actual number of concurrent streams that can be delivered is signicantly lower than this due to the random distribution of seek delay. We experimentally determined the maximum number of streams that the disk can continuously support by increasing the number of streams being delivered while monitoring disk bandwidth utilization and the number of data under- runs. In our simulation, each stream is stored as a sequence of randomly selected tracks. We select the maximum number of serviceable streams to be one less than the point where disk bandwidth utilization reaches 100% or a data underrun error occurs. Figure 7 shows the maximum and average disk bandwidth utilization recorded during a simulation run of 10,000 seconds. During the simulation, one track for each stream is delivered during each xed disk service round. One disk service round is the period of time to playback the data in one buer. In our simulation a buer stores a whole disk track, and the playback rate is assumed to be 150 KB/sec. Disk head movement is based on the Grouped Sweeping Scheduling Delivery Scheduling of Multimedia Streams 13 (GSS) algorithm [27], where the number of groups is one. The amount of extra time in each disk service round after delivering one track for each stream gives us the disk bandwidth utilization percentage. The average disk bandwidth utilization is the statistical average from all the disk service rounds, and the maximum disk bandwidth utilization is the largest of all the disk bandwidth utilizations of disk service rounds during the simulation. From Figure 7 we selected eight as the maximum number of simultaneous streams that can be serviced continuously. Figure 7. Determining the maximum number of serviceable streams The disk model uses multiple buers for retrieving each multimedia stream. One buer is loaded with the data from the disk while the data in another buer is delivered to the client workstation. Multiple buering results in e-cient continuous data retrievals from the disk but forces a startup delay of at least one disk service round as the rst buer is lled for each stream. Startup delay is the amount of time between the client request and the delivery of the rst data block to the client. Usually two buers are allocated for each stream for double buering, except for the case of prefetching multiple tracks of a stream for scheduling optimization. During the simulation we capture disk bandwidth utilization, startup delay and interstream latency, which is the gap between two consecutive streams. For the experiments using the proposed predelivery optimiza- tion, we also capture memory usage. The resulting output data are collected after a xed length warm-up period to remove startup tran- sients. We also perform 10 simulation runs of 10,000 seconds to obtain the average values considering the stochastic nature of the simulation. 14 S. T. Campbell and S. M. Chung Each run consists of a xed number of clients and each client makes a new request when its current request is completely served. 3.2. Performance of Scan Scheduling The goal of using query scripts is to eliminate the gap between two consecutive streams that we may have with the baseline approach. This gap is a result of the client individually requesting each stream. The delivery manager queues the requests if the required disk bandwidth is not available, and streams are then serviced on a rst-come-rst-served basis. The length of this gap increases as the number of streams increases because system work load increases. Figure 8 shows the average and maximum latency between streams for the baseline experiments. The baseline approach has an average of 0.75 second latency for three to ve clients. However, the average interstream latency increases rapidly as disk contention becomes higher, which is after six clients. At this higher load there are more requests than available resources and the system queues the requests for streams. The interstream latency has the eect of creating gaps and problems in the delivery ordering. Figure 8. Interstream latencies With larger loads the interstream latency can increase to 30 to seconds between every two streams. In this simulation, where the client request has four playback intervals, the total interstream latency can easily be several minutes long. With query scripts there are no gaps between streams as shown in Figure 8. The scheduling algorithm ensures su-cient resources for the delivery of all the streams in the query scripts. Delivery Scheduling of Multimedia Streams 15 The benet of contiguous presentation of each query script comes at the cost of increased startup delay. Figures 9 and 10 show the average and maximum startup delay of the baseline and scan scheduling experiments. The startup delay of the baseline experiments follows the pattern of the interstream latency since there is no scheduling. Delivery begins whenever system resources become available. The scan scheduling experiments show an increase in startup delay since the system starts the delivery of a query script when it maintains a feasible schedule. The startup delay becomes high as the contention for system resources grows, because the scheduler needs to delay the start times of query scripts to manage contention. Figure 9. Average startup delay Figure 10. Maximum startup delay S. T. Campbell and S. M. Chung Figure 11 illustrates the delivery characteristics of the baseline approach and the scan scheduling based on the query script. The baseline approach experiences both interstream latency and loss of synchronization due to the heavy system work load. The scan scheduling approach may experience a larger startup delay since the system creates a delivery schedule that ensures su-cient resources for the complete delivery of the query script. The baseline approach can start the delivery earlier since no such guarantee exists. Figure 11. Delivery timing Predelivery optimization lowers the startup delay as can be seen from Figure 9 and Figure 10. This benet comes from prefetching the data and thus being able to nd a feasible schedule with earlier start times of query scripts. The optimizer uses memory to hold prefetched blocks of the multimedia streams. Figure 12 shows the memory utilization for the predelivery optimization of the scan scheduling algorithm. Memory usage quickly grows as the number of clients increases. Our next simulation experiment limited the amount of memory to 20 MB for the predelivery. Figure 13 shows little change in the average and maximum startup delay with this memory limitation because most of the infeasible schedules require only a small amount of predelivery to become feasible. Figure 14 shows the distribution of actual startup delays for a simulation run of scan scheduling with optimization. This distribution shows that a high percentage of requests start within a short period. With ve clients, 65% of all requests are started within 9 seconds, and with six clients, 65% of them are started within 28 seconds. The next analysis examines the disk bandwidth utilization. We measure the disk bandwidth utilization as a function of the disk's idle time during each disk service round. In Figure 15 we can see that the average disk utilization is highest for the baseline cases. Without scheduling, Delivery Scheduling of Multimedia Streams 17 Figure 12. Memory usage for the predelivery optimization Figure 13. Startup delay with/without memory limitation the system service requests are made as quickly as possible, and results in a higher disk utilization level. However, since these simulations were performed for a xed continuous work load, lower disk bandwidth utilization, while maintaining the same delivery throughput, indicates a more e-cient scheduling methodology. It implies that more time remains in each disk service round for additional requests including non-stream requests. The approach of interleaving the access of continuous streams with non-continuous data allows the same disk system to service multimedia objects and traditional le accesses. Figure 15 also shows that limiting the buer memory size to 20 MB for the predelivery has no eect on the disk bandwidth utilization. S. T. Campbell and S. M. Chung Figure 14. Distribution of startup delay Figure 15. Average disk bandwidth utilization In this article, we considered constant-bit-rate (CBR) streams with the constant playback rate of 150 KB/sec. However, modern digital videos use variable-bit-rate (VBR) compression, such as MPEG [13, 15, 21, 22], where the data consumption rate during the playback is dierent for dierent frames. For the retrieval of VBR streams, we can use Constant Time Length (CTL) retrieval or Constant Data Length (CDL) retrieval [6]. With CTL retrieval, variable amount of data is retrieved for a stream during each disk service round, but the playback time is the same during the next service round. On the other hand, with CDL retrieval, xed amount of data is retrieved for a stream during Delivery Scheduling of Multimedia Streams 19 each disk service round, but the playback time is dierent during the next disk service round. If the buer has enough data for the playback during the next disk service round, no data is retrieved during the current disk service round [1]. If we use CDL retrieval, the scan scheduling algorithm can be applied as described above because xed amount of data is retrived for a stream during each disk service round. However, to use CTL retrieval, we can adopt the Generalized CTL (GCTL) proposed in [2]. In GCTL, the duration of the CTL retrieval round is an integer multiple of the duration of the disk service round, so that xed amount of data is retrieved for a stream during each disk service round. Thus, the Scan scheduling algorithm can be used along with the GCTL retrieval. Networking is a critical issue in the delivery of multimedia streams, especially for VBR streams [10, 14, 26]. However, this article is focused on the retrieval scheduling of multimedia streams from a disk subsystem within a media server, and networking issues are beyond the scope of this article. As the main goal of scan scheduling algorithm is to satisfy the inter-stream synchronization specications, supporting video-like operations, such as rewind and fast-forward operations, on a specic stream is not easy. If a user initiates a video-like operation on a stream being presented, that stream is removed from the corresponding query script, and the system should change the current delivery schedule. The video- like operation should be regarded as a separate request, and its disk bandwidth requirement should be considered to generate a new sched- ule. If there are many query scripts being serviced, so that there is not enough disk bandwidth available, the start of the requested video-like operation may be delayed. 4. Group Scheduling In this section we look at an additional optimization technique that extends the scan scheduling algorithm in order to improve system resource utilization. The scan scheduling algorithm does not perform any optimization after it nds a feasible schedule with the earliest start time for a new query script. However, if we nd other feasible schedules, we can select a schedule that better uses resources and reduces the overall query script startup delay. For example, if the rst feasible schedule for a new query script happens to have a set of intervals with high disk bandwidth utilization late in the schedule, then all following query scripts must start after this point of high utilization. However, if the new query script's start time is slightly delayed, then a new schedule is S. T. Campbell and S. M. Chung created that might avoid the intervals with high utilization levels, and hence allow other query scripts to start earlier. Pass Integrate into a test schedule Is the test schedule feasible? Include the test schedule in the Apply the metrics to the candidate schedules and select the best one Select another start time in the time window to find a feasible schedule Apply the Scan scheduiling algorithm Fail set of candidate schedules Start Figure 16. Group scheduling algorithm 4.1. Creation of Candidate Schedules To nd multiple feasible candidate schedules for a new query script, we check all possible start times within a xed time span from the earliest start time of the query script that we obtained by applying the scan scheduling algorithm. The xed time span is called time-window and it prevents us from considering too many candidate schedules with dierent start times for the new query script. Moreover, it is not desirable to delay the start time too much in favor of other performance metrics. Once we have a set of candidate schedules, we can select a schedule based on some performance metrics. This scheduling algorithm is named group scheduling and is shown Figure 16. The scan scheduling algorithm always minimizes the startup latency of a new query script since it selects the rst feasible start time. Group scheduling may increase the startup delay of the new query script by selecting a start time that better uses system resources. However, limiting the additional latency is important so that the process of optimizing Delivery Scheduling of Multimedia Streams 21 the delivery schedule of multiple query scripts does not inadvertently make the new query script unduly suer with a long startup delay. Some metrics could select a start time that maximizes the startup delay of the new query script. For example, selecting a schedule with the lowest maximum disk bandwidth utilization level may be desirable so that we can accommodate more query scripts later. However, this strategy leads to starting the new query script at the end of all current scheduled query scripts. Figure 17 shows a sample case where this situation occurs. Figure 17(a) depicts the existing schedule and the new query script. Immediately starting the new query script results in a delivery schedule with a maximum utilization of 8, as shown in Figure 17(b). Starting the new query script at the end of the current schedule, as in Figure 17(c), results in a maximum utilization of 5. The strategy will thus select the schedule in Figure 17(c) which maximally delays the start time of the new query script.(a) Existing Delivery Schedule and a New Query Script (b) Test Schedule - New Query Script Starts Immediately(c) Test Schedule - New Query Script Starts at the End New Query Script Current Schedule33 Figure 17. Increased startup delay problem The time-window limits the additional startup delay of the new query script because only feasible schedules with a start time falling within the time-window are allowed to be candidate schedules. Varying the length of the time-window controls the maximum startup delay for the new query script. The trade-o is that larger time-window size provides more candidate schedules for selection at the cost of potentially increasing the startup delay of the new query script. In our simulation we used 10 seconds as the time-window size. 22 S. T. Campbell and S. M. Chung 4.2. Selection Criteria Once a set of candidate schedules is created, the next task is to select the best schedule. The selection algorithm ranks each candidate schedule based on a metric and then selects the schedule with the highest rank as the new delivery schedule. The metric identies schedules that exhibit desirable properties based on the optimization goals. One optimization goal is to reduce the sum of all query scripts' startup delay. Another goal is to better use system resources such as disk bandwidth. We use disk bandwidth utilization since it measures the e-ciency of data transfer between the disk drive and memory. Basically we seek schedules that minimize spikes and other big changes in disk band-width utilization so that the startup delay of later query scripts will be reduced. The example in Figure depicts how poor selection of a schedule impacts the query scripts submitted later. In Figure 18(b) the scheduler integrates the new query script into the existing schedule such that one service interval has a high utilization of 8. As a result, the start of the next query script is delayed until after that interval. However, if the schedule integrates the new query script as in Figure 18(c) by delaying its start, then the maximum utilization level becomes 6 and the next query script may start earlier. (a) Existing Delivery Schedule and a New Query Script (b) Test Schedule - New Query Script Starts Immediately New Query Script Current Schedule3 5 5 38 New Query Script Starts Here (c) Starting New QS Later Avoids a High Utilization Level Figure 18. Optimizing query script integration With these basic optimization goals in mind, we identied the following optimization strategies that are summarized in Table II and fully described below. Delivery Scheduling of Multimedia Streams 23 Table II. Summary of selection metrics Smallest Startup Delay Scan scheduling algorithm Biggest Soonest Highest utilization level early in the schedule Monotonic Decreasing Consistently decreasing utilization level Highest Floor Schedule with the highest minimum utilization level Lowest Ceiling Schedule with the lowest maximum utilization level Minimum Dierential Schedule with the smallest dierence between the maximum and minimum utilization levels Time at Minimum Schedule with the largest total time period at the minimum utilization level Smallest Startup Delay The rst strategy corresponds to the scan scheduling algorithm where we select the rst feasible schedule. The advantages of this methodology are that each query script starts as quickly as possible and the optimization overhead is low because other candidate schedules are not considered. Biggest Soonest In this strategy, we rank the schedules based on the end time of the last interval with the highest disk bandwidth utilization. The scheduler then selects the schedule with the smallest end time, which corresponds to the schedule with its highest utilization level ending sooner than other schedules. As a result, we can avoid cases where an interval late in the schedule delays other query scripts because of its high utilization level. Selecting schedules that have their high utilization levels early allows other query scripts to start earlier. Monotonic Decreasing In this strategy, we record the earliest time within each schedule from which the bandwidth utilization remains the same or decreases. The earlier this time, the better the schedule. The biggest-soonest strategy is based upon only the last time of the highest bandwidth utilization. Thus it ignores the behavior of all other intervals in the schedule. On the other hand, the monotonic decreasing strategy measures the tendency S. T. Campbell and S. M. Chung to have higher bandwidth utilization levels sooner and lower utilization levels later in the schedule. Selecting a schedule that exhibits decreased bandwidth utilization levels late in the schedule again makes it easier to schedule other query scripts with smaller startup latencies and increases the near-term disk bandwidth utilization. Highest Floor This strategy looks at the minimum disk bandwidth utilization as a measure of the schedule's e-ciency. The \ oor" represents the lowest bandwidth utilization level of the schedule. Since most schedules have at least one interval with a low utilization level, the lowest oor is not considered. Instead, in this strategy we select a schedule with the high- est oor. The idea is that schedules with consistently high utilization levels can retrieve more data in the same period of time, and hence make better use of the resources. Lowest Ceiling The \ceiling" represents the highest bandwidth utilization level of the schedule, and this strategy selects the schedule with the lowest ceiling. This is an attempt to select a schedule with consistent disk bandwidth utilization. Selecting a schedule with a high ceiling does not make sense because a single short interval with maximum utilization occurs fre- quently. Schedules with consistent utilization as characterized by low ceilings can allow other query scripts to be scheduled at the earliest possible time, which reduces their startup delay. Minimum Dierential A logical combination of the highest oor and lowest ceiling strate- gies, described above, is to select a schedule that has the smallest dierence between its ceiling and oor. These schedules have consistent performance which makes it easier to integrate other query scripts into them. Time at Minimum The nal metric that we considered is the amount of time a schedule spends at the oor. The longer the schedule uses the oor utilization, the more disk bandwidth is available to other query scripts. 4.3. Adding Predelivery Optimization to the Schedule Selection Let's consider the role of predelivery optimization in creating candidate schedules. There are three basic approaches. The rst is to perform Delivery Scheduling of Multimedia Streams 25 predelivery optimization only on the nally selected delivery sched- ule. The second is to perform predelivery optimization on all potential schedules | one for each possible start time of the new query script | to identify the feasible candidate schedules. The nal approach is to make the predelivery overhead a part of the metric. The rst case, performing predelivery optimization only on the selected schedule, reduces the optimization time, but it decreases the possibility of nding the best. Predelivery optimization makes more schedules feasible at the cost of adding more time to the group scheduling process. The additional time necessary for predelivery optimization is around 100 ms per schedule in our simulation. However, the simulation results show that we can reduce the average startup delay of query scripts by about 5 seconds if we apply the predelivery optimization (with a time-window of 10 seconds) on all potential schedules. Thus performing predelivery optimization on all potential schedules is benecial. The last option, including the predelivery overhead into the metric, can be simply done by using the total amount of memory used by the predelivery as a tie-breaker. When the selection metric values are equal, the memory usage for predelivery determines which schedule to select. 4.4. Performance of Group Scheduling We use the same simulation environment and disk model for the simulation of group scheduling as were used in the simulation of scan scheduling. For each query script requested from a client, the new group scheduling algorithm rst creates a set of candidate schedules by selecting feasible start times for the new query script. As with the scan scheduling algorithm, only the start and end points of the service intervals in the current schedule are the potential start times of the new query script. This dramatically cuts down on the number of candidate schedules to be evaluated. The scheduler then creates a test schedule for each potential start time for the new query script. If this test schedule is not feasible, predelivery optimization is applied as an attempt to make it feasible. The collection of all feasible schedules found from this trial integration process becomes the set of candidate schedules. Then one of the candidate schedules is selected for the new query script based on the selection metric. In our simulations, we limited the buer memory size to 20 MB for the predelivery optimization. First we compare various selection strategies (using dierent met- rics) in terms of the average startup delay of the scheduled query scripts. Figure 19 shows the results of experiments with four to ten clients. The scan algorithm has slightly higher average startup delay for 26 S. T. Campbell and S. M. Chung many cases. With six clients the resource contention begins, and it is at this point that group scheduling begins to in uence the results. How- ever, since the average startup delays with dierent selection strategies are quite similar, we can conclude that much of the improvement comes from the small delay added to the start time of the new query script. Selecting the best schedule from the candidate schedules with dierent start times provides a 5{7% improvement in the average startup delay. Figure 19. Average startup delay Figure 20. Maximum startup delay A larger improvement is seen in the maximum startup delay as shown in Figure 20. Compared to the scan scheduling, the group schedul- Delivery Scheduling of Multimedia Streams 27 ing algorithm reduces the maximum startup delay by around 10%, or seconds for runs with high numbers of clients. Figure 21 shows the amount of memory used for the predelivery optimization with the group scheduling algorithm. The memory usage does not play a role in the selection metrics but the maximum limit can make some potential schedules infeasible. The group scheduling algorithm better uses disk bandwidth (as will be explained below) and hence does not require as much predelivery optimization as the scan scheduling algorithm in many cases. Thus the memory usage for the predelivery optimization with the group scheduling algorithm is usually lower than that with the scan scheduling algorithm. Figure 21. Memory usage for the predelivery optimization The next analysis examines the disk bandwidth utilization. We measure the disk bandwidth utilization as a function of the disk's idle time during each disk service round. In Figure 22 we can see that the average disk bandwidth utilization is higher for all the group scheduling cases than for the scan scheduling. It is because more information can be delivered in a shorter period of time with group scheduling, as evidenced by the smaller startup delay of the query scripts. 5. Conclusion In this paper we presented a new methodology for delivering multi-media objects from a multimedia database system that maintains the temporal ordering requirements specied by the client. We developed delivery scheduling algorithms that ensure su-cient system resources 28 S. T. Campbell and S. M. Chung Figure 22. Average disk bandwidth utilization to meet the client's temporal ordering requirements. To obtain the client's requirements, we introduced the query script which is a new interface between clients and multimedia database systems that allows the client to completely specify a set of multimedia objects and their temporal relationships. With this information and the proposed scheduling algorithms, the delivery manager creates a delivery sched- ule. To minimize the resulting startup delay for each query script, we use a predelivery optimization technique that prefetches disk blocks to memory. A series of system simulations shows the eects and benets provided by the proposed delivery scheduling algorithms. Without query scripts, the clients experience large interstream latencies since no global delivery scheduling is possible. For example, simulations showed the maximum interstream latency of 40 seconds with six clients. With query scripts there is no interstream latency. Once the presentation of a query script begins, desired temporal order and synchronization of multimedia streams are perfectly satised. With the scan scheduling using query scripts, the average startup delay may increase as the delivery manager delays the start of some query scripts to maintain feasible schedules. However, the increase in the startup delay for a client with scan scheduling is quite comparable to the total interstream latencies with the baseline approach. That means the delivery throughput is quite comparable in both cases. Moreover, the scan scheduling algorithm requires less disk bandwidth for the same delivery throughput, and the limited buer memory for predelivery optimization does not affect the delivery performance. The group scheduling algorithm extends the scan scheduling algorithm by examining multiple potential retrieval Delivery Scheduling of Multimedia Streams 29 schedules and selecting the best schedule. This algorithm rst creates a set of candidate schedules, uses a predened selection metric to rank them, and then selects the best schedule. We proposed various selection metrics and discussed their implementation and benets. Compared to the scan scheduling, the group scheduling results in a 5% decrease in the average startup delay and a 10% decrease in the maximum startup delay while maintaining better memory and disk bandwidth utilization. The computation overhead of the group scheduling is around 100 ms for a potential schedule, so it is almost negligible compared to the performance gain. --R Multimedia Information Storage and Management An Introduction to Database Systems ISO 10744 ISO Multimedia and Hypermedia Experts Group (MHEG) Computer Science: A Mathematical Introduction Getting Started with CSIM17: Users Manual MHEG Center MPEG Video Compression Standard --TR --CTR Soon M. Chung , Anil L. Pereira, Timed Petri Net Representation of SMIL, IEEE MultiMedia, v.12 n.1, p.64-72, January 2005 Harald Kosch , Ahmed Mostefaoui , Lszl Bszrmnyi , Lionel Brunie, Heuristics for Optimizing Multi-Clip Queries in Video Databases, Multimedia Tools and Applications, v.22 n.3, p.235-262, March 2004
query script;optimization;simulation;delivery scheduling;multimedia streams
597249
Fundamentals of Scheduling and Performance of Video Tape Libraries.
Robotic tape libraries are popular for applications with very high storage requirements, such as video servers. Here, we study the throughput of a tape library system, we design a new scheduling algorithm, the so-called Relief, and compare it against some older/straightforward ones, like FCFS, Maximum Queue Length (MQL) and an unfair one (Bypass), roughly equivalent to Shortest Job First. The proposed algorithm incorporates an aging mechanism in order to attain fairness and we prove that, under certain assumptions, it minimizes the average start-up latency. Extensive simulation experiments show that Relief outperforms its competitors (fair and unfair alike), with up to 203% improvement in throughput, for the same rejection ratio.
Introduction Even though secondary storage devices (based on magnetic disks) have become cheaper and increased their storage capacity at remarkable rates, they still cannot satisfy economically the storage requirements of video-based databases for many demanding applications, such as video-on-demand, digital libraries, tele-teaching, video broadcasting, etc. Tertiary storage and, in particular, tape libraries, offer an economical solution. For example, tape storage, even when considering high-end tape library products (such as the Ampex DST812 robotic library), costs less than 3 cents/MB, while for high-end disk array products (such as Maximum Strategy's Gen-5 product) the cost is about cents/MB. Furthermore, the above figures cover only the "capital" costs and do not include the high maintenance costs of disk storage, which is reported to This work has been partially supported by the ESPRIT Long Term Research Project HERMES (project number 9141). y Costas Georgiadis and Peter Triantafillou are with the Department of Electronics and Computer Engineering, Technical University of Crete, Crete, Greece. e-mail addresses: fgeorgiad,[email protected]. z Peter Triantafillou is the contact person x Department of Computer Science, Carnegie Mellon University, Pittsburgh, USA (e-mail address: [email protected]). This material is based upon work supported by the National Science Foundation under Grants No. IRI-9625428, DMS-9873442, IIS-9817496, and IIS-9910606, and by the Defense Advanced Research Projects Agency under Contract No. N66001-97-C-8517. Additional funding was provided by donations from NEC and Intel. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation, DARPA, or other funding parties be $7/MB ([17]). Considering that (i) the storage for a 12 database containing a few thousand videos costs less than $400,000 if a high-end tape library is chosen (e.g., the price for the Ampex DST812 with four drives and 256 50GB tapes) and over $4,000,000 if a high-end disk array is chosen (e.g., the price for 8 Maximum Strategy's Gen-5 arrays, each storing 1.7TB) and that (ii) medium-sized companies are reported to be willing to spend up to $125,000 annually for mass storage systems, one can see why robotic, near-line tape libraries are very desirable. For reasons such as these, the tape library market is growing with an annual pace of 34% ([17]). However, robotic tape library access times remain about 3 orders of magnitude slower than that of disk-based storage, due to costly robotic exchange and tape positioning operations. For this reason, many demanding applications involve all the above-mentioned storage levels into hierarchical storage servers in which the higher and fastest level is the disk storage which acts as a cache and the lowest and slowest is the robotic tape library. In fact, several real-world products for applications such as Digital TV broadcasting and digital video effects are relying upon such storage technology infrastructure ([8]). Since the tape library level is the slowest, any performance improvement in transfering data from this level improves considerably the overall storage hierarchy performance. Our goal with this paper is twofold. First, we study the central issue of scheduling retrieval requests for tertiary-storage-resident video objects, and second, the performance fundamentals of such a tertiary storage robotic tape library in video databases. 1.1 Tape Library Technology Overview Tape libraries typically consist of robot arms, tape drives and a large number of tape cartridges. The robotic mechanism loads/unloads the tapes from/to the shelves to/from the drives. The tape technology employed is either linear or helical scan recording ([1, 9]). Linear tapes have their tracks parallel to the tape's axis, and can be read by batches either in one direction or in both (e.g., serpentine drives). Helical scan tapes have their tracks at an angle with the tape's axis. A rotating drum can read the tracks while the tape moves in one direction. In addition, there is a great variability in the storage capacity of each tape cartridge, with typical values ranging from a few GBs up to 330GB. The total access time in tape libraries is considerably high. Searching within a tape proceeds at best with a pace of 1.6GB/s plus a startup cost of a few seconds. Many vendors report robotic delays less then seconds, which, at least for smaller-capacity tapes, can bring the total access cost below a few tens of seconds. Currently, there are tape drive products offering transfer rates up to 20MB/s (with no compression). 1.2 The Problem Application Requirements: Video databases have high storage requirements. For example, a single MPEG-2 90-minute video typically requires at least 2-3GB of storage. Reading of an MPEG-2 video from a tape can take from about 100 seconds to about 20 minutes, depending on the tape drive's performance capabilities. Video accesses follow a skewed distribution. Thus, the multicasting (or batching) of a single reading of a video for all its requests may prove very beneficial. However, due to VCR-type interactions, requests may be for different parts of a video, prohibiting such multicasting. Thus, both workloads types should be considered. Finally, requests should be served within a certain time threshold (i.e., in (near-)video-on-demand applications) or the users "drop out". Algorithms that ensure low start-up latencies (for "lucky" requests) at the expense of a high drop-out/rejection ratio, will not have a real-world usefulness. An efficient scheduling algorithm must achieve high throughput, while respecting rejection ratio constraints. System-Level Issues: Our library has three different types of resources for which requests compete: the tapes, the tape drives, and the robots. To service requests, simultaneous resource allocation is necessary: a request has to possess the tape it wants (or a copy of it, if we have replication), as well as to possess a tape drive, and, maybe, a robot arm, if the tape is not already loaded. Simultaneous resource allocation makes efficient scheduling a formidable task. The problem at hand, therefore, is twofold: first, to devise efficient scheduling algorithms that are appropriate for such a complex environment and examine their performance, and second, to study which resources form the bottlenecks, under which circumstances, and what can be done to alleviate these bottlenecks. The second problem will be addressed by examining the impact of the length of the service times, of the number of tape drives, and of the number of robots employed. The settings of these parameters create bottlenecks at either the robot or the drive resources. Our approach is both experimental and analytical. We will first develop an optimal scheduling algorithm for a simplified problem setting. Then, we will adapt that algorithm to our environment. The experimental study will compare the performance of this algorithm to that of others found in the literature and study the general performance characteristics of the video tape library. In section 2, we overview related work. In section 3, a description of the tape library model is provided. The detailed description of three scheduling algorithms is presented in section 4. In section 5, we contribute a formal problem formulation and an optimal scheduling algorithm called Relief. In section 6, we explain how could tape replication be incorporated into the scheduling algorithms. In section 7, we present the results derived from our experiments. Finally, an overview of our work is presented in section 8. Related Work Despite the facts that tape library storage (i) has been recognized as the most economical mass storage medium for applications such as video servers, (ii) suffers from very high access times, (iii) is currently employed by many real-world video delivery/manipulation products, and (iv) enjoys high market growth rates, to our knowledge there is no reported study of efficient scheduling of video tape library acceses, nor an experimental investigation of the performance issues in video tape library environments under efficient scheduling algorithms. Related work has mostly concentrated on modeling the performance characteristics of tape drive and tape library products ([1, 9, 13, 14]), on comparative studies of the use of tertiary storage for multimedia ([1, 2, 7]), on storing and elevating video blocks from tertiary for playback ([5, 18]), on caching digital library documents in secondary storage ([15]), on striping and analytical modeling of tape libraries under FCFS scheduling ([6, 12]), on algorithms for optimal data placement in tertiary libraries ([3]), and on scheduling random accesses to traditional data on single (serpentine and modified serpentine) tapes ([10, 11]). In [16], the authors contributed a scheduling algorithm for video tertiary libraries which is useful when several drives compete for one robotic arm, the queuing delays for which could otherwise cause hiccups. 3 Tape Library Simulation Model One can distinguish the operations of a tape library's components into robot arm, and tape drive operations. A robot arm performs three fundamental tasks: the load, the unload and the move operations. The load operation consists of grabbing a tape cartridge from a shelf and putting it into a drive. The unload operation consists of grabbing a tape from the drive and putting it back on the shelf. Loading and unloading require arm movement to and from a shelf. A drive performs four operations, namely the medium load and the medium eject, the tape search/rewind and the tape read (playback). Tape libraries consist of three key resources: tape drives, robot arms, and tapes. Contention for these three resources cause queuing delays. A queuing delay for a tape occurs when a request for a tape cannot be served (even though there may be available drives and robots) because the desired tape is already in use serving another request. A robot queuing delay occurs when there is no available robot arm while there is a request that requires one. Finally, queuing delays for drives occur when there are no available drives to be used by waiting requests. Notice that we have the case of simultaneous resource occupation : A request may have to wait for its tape to be available; for an empty tape drive; and, possibly, for a free robot arm, if the desired tape is not already loaded. Our model simulates a closed queuing network for a tape library. Our library consists of D tape drives, R robot arms, and T tapes. The robots are considered similar meaning that every operation that a robot can perform, can also be performed by every robot at the same time. The tape drives are also considered similar. In our model each tape contains a single video object. This was done for simplicity, since it allows us to bypass dealing with issues such as the efficient placement of video objects within tapes, declustering issues, etc., which are research issues on their own right. Every time an object is accessed, the time spent by the drive transferring data depends on the object's size and on the drive's transfer rate. After a video object is accessed a tape rewind is performed. We denote the sum of the transfer and the rewind time with the term access time (t access ) and we will measure it in seconds. In multicasting environments, for simplicity, we assume that all requests have the same transfer time (i.e., video size). In unicasting environments this is not the case, since we wish to model random accesses within a video. In the case where a robot invocation is required, the following operations take place: a 'drive unload' of the old tape in the idle drive with simultaneous move of the robot arm towards the drive, a 'robot unload' of the tape, robot movement and placement of the old tape on the shelf, robot movement and unload of the new tape from the shelf, and, finally, robot movement and drive load with the new tape. The whole procedure just described takes practically constant time (it has been found to be independent of the relative location of tapes ([1]) and is termed mount time (t mount ) and we will also measure it in seconds. We implicitly assumed that when a drive becomes idle (i.e., there is no request that requires an access on it), its tape remains in the drive and is placed off-line (i.e., is moved away from the drive) only if there is a request for another tape and the host drive must be used 1 . We model the user behavior, i.e., the way in which the user issues requests to the library, by associating with each object an access probability (p request for a tape playback is made according to the access probabilities of the objects. We will assume, as is the standard practice in related work, that the videos' probability distribution follows a Zipf distribution, which has been found to closely reflect user preferences. where the exponent controls the skew of the distribution: the greater the exponent the more skewed the distribution. Typical exponent values found in the literature range from 0.73 to 2 ([1, 4]). Note that in a hierarchical storage video server, with primary and secondary storage acting as caches for the tertiary, the secondary storage cache will be absorbing requests for the most popular videos. This will definitely affect the skew of the Zipf distribution. However, our experiments have shown that reasonably-sized secondary storage caches (with a storage capacity of 5% of the tertiary backing store) do not have the required bandwidth to service all requests for the most popular videos. Thus, the requests received by the tape library continue to follow a quite skewed distribution, and can be a significant percentage of the total requests submitted to the video server (see Appendix A). In the unicasting environment a request, in the best case, will have to wait for t access seconds in order to be serviced. If the requested tape must first be brought on-line, then the total service time cannot be less than t access +t mount seconds. Naturally, these times do not include any queuing delays for tapes, drives, and robots. In multicasting environments, a request may 'piggyback' on another, since with a single (possible) robot access and a single drive access, all requests for the same video are served. Thus, the total cost is amortized over all piggybacking requests. Our queuing system model is depicted in figure 1. It uses a queue where incoming requests wait for service. This queue is termed wait for idle drive queue (WIDQ). When a drive becomes idle, the scheduling algorithm will pick a request (group) from this queue to serve. Since robot involvement may be required, 1 Some tape drives actually unload a tape which has been idle for a long period of time. However, this is a minor issue since scheduling is of primary concern in systems with heavy loads. there is a queue where the selected requests wait for a robot arm to become available. This queue is termed the (wait for idle robot queue (WIRQ)). WIRQ is only required when the number of drives is greater than the number of robots. robot 1 robot 2 robot R Idle Robot Queue drive 1 drive 2 drive D Drive Subsystem Robot Subystem Rejections Idle Drive Queue Figure 1: Queuing system for the library model. As mentioned, the requests to the library require simultaneous resource allocation. Each request requires first a tape resource, second, a drive resource, and when both have been assigned to it, it may require a robot resource (if the desired tape is not already loaded onto the assigned drive). There are two main types of events in the library: an arrival of a new request, and the completion of the service of a request. The essence of the system's operation is as follows: On arrival of a new request: ffl the request enters the WIDQ On completion of a request: (or while there is an idle drive): ffl the drive and its tape (if any) are declared 'available' for locking. ffl the scheduling algorithm is applied on the requests in the WIDQ. The selected request must be for an available tape. ffl the idle drive and selected tape are locked. ffl the request is queued at the robot, if necessary, in which case upon the completion of the robot service (taking t mount time), the playback starts. Requests waiting past a certain timeout exit the system (or the system rejects them). Also, for simplicity, in this paper we have assumed that requests in the WIRQ are served in a FCFS basis. Table 1 shows the system parameters and their typical values. Table 1: System and Problem Parameters Parameter Explanation Values D Number of drives 5 R Number of robots 1 or 2 T Number of tapes 300 access Drive access time 2 60, . , 230 secs mount Mount time: Robot drive load/unload 25 secs RO Replication overhead 0 or 20% storage space i The access probability of the i th video zipf of uniform skew parameter for Zipf +0.271, -0.271 t out Timeout before requests are rejected 5, 20, 1 mins Mean number of requests for the i th video per time unit TP Throughput in requests/hour achievable by an algorithm MPL Multiprogramming level (number of users) 20, . , 200 requests Scheduling Algorithms for Requests in the Video Tape library Next, we outline three basic scheduling algorithms. FCFS Scheduling: This scheduling algorithm picks the request closest to the head of queue (i.e., already in a tape drive and the oldest one) whose tape is available (i.e., not used by another request). This algorithm serves as a reference point for comparison purposes. Bypass Scheduling: This is similar to 'Shortest Job First': a younger request is allowed to bypass older requests, if it does not need a (costly) robot access. Bypass selects from the queue the oldest request for a tape that is already loaded in the idle drive. If no such request exists, Bypass behaves as FCFS. Bypass tries to minimize the costly robotic operations. In a multicasting environment, Bypass scheduling allows all requests in the queue waiting for the same video as the selected request, to piggyback onto the selected request. Bypass is an unfair algorithm, suffering from starvation. Thus, to become useful, it has to incorporate some aging mechanism to avoid starvation. In this paper, we study Bypass without aging, noting that its performance will be an upper bound for the performance of any useful Bypass-based algorithm with aging! The Maximum Queue Length (MQL) Scheduling: MQL is suitable for environments where multicasting is allowed. The algorithm partitions the waiting queue into a number of queues, one for each tape. At scheduling time, it selects to serve the queue with the greatest length. The motivation is to increase as much as possible the amortization benefits gained from multicasting. This algorithm has been studied in a similar context, namely that of efficient batching policies for video requests, where it has been found to perform very well ([4]). MQL also suffers from starvation. An MPEG-2 video with bandwidth 4Mb/s of 80 minutes (4800 seconds), needs 4800*4 Mbits=2.4GB of storage. A tape drive that transfers data at a rate of 12MB/sec will retrieve the video in 2.4GB/12MB/s=200s seconds. 5 A Formal Approach 5.1 Formal Problem Formulation Our goal is to find out which tape request to serve when a drive becomes available. Our answer is to pick the request that will maximize the 'relief ratio'. Next we give the definitions and the justification. First, we study a more structured problem. Consider a queueing setting, where we are given i) one server (e.g., I/O channel or a tape drive), able to broadcast/multicast data items (eg., video movies), ii) requests for T distinct video items, iii) the i-th video item has service length L i time units, iv) the i-th video item is accessed with probability p i and v) the requests for item i arrive with a mean rate i . Assuming that the access probabilities p i remain constant over time, we want to find how often we should schedule the multicast of item i That is, we want to find the cycle times C i for each item, so that we minimize the average waiting time (i.e., start-up latency) of the requests. Notice that the cycle time C i is an integer multiple of the unit time, and that it measures the time units from the beginning of one broadcasting of item i to the beginning of the next broadcasting. Theorem 1 For a single multicasting server with T items and access probability p i for the i-th item, the optimal cycle time C i for the i-th item is given by C Proof: The average waiting time W is given by The percentage of time units that the server is engaged with video i is L i =C i . Assuming that our server is never idle (i.e., utilization = 1) these percentages should sum to 1: Thus, we want to minimize Eq. 1 subject to the constraint of Eq. 2. Using the Lagrange multipliers' theory, we have ( and, using Eq. 2, we get . QED 5.2 The Proposed Scheduling Algorithm: 'Relief' For our initial scheduling problem, the crucial observation is that Eq. 3 implies Under the assuptions that i) the mean arrival rate is constant, and ii) the mean arrival rate for item i is we get that and, since s constant, Eq. 4 becomes2 i C i Intuitively, i C i accounts for the average number of requests we serve in every broadcasting of the i-th item; cumulative waiting time; (or the cumulative 'relief' enjoyed when broadcasting the i-th item!). When divided by L i , it gives us the amount of 'relief' enjoyed per unit time of broadcasting of item i. Let's call it the 'relief ratio' for the i-th item/tape: (cumulative waiting time 'Relief' scheduling: When the access probabilities p i are unknown, the single multicasting server should choose the object i with the maximimum 'relief ratio'. The justification is as follows: Eq. 6 implies that, under an optimal choice for the cycles C i (i =1; :::T ), the relief ratio for item i at the start of broadcasting of item i is constant and equal for all items. Clearly, this means that the relief ratio for item i is higher than the relief ratio of every other item at the second that we start broadcasting the i-th item: If item j had higher relief ratio, clearly its relief ratio would only increase further, waiting to be broadcasted, and thus it would further increase the inequality between the relief ratios of items i and j which goes against the principle of Eq. 6. This way we are assured that we did our best to achieve the maximum possible relief during the next L i service time units. In fact, if the access probabilities are constant over time, 'Relief' is indeed optimal, automatically leading to optimal-length cycles. Corollary 1 Our 'Relief' heuristic is optimal when the access probabilities p i are constant over time (even if they are unknown to us!) Proof (Sketch): Our server will automatically pick the i-th object that results in the optimal cycle times of Theorem 1. QED Our proposed scheduling algorithm is based on the previous proof that the relief ratio is the key for choosing the next request to serve. The Relief algorithm attempts to improve performance by minimizing the average start-up latency of video requests. This is achieved by calculating for every request in the queue, (a) its total wait time, and (b) its service time, and computing the 'relief ratio' for each request i, as service time i . Intuitively, the selected requests have either a long waiting time, and/or require small service times. Thus, in essence, the algorithm picks the request that results in the greatest wait time relief for the smallest resource-occupation time. Under multicasting, all requests for the same video form request groups and the algorithm then selects the group with the highest group relief ratio. The group relief ratio is computed by summing up the waiting times of all members of each group and dividing by the service time (once for the whole group). In addition to the novelty of the Relief algorithm, we note that aging mechanisms in scheduling algorithms are typically found ad-hocly, while ours is based on sound formal arguments. 6 Video Tape Replication Having a single copy of each object might not result in maximum drive utilization nor in satisfying start-up delays. To see this, consider the following scenario: In a library with ten tape drives, and in which the bypass, Relief, or MQL scheduling discipline is used, suppose there is a video with access probability of 0.9. This means that around 90% of the requests are pending for that "hot" object, a few drives have a small number of requests pending on them, and probably there are some idle drives. The following observation arises naturally: if we had another replica for that "hot" object, then one of the idle drives could be utilized and the performance of the system would be improved. This leads us to the notion of object replication: each of the T distinct objects might have a number of replicas. Furthermore, it is a logical choice if we maintain as many replicas for an object as its access probability induces. This way, for any two objects having access probability ratio equal to a it holds that the ratio of the number of their replicas equals aT 0 , where T 0 is the total number of tapes used to store replicas. We refer to T 0 with the term replication overhead using a fraction of T . For example, a library with T =100 and 20% replication overhead has T 0 =20 tapes used for replication and a total of T +T 0 =120 of tapes in the system. Replication can by applied for any of the basic scheduling algorithms, regardless of multicasting. The algorithms already described, need to be further tuned. So far, the algorithms were described with a single copy for each tape. If an algorithm selected a particular (group) request, that request must be one for an available tape. That is, if the desired tape was already in use in an active drive, then the algorithm had to select another request and repeat the process until a request was selected with an available tape. When there are replicas, each algorithm selects a (group) request to serve as long as one replica of the desired tape is available. 7 Performance Results For simplicity, when investigating how the system's resources (drives and robots) affect the performance, our primary performance metric will be the system throughput with rejections "turned off". The section that focuses on the performance comparison of the scheduling algorithms will use as the primary performance metrics the rejection ratio, and the system throughput with rejection ratio constraints, since these are the meaningful metrics in real-world applications. The number of distinct tapes (and, therefore, objects) is set to and a single robot arm is considered in the system (R = 1, unless otherwise stated). The robot mount time (t mount ) is set to 25 seconds and the drive access time (t access ) is set to 200 seconds (unless otherwise stated). We use the notation RO for "Replication Overhead". An RO of 0.2 means that there are T cartridges which store replicas of the objects. We used the Zipf distribution stated) to model the access probability distribution of the objects. 7.1 Impact of the Drive Access Time and Number of Robots130150170190210 Throughput R=1, D=5, Unicast, RO=0, theta=0.271 Average Startup Latency R=1, D=5, Multicast, RO=0, theta=0.271 (a) (b) Figure 2: Drive access time impact. Figures 2a and 2b show the throughput as a function of MPL for Relief for both unicasting and multicasting environments. The first thing to notice is the throughput under unicasting drops as the access time increases. This is easily explained since each request takes more time to be serviced forcing the waiting ones to stay longer in the queue. Interestingly enough, under multicasting, the Relief algorithm is not affected by the drive access time if the latter is less than about 100 seconds. This happens because, under multicasting, the throughput of the system is much greater compared to unicasting making the robot resource even a more severe bottleneck. This situation ceases to occur when, in the average case, only one drive is waiting to get loaded at any time, i.e., the time elapsed between two consecutive media exchanges for the same drive (i.e., the drive access time) is such that the robot arms have enough time to load the rest of the drives: access (D \Gamma 1) t mount =R (8) According to the above formula, the minimum access time so that the robots are not the bottleneck is mount =R, which is equal to 100 seconds in our graphs. This last observation suggests a criterion for when an extra robot arm is required or/and when no more drives are needed, and for which t access values the system's resources are well utilized. In figure 3, weshowhow increasing by one the number of robots affects the above-mentioned graphs. For Throughput D=5, tAccess=60s, Unicast, RO=0, theta=0.271, Relief Figure 3: Impact of number of robots. both unicasting and multicasting schemes, there is a considerable improvement in throughput. Additionally, note that the robot is no longer the bottleneck. When, for example, t access = 60s, we can see considerable performance improvement by adding a second robot arm. 7.2 Impact of the Number of Drives Figures 4a, 4b, and 4c show that the throughput increases proportionally with the number of the drives. This happens because the number of the requests in the system is large enough so that none of the drives is idle. Therefore, a duplication of the number of drives doubles the throughput and reduces the start-up latency in half. However, there is a limiting number of drives beyond which the performance of the system does not improve proportionally to the number of drives or even does not improve at all (see figures 4a and 4b, graphs for D= 10). This is due to the fact that the single robot arm has now become the bottleneck which results in drive under-utilization. The same things hold for each of the Bypass, FCFS and MQL policies (although not shown).100200300 Throughput R=1, tAccess=80s, Zipf, Multicast,RO=0, theta=0.271, Relief R=1, tAccess=[50s-110s], Zipf, Unicast, RO=0, theta=0.271, Relief R=1, tAccess=[50s-110s], Uniform, Unicast, RO=0, theta=0.271, Relief (a) (b) (c) Figure 4: Effect of the number of the drives on system's performance. From figures 4b and 4c one can witness that the more skewed the access frequencies, the better the performance under the Relief discipline. This happens because in Relief (as well as in Bypass), under skewed distributions, the selected request has a higher probability of finding the desired video on-line. On the other hand, although not shown, for the FCFS and MQL algorithms almost no improvement is observed if a more skewed distribution is used. FCFS policy benefits from the more skewed distribution only if the first request picked from WIDQ, at an idle drive emergence, is for the video just released. The probability that the last occurs, increases very slightly when the uniform distribution is replaced by the Zipf one. 7.3 Performance Comparison of Scheduling Algorithms Under Unicasting We use t access =200secs to be sufficiently away from the point where we have robot bottlenecks as seen in section 7.1. 7.3.1 Rejection Ratio The first performance metric of concern is the rejection ratio which is defined to be the fraction of rejected requests over all requests submitted to the system. For this reason, in our runs, we associate with each request a timeout, after which, if the request has not been scheduled yet, it is rejected. Figure 5 shows the results for two different timeout values. There are two main observations. 1. FCFS, MQL and Relief have very similar performance. This is justified since all three algorithms in a unicasting environment tend to choose requests from the head of the WIDQ. For this reason we only show in the graph the performance of Relief and Bypass. 2. There are two fundamental observations regarding the performance of the rejection ratios of Bypass and Relief. (a) Bypass benefits more when the number of rejections is high (either because of low timeout values, or because of high MPL values). This happens because, in Bypass, rejected requests, when they re-enter the system, they get another chance to be "lucky" requesting a loaded tape. (b) Relief is, by nature, a fair algorithm. It tries to evenly distribute the waiting times among requests and establish the same waiting time for them. As MPL increases this waiting time approaches and surpasses the rejection timeout. This leads to smaller rejection ratios in Relief for smaller MPL values. The above two observations explain why Bypass is closer to Relief for a timeout value of 5 minutes and for high MPL values when timeout is 20 minutes. The most important thing to note, however, is that for small timeout values (t out ! 20 mins) and for high MPL values with bigger timeout values (e.g., if the timeout value is 20 minutes and MPL is greater than about the rejection ratios are unacceptable. The results in this subsection have a significant utility in that they can help the video storage system to establish an admission controller so that requests are not admitted in the system if a given rejection ratio constraint will be violated. Rejection R=1, D=5, tAccess=[170s-230s], Unicast, RO=0, theta=-0.271 Bypass (tOut=20mins) Bypass (tOut=5mins) Figure 5: Effect of the timeout value in Relief and Bypass. 7.3.2 Throughput with Rejection Ratio Constraints Given that real video storage systems with very high rejection ratios of requests would be intolerable, we now focus on the throughput of the various scheduling algorithms, given that the admission controller of a video server will only admit the maximum number of requests that can be serviced without exceeding a certain threshold value on the rejection ratios. Table shows these results which were obtained as follows: First, we determined, from the graphs of the previous subsection and for each algorithm, the maximumMPL value for which the rejection ratio constraint ( 0:1) is satisfied. Subsequently, we turned to the graph showing the throughput of the algorithms as a function of MPL (not shown here for space reasons) and we determined the corresponding throughput of each algorithm for its maximum MPL value. Table 2: D=5, t access =200secs, '=-0.271, t out =20mins, RR 0:1, RO=0, unicast FCFS 19 64.14 Bypass We can see that Relief achieves the highest maximumMPL value and slightly better throughput compared to MQL and considerably better throughput compared with FCFS. It has, however, slightly worse throughput than Bypass. In particular, Relief achieves 1.47% higher throughput than MQL, 50.17% higher throughput than FCFS, and 1.51% lower throughput than Bypass. 7.4 Performance Comparison of Scheduling Algorithms Under Multicasting 7.4.1 Rejection Ratio0.20.61 Rejection R=1, D=5, tAccess=200s, tOut=20mins, Multicast, RO=0, theta=0.271 Bypass FCFS Rejection R=1, D=5, tAccess=200s, tOut=20mins, Multicast, RO=0, theta=-0.271 Bypass FCFS MQL (a) (b) Figure Rejection ratios for two different Zipf access distributions. Figures 6 show the rejection ratios of the algorithms for timeout equal to 20 minutes for two different Zipf distributions. We can see from the figure that: 1. FCFS does not exploit the multicasting capability and hence it has the highest average start-up latency which naturally leads to greater rejection ratios. 2. Bypass, on the other hand, allows more multicasting than FCFS but does not specifically exploit it like MQL and Relief. Bypass is mainly concerned with picking the request group that requires no robot exchange. That's why its performance is between that of MQL and Relief. 3. The Relief algorithm has better rejection ratio performance than MQL for MPL values greater than 40. The better performance is due to the fact that, by design, Relief aims to relieve the system from as much waiting misery as possible per service time unit. 4. We can also see that for more skewed access distributions: (i) the rejection ratio values are smaller for all algorithms, except FCFS, and (ii) the difference in the rejection ratios of Relief and MQL starts at smaller MPL values. 7.4.2 Throughput with Rejection Ratio Constraints Table 3 shows these results which were obtained as in the case of Table 2. Table 3: D=5, t access =200secs, '=-0.271, t out =20mins, RR 0.1, RO=0, multicast improvement for max MPL from others 48 221.84 . Bypass 42 174.04 27.46% We can see that Relief achieves higher maximum MPL value and throughput for that value. 8 Impact of Tape Replication Figures 7a and 7b show the throughput of Relief as a function of MPL under unicasting for three different D-values, R=2, and \Gamma0:271. We chose R=2 because we saw earlier that throughput is not improved when we increase the number of drives and stay with one robot. The conclusions drawn from this study follow. The first three conclusions hold for the MQL and Bypass algorithms also and for both metrics: rejection ratio and throughput without timeouts. For this reason and for space reasons we only show the performance of Relief with no timeouts under unicasting, but we also report on our other important findings. 1. Although not shown, only a slight improvement was evidenced for less skewed access distributions This improvement is due to the fact that replication increases the probability that the selected requests find an 'available' tape, and thus allow the algorithm's optimization to a greater extent. 2. For more skewed distributions, the performance improvement is very significant (see figures 7a and 7b). The additional improvement is due to a greater drive utilization. For example, for more skewed distributions, having more drives while there is only one replica per tape, results in some drives being very underutilized. 3. For multicasting environments, (not shown in the graphs) replication does not help. This is because the biggest contributor to improvement is by far because of the multicasting feature. 4. An interesting subtle behavior is that the throughput of the system with better than that when there is no replication in unicasting. This is because of a lower aggregate drive utilization for D= 10 than for D= 5. The latter, in turn, is due to the fact than when D= 10, more requests have a chance to be serviced by drives. These requests will typically induce more robot exchanges than the workload requests served when D= 5. This conclusion is also supported by the significant lower rejection ratio we observed when D=10. Throughput R=2, tAccess=[170s-230s], Unicast, RO=0, theta=-0.271, Relief Throughput R=2, tAccess=[170s-230s], Unicast, RO=0.2, theta=-0.271, Relief (a) (b) Figure 7: Impact of replication. 9 Concluding Remarks We have studied the performance behavior of a robotic video tape library under a variety of workloads (access distributions, access times, unicasting/multicasting) and under a variety of scheduling algorithms MQL, Bypass and Relief). Our major contributions are ffl the problem definition, along with its nuances (skew of tape-access probabilities, unicast- ing/multicasting, simultaneous resource allocation, replication, performance metrics, etc.), ffl the design of Relief, a novel, 'fair' scheduling algorithm, and its near-optimality proof. In contrast, other scheduling algorithms use ad-hoc mechanisms to achieve fairness. ffl the extensive experimentation, showing that Relief outperforms its competitors by 203% (compared to FCFS), 27% (compared to Bypass) and 37% (compared to MQL) in throughput, for the same rejection ratio. (Note that Bypass and MQL are unfair and starvation-bound)! ffl the conditions under which the robot-arm and the tape resources become the bottlenecks (Eq. 8), Ongoing and further work includes the study of tape-replication schemes and the study of tape library scheduling algorithms for other applications. --R "Tertiary Storage: An Evaluation of New Applications" "Challenges for tertiary storage in multimedia servers" "Principles of Optimally Placing Data in Tertiary Storage Libraries" "Dynamic Batching Policies for an On-Demand Video Server" "On Multimedia Repositories, Personal Computers, and Hierarchical Storage Systems" "Analysis of Striping Techniques in Robotic Storage Libraries" "A study on the use of tertiary storage in multimedia systems" "The role of data storage in broadcastings future" "On the Modeling and Performance Characteristics of a Serpentine Tape Drive" "Random I/O Scheduling in Online Tertiary Storage Systems" "Scheduling non-contiguous tape retrievals" "An Analytical Performance Model of Robotic Storage Libraries" "Performance Measurements of Tertiary Storage Devices" "Benchmarking tape system performance" "Vertical Data Migration in Large Near-Line Document Archives Based on Markov Chain Predictions" "A Cost-Effective Near-Line Storage Server for Multimedia Systems" "Untangle your tape storage costs" "On-Demand Data Elevation in Hierarchical Multimedia Storage Servers" --TR --CTR Peter Triantafillou , R. Harpantidou , M. Paterakis, High performance data broadcasting systems, Mobile Networks and Applications, v.7 n.4, p.279-290, August 2002
scheduling algorithms;video tape libraries;performance
597252
Dealing with Uncertain Durations in Synchronized Multimedia Presentations.
In this paper, we discuss the effect of the uncertainty in the duration of some multimedia objects on the quality of the presentation of multimedia scenarios. This uncertainty can be due to external factors such as the access delay over internet or the user interaction. An uncertain duration is often followed by a period of desynchronization during which the presentation deviates from the desired scenario. To solve this problem, we present in this paper a solution that integrates two complementary approaches which reduce the desynchronization and limit its propagation in the rest of the presentation. These approaches are non-blocking and use the flexibility in the duration of multimedia objects in order to resynchronize the presentation as rapidly as possible.
Introduction A multimedia presentation is a set of media objects rendered over a pre-established temporal scenario. The different objects are presented according to predefined durations set at the authoring stage (Kim, 1995). This scenario is contained in a multimedia document defined by an author and remotely accessed by users spread over the internet. In such an environment, some objects behave in an indeterministic manner and their duration does not necessarily match the predefined values. Audio and video streams suffering from remote access delays are common examples of such objects. These delays can propagate in the scenario affecting the global synchronization and the presentation quality. There are two ways for dealing with the presentation's indetermin- ism. In the first case, each time the presentation gets out of synchro- nization, some actions are taken immediately to bring the scenario back to the predefined case. Usually this operation is achieved at the cost of either blocking some of the objects, skipping the content of some objects or delaying some others. In most cases, the author specifications are violated. In the second case, the rendering engine attempts first to c 2000 Kluwer Academic Publishers. Printed in the Netherlands. Nabil Layaida and al. determine if these delays can be taken into account while maintaining or at least remaining close to the scenario specified by the author. The later method requires some means to adjust the scenario according to the author's intent. The adjustment can be carried out by modifying the durations of some objects having some temporal flexibility (Kim, 1995). These modifications must be achieved in a non blocking manner that avoids the desynchronization of the presentation. Notice that event-based synchronization, such as "when A finishes, B must be stopped", do not require handling object durations and are therefore not considered hereafter. In this paper, we propose an intelligent scheduler which allows rendering of a multimedia presentation while handling the indeterministic behavior of objects. It was developed within the Madeus authoring and presentation environment (Layaida, 1997) to handle scenario-based documents. The proposed scheduler is particularly suited for declarative document formats like SMIL (W3C, 1998) accessed through the network. Our solution combines two approaches: the dynamic formating and the reparation of indeterminism. The dynamic formatting approach operates at a given instant ahead of time to achieve the resynchro- nization. While the reparation approach is applied in case of failure or partial success of the dynamix formatter, it allows the effect of desynchronization to be minimized. The paper is organized as follows: firstly, we present the related work in section 2 and some basic concepts of temporal scenario in section 3. In section 4, we identify the consequences induced by the presence of indeterministic objects on multimedia presentations. Section 5 is devoted to the presentation of the two complementary techniques that we defined to manage the indeterminism: the dynamic formatting and the reparation of indeterminism. Finally, we conclude and give our perspectives for the research in this domain. 2. Related work Research in the field of scenario-based scheduling covers two inter-related aspects. First, the design of verification tools which allows the document consistency to be checked at authoring stage. Second, the design of schedulers (called also controllers) which handle the synchronization during the presentation. Verification tools were generally added to authoring tools or models were the flexibility of the objects were formally described as Petri-Nets with duration ranges (Senac, 1996). Other systems such as (Schnepf, 1996) and (Li, 1996) are rather event-based scheduling with less focus on the duration constraints but MTAP197-99. Dealing with uncertain durations in synchronized multimedia presentations 3 on the causal relationships between the different scenario events. The work of (Candan, 1998)uses flexibility to check for the consistency and to generate a retrieval schedule which allows to enhence the overall quality of the presentation. Courtiat (Courtiat, 1996) tried to tackle consistency validation by using formal methods based on model checking applied to state automatons specified in RT-LOTOS. A reachability analysis is applied to these automatons in order to check for the consistency. The scenario representation corresponds to all possible states of presentation. In (Santos, 1998), the analysis is extended to presentations with different resource conditions. The validation is carried out with the assumption that duration constraints are actually fulfilled. But in a networked environment, with variable delays and resources, the automaton representing the scenario differs from one environment to another according to the available resources. Encompassing all the situations together with the uncertainty in the durations causes an exponential explosion in size of the automaton. In a recent effort, new methods are proposed to overcome this problem by integrating the uncertainty both at the verification phase and at the scheduling. In this case, the automaton serves not only for validation purposes but also for scheduling strategies which prevent the presentation from entering in desynchronized states. In (Vidal, 1997), (Fargier, 1998) and (Layaida, 1996) a similar effort was carried out in order to define verification methods based on constraint propagation under incomplete knowledge of the durations. The consistency of a scenario is checked using constraint propagation techniques. In this case, the representation of the scenario is a constraint graph which is smaller and more manageable than state automatons. The notion of controllability (Vidal, 1997) is also introduced for scenarios with uncertain durations. The drawback is that the proposed verification process is incomplete and does not detect all the inconsistencies. The previous approaches attempt to prevent synchronization errors at the specification level. They are all based on predictive reasoning about all the possible cases produced by variable durations and limited resources at presentation time. With a lack of guarantees from the current network and system infrastructure, desynchronizations are in fact unavoidable. In this context, the design of "best effort" schedulers seems to be a more realistic approach. The consistency is checked independently from the resources and enforced dynamically by the scheduler (Altisen, 1992). In addition, when an unpredicted desynchronization occurs, it is also very useful to rapidly bring the presentation as close as possible to the author's specification. In this paper, 4 Nabil Layaida and al. our contribution is the design of such a scheduler for scenario-based presentations. 3. Multimedia presentations: definitions In this section, we present some useful definitions related to multimedia presentations and scenario scheduling in an indeterministic environment First, we define the basic units of a multimedia presentation as the media objects which can have different forms, such as text, images, graphics, video, audio and user interaction buttons. These units are combined in a multimedia scenario by different types of relations between them, such as temporal relations (Allen, 1983), spatial relations and hyperlinks. The media objects can be classified into two main classes: controllable and incontrollable objects. Controllable and incontrollable objects A controllable object O is a media object whose duration of presentation can be chosen by the presentation engine within a given interval [l O , uO ] c of durations having lower and upper boundaries (l O and uO respectively). The difference between the upper and the lower duration boundaries defines the flexibility of the media object. Examples of controllable objects are discrete objects such as text, images and graphics. Continuous objects such as audio and video can be considered controllable if the system resources (CPU, bandwidth) are available and sufficient to their rendering process. On the other hand, an incontrollable object O is a media object whose duration can be any value in the interval [l O , uO ] i but the exact value of duration cannot be known until the end of its presentation. In some cases the values of l O and uO are 0 and 1 respectively, unless the user specifies explicitly lower and upper acceptable boundaries. Examples of incontrollable objects are user interaction buttons, remote media objects that undergo network accessing delays and media objects with unknown durations. Given these definitions, a temporal scenario can be characterized by its flexibility that measures its ability to be adapted to the numeric constraints of durations specified by the user while maintaining the global consistency of the multimedia presentation (Kim, 1995). This flexibility depends on the flexibility of the controllable objects as well as their position in the graph (as it will be shown in section 5.1). The duration boundaries can be defined at the user level (in the source format of the scenario) or at the presentation level. In the first MTAP197-99. Dealing with uncertain durations in synchronized multimedia presentations 5 [30, 45] A F [30, 50] [35, 55] [60, 90] Figure 1. Presentation graph Indeterministic state Indeterministic Deterministic termination Late Early termination nominal duration of X Initially nominal duration of X (1) Going beyond termination of X (1) Effective (2) Termination of X before its nominal date nominal duration of X (2) Going beyond d d Figure 2. The indeterministic state of an incontrollable object case they are set explicitly by the author in the document, while in the later case, the presentation engine can define these boundaries according to the media types and other contextual information (availability of the CPU, network bandwidth). Nominal and effective duration and date values A correct multimedia presentation is the execution of the media objects in a way that respects the specified relations between the ob- jects. Objects are defined by their interval of duration together with a set of temporal relations between them. This data is then passed to a specific component, namely the temporal formatter, which statically computes a schedule for the corresponding presentation (Buchanan, 1993). We can identify two variables for the duration of the presentation of a media object O: the nominal duration and the effective duration. The nominal duration D nom is the duration statically computed by the temporal formatter before starting the presentation, where The effective duration D eff of an object is the value of the object's duration observed at the end of its presentation, where D eff 2 [l O , uO ]. A controllable object is characterized by D eff equals to D nom , while for an incontrollable object, this equality cannot be guaranteed because MTAP197-99. 6 Nabil Layaida and al. A meets equals A d Perfect continuity between X and B nominal duration of A and X delay Discontinuity between A and B Figure 3. Sequential and parallel desynchronization of the indeterminism. Taking into account the nominal duration of objects, the flexibility of a controllable object O can be split into two parts: the part corresponding to its stretching capability [0, uO - D nom ] and the part corresponding to its shrinking capability [l O - D nom , 0]. The presentation can be seen as a sequence of presentation instants, where at each presentation instant one or several presentation actions occur. For example, a presentation action can be the start or termination of a media object. Similarly to durations, we can define two dates for the presentation instants: the nominal date and the effective date. The nominal date date nom is statically calculated by the temporal formatter, taking the presentation's starting instant as a reference. The effective date date eff is the exact value of the instant's date, known when the presentation reaches this instant. A multimedia presentation can be modeled as a directed acyclic graph where nodes represent presentation instants and arcs represent objects labelled by their durations (see Fig. 1). A chain is a contiguous sequence of arcs such as each arc is connected to one and only one successor and predecessor arc (objects A and C in Fig. 1 form a chain). 4. Multimedia presentations in the presence of indeterminism Deterministic and indeterministic state During a multimedia presentation, an incontrollable object can be in one of the following two states: either deterministic or indeterministic (see Fig. 2). The indeterministic state, corresponding to an indeterministic period ffi, can occur in two cases: \Gamma The behind of schedule indeterminism (BSI) or late termination, where the effective duration of the object is greater than its nomi- Dealing with uncertain durations in synchronized multimedia presentations 7 nal duration. The object returns to its deterministic state when it effectively terminates. \Gamma The ahead of schedule indeterminism (ASI) or early termination, where the effective duration of the object is less than its nominal duration. This indeterministic state finishes when the nominal termination date of the object is reached. This definition can be generalized to a multimedia presentation: a presentation is in an indeterministic state when there is at least one in- controllable object in the indeterministic state. Otherwise the presentation is in the deterministic state. Initially, the multimedia presentation is in the deterministic state. Sequential and parallel desynchronization Two types of desynchronization can be introduced between media objects due to the indeterminism: the sequential desynchronization and the parallel desynchronization. In order to explain these types of desynchronization, let us take the example of Fig. 3. The objects A and B are related by a sequential relation (meets), i.e. object B starts immediately after the termination of object A. On the other hand, A and X are related by a parallel relation (equals), i.e. they start at the same instant and terminate at the same instant. Such a scenario can be expressed in SMIL with the statements: SEQ (PAR Consequently, by transitivity, the two relations generate an implicit relation between X and B of sequential type (meets). Supposing that the presentation of the incontrollable object X goes beyond its nominal duration and lasts for a longer time than A which is not flexible, we have to wait for the termination of X before starting object B. Consequently, a delay ffi is introduced between A and B leading to a sequential desynchronization between them. So instead of an immediate start of B after the termination of A, the user perceives that the object B waits for a delay ffi before starting. In addition, during the indeterministic period in Fig. 3, there is a parallel desynchronization which appears in the form of a shift between the termination instants of objects A and X. Accordingly, the user perceives that the object A has terminated but the object X is still playing during a period of ffi. Desynchronization period in multimedia presentation The desynchronization effects due to an indeterministic state usually last longer than the duration of the indeterministic state itself. This is due to a desynchronization propagation along the scenario. So we define a desynchronization period as the period during MTAP197-99. 8 Nabil Layaida and al. eff nom eff nom Indeterminstic period A F G time A F G time (b) Ahead of Schedule Indeterminism (ASI) A F G d d d d time (c) Behind of Schedule Indeterminism (BSI) d d d d (a) Ideal scenario I I I Figure 4. Influence of indeterminism on a multimedia presentation which the presentation is desynchronized with respect to the specified scenario (see Fig. 4). To illustrate the influence of indeterminism and desynchronization propagation on a multimedia presentation, let us consider the example shown in Fig. 4. In Fig. 4b, the incontrollable object X terminates earlier than its nominal termination (ASI case). In this case, the node n, corresponding to the end of X, must wait for the termination of the other objects incoming at this node and B) in order to start the objects outgoing from n. Consequently, a sequential desynchronization is produced between X and D and a parallel desynchronization is produced between X and the two objects A and B, but they don't affect the remaining part of the presentation. Thus, the desynchronization period is equal to the indeterministic period ffi (see Fig. 4b). Dealing with uncertain durations in synchronized multimedia presentations 9 A G Articulation chain Figure 5. Example of Case 1 In the case of the BSI, where X takes an effective duration greater than its nominal duration (see Fig. 4c), a parallel desynchronization between X and the two objects A and B is observed, and the effective date of node n is shifted ffi units of time with respect to its nominal date (see Fig. 4c). The same shift is observed for the starting and ending instants of the objects D and E. Consequently, a parallel desynchronization will take place between the ending instants of the objects D and F, and similarly for the objects E and G. Thus, the BSI is followed by a desynchronization period \Delta desync which affects the remaining part of the presentation. 5. Management of indeterminism It is possible to address the problem of dealing with indeterministic situations through two complementary approaches: dynamic formatting and repairing technique. The dynamic formatting consists in adapting the scenario dynam- ically, during the presentation, to the indeterministic behavior of the incontrollable objects, in order to obtain \Delta The dynamic formatting technique presented in section 5.1 aims at providing partial solutions for indeterministic behaviors by exploiting the flexibility of the scenario. The reparation technique (see section 5.2) consists in limiting the desynchronization effects (i.e. reducing the period \Delta desync ) during the presentation by delaying some dates. This technique complements the dynamic formating when it fails. In the remaining part of this section, we present the two techniques proposed. We show then how we combine them to provide an intelligent scheduler and we give some measures that demonstrate the results of applying these algorithms. Nabil Layaida and al. A G Articulation point Figure 6. Example of Case 2 5.1. Dynamic formatting The technique is based on an analysis of the potential indeterministic behavior of the scenario by using the hypergraph. We can identify three cases that can be handled in an ascending order of complexity (Layaida, 1997). Finally, we propose in section 5.1.4 a general algorithm that can be applied not only to these three cases but also in any situation where an indeterministic period is detected. 5.1.1. Case 1: articulation chain The first case corresponds to the situation in which the presence of an incontrollable object does not affect the synchronization constraints specified by the user. Such a case is illustrated in the Fig. 5. In this example, the graph can be subdivided in two sub-graphs G1 and G2 which are only related by a chain X containing the incontrol- lable object (such a chain is called an articulation chain). In such a configuration, it is clear that whatever value the effective duration of this object takes, the scenario remains always consistent. Therefore, no compensation is required. The formatter has only to figure out that the position of the incontrollable object in the graph is on an articulation chain in order to ignore the case. 5.1.2. Case 2: articulation point The second case corresponds to the situation in which the incontrollable object is present on a chain whose right terminal node corresponds to an articulation point: an articulation point is a graph node that can subdivide the graph in two sub-graphs only related by this node. In such MTAP197-99. Dealing with uncertain durations in synchronized multimedia presentations 11 [l , u [l A u A [u A , l (a) A d w (b) A Y d Incontrollable Controllable Incontrollable Controllable A Figure 7. Example of Case 3 a situation, the incontrollable object does not affect the synchronization constraints specified by the user, with the exception of the constraints of temporal coincidence, such as those of the chains B and D with the incontrollable chain X in Fig. 6. Temporal coincidence of two or more chains means that their end instants must occur at the same instant. In the example of Fig. 6, the graph can be subdivided also in two sub-graphs G1 and G2 which are only related by the termination instant of the chain containing the incontrollable object X (the articulation point of situation can not be consistent unless the chains B and D are flexible at their ends, i.e. they end by a discrete object like an image or a text. In this case, the termination of the chain X causes the termination of the other two chains containing B and D. The articulation point provides a re-synchronization point because after it is fired the scenario returns to a consistent state. 5.1.3. Case 3: compensation on chains When the ending instant of an incontrollable object occurs, called observation point, a more general approach consists in checking if a compensation on the same or on a concurrent chain is possible (see Fig. 7 and Fig. 9). The compensation is based on using the flexibility of the controllable objects whose start and termination instants occur in the future with respect to this observation point. The compensation can be applied on controllable objects during their presentation. As an example, let us consider a chain composed of two objects A and B (see Fig. 7a). A is an incontrollable object represents the value of indeterminism. B is a controllable object represents the amount of available flexibility. If the condition ! ffi is satisfied, then the indeterminism can be compensated dynamically in a way that renders the whole chain controllable. It is sufficient in this case to use the flexibility ! in a way to make the duration of the whole chain fall in the interval [u A +lB , l A+uB which is the duration interval of the controllable object equivalent to the chain in question. 12 Nabil Layaida and al. If the incontrollable object can not be compensated in its chain, the proposed solution consists in verifying if a usage of the flexibility of the concurrent chains can allow the re-adjustment of the scenario. For example, in the scenario of Fig. 7b, the two parallel chains fA, Xg and fY, Bg must have equal durations. To verify that this constraint can be satisfied, it is sufficient to make sure that the starting and ending instants of the chains take place at the same date. It is easy to see that if the flexibility ! of the concurrent chain fY, Bg is greater than the indeterminism ffi of the chain fA, Xg (condition 1), and if the date of the observation instant A + (end of takes place before the recovery (start of B) (condition 2), then the temporal coincidence of the instants B can be in fact guaranteed. 5.1.4. Dynamic re-formatting of multimedia presentations The approach we have chosen is a generalization of the cases presented in the previous sections. The algorithm presented here aims at re-adjusting the durations of flexible objects in order to meet the author's specification. It is triggered when an incontrollable object ends. This algorithm minimizes the value of the desynchronization period. The reformatting algorithm is applied on all the concurrent chains of the current execution. At each instant during the presentation, the scenario represented by the graph is divided in two parts. One part corresponds to the portion of the presentation which has already been rendered to the user, and the second part corresponds to the objects to be presented in the future. The current instant can be represented in the system by the set of current chains (Ch), the indeterminism to be compensated (Ch.Ind) and the available shrinking and stretching flexibility on each active controllable objects O belonging to the chain:O. flex \Gamma and O. flex . From any object X, we can access the corresponding chain on the graph (X.Chain). The algorithm of Fig. 8 is based on three phases: first the value of indeterminism due to object X is calculated (line 3). Then, the graph adjustment is taken into account on the chain where this object is found (case (a) of Fig. 7). If the flexibility of the chain, from this instant until its end, is sufficient, the indeterminism is compensated by reformatting this chain (lines 4-6). This operation consists of shrinking or stretching the chain's duration by a value equals to the observed indeterminism in the case of BSI or ASI respectively. Finally, the adjustment is performed on concurrent chains if needed (lines 7-14) such as case (b) of Fig. 7. In the case of BSI, this operation consists of stretching the chains durations by a value equals to the observed indeterminism. In the case of ASI, the concurrent chains are MTAP197-99. Dealing with uncertain durations in synchronized multimedia presentations 13 Dynamic 1. waiting list = ;; 2. /* Calculation of indeterminism value */ 3. 4. If ffi 6= 0 and fConcurrent chainsg /* ASI or BSI */ 5. /* Compensation on the same chain */ 6. Remain=Format Chain(X.Chain,(-1)*ffi); 7. If Remain 6=0 8. /* Compensation on concurrent chains */ 9. For every concurrent chain Ch f 11. If (Ind ? 12. 13. waiting list = waiting list [ Ch; 14. g 15. g 16. Return waiting list; Figure 8. Dynamic formatter d C1 If d > f1 d -f1 d -f1 d -f1 Chain Ind Flex d Calling of Dynamic_Formatter (X) Figure 9. Compensation on concurrent chains shrunk in order to end the indeterministic period. If the reformatting of the chain does not completely compensate for the whole value of inde- terminism, then the chain together with the amount of uncompensated indeterminism are added to a waiting list (lines 11-13). The chains in this waiting list are treated later by the technique of reparation of indeterminism presented in section 5.2. If at least one chain is in the waiting list, this means that the formatter is unable to completely resynchronize the scenario according to the specification. For example, in Fig. 9, the indeterminism ffi, is observed on object X of chain C1. The formating of the chain cannot be totally achieved MTAP197-99. 14 Nabil Layaida and al. because the flexibility f1 is less than indeterminism ffi. The concurrent chains C2, C3 and C4 are consequently reformatted in order to be elongated by a value of ffi- f1. The algorithm of formatting chains is presented in Fig. 10. For each chain, the algorithm modifies the duration of the controllable objects who have not yet terminated and of the continuous objects who have not yet started (lines 1-3). If the indeterminism is not completely absorbed (ind 6=0, line 2), the remaining uncompensated indeterminism is passed to the next controllable object on the chain and so on until the end of the chain. The Modify Durations procedure considers two cases depending on the sign of the indeterminism ind to be compensated: if ind is a positive value, the object must be elongated so O.Flex is used (lines 4-12). Otherwise it is a shrinking operation that takes into account the negative flexibility O.Flex \Gamma of the object (lines 14-19). Each object tries to compensate for the indeterminism by providing the maximum of flexibility (lines 4-7). The advantage of this technique is to provide an automatic re-establishment of the synchronization between the different chains in a local and non-blocking way. As mentioned earlier, this dynamic formatting technique does not cover all the cases of indeterminism. When it fails, a complementary algorithm (as presented in section 5.2 be- low) is necessary to dynamically minimize the desynchronization period resulting from the uncompensated indeterminism. 5.2. Reparation of indeterminism We can point out one important remark that the reparation of indeterminism should take into account: the case of BSI is more crucial to compensate than the ASI (see Fig. 4). The desynchronization due to the BSI can propagate till the end of the presentation. In this section, we present the algorithm of reparation of indeterminism (see Fig. 11) whose objective is the reduction of the desynchronization period following an indeterministic period of a behind schedule indeterminism (BSI). The proposed solution is based on the postponement of the presentation dates of media objects whose starting or ending instants come during or after an indeterministic period. This postponement is carried out in order to re-establish the synchronization specified in the scenario. The repairing formatter, presented in Fig. 11, treats every chain in the waiting list as follows. For each chain, the algorithm finds out the node n on the chain that comes directly after the nominal termination date of the incontrollable object X (line 2). Then, handling of this MTAP197-99. Dealing with uncertain durations in synchronized multimedia presentations 15 1. For every object O 2 Ch j Current time ! O.end.datenom 2. And Ind6=0 f 3. If (O.type = discrete) or (Current time ! O.begin) 4. Ind = Modify Durations(Ind, O); 5. g 6. Return Ind; Modify Durations(integer:Ind,Object:O) 1. If ind ? 0 Then /* if O 2 X.Chain it's a ASI */ 2. /* otherwise it's a BSI*/ 3. /* stretch object O */ 4. If O.Flex 5. 6. O.Flex 7. Return 0; /* compensation is done */ 8. g Else f /* partial compensation */ 9. 12. Return Ind; remaining indeterminism */ 13. g 14. Else /* if O 2 X.Chain it's a BSI */ 15. /* otherwise it is a ASI */ 16. /* shrink object O */ 17. If O.Flex \Gamma Ind Then f 18. /* Equivalent to lines 5 to 12 but with 19. g Figure 10. Chain formatting node n depends on the value of its date with respect to the nominal termination date of X. Two cases can occur: If the nominal date of node n comes before the effective termination date of X, then the algorithm will handle all the outgoing objects from node n (object O in the algorithm). Nabil Layaida and al. Repairing formatter(Object:X,Waiting List:WL) 1. For every chain ch 2 WL f 2. Nearest Future Node (ch, X.end.datenom); 3. For every object O such that 4. (n.datenom X.end.date eff 5. Or (n.datenom ? X.end.date eff 7. If (O.type = discrete) Then 8. 9. Else If 10. Insert Delay (O.end, ch.Ind); 11. g 12. g Figure 11. Repairing formatter If the nominal date of node n comes after the effective termination date of X, then the algorithm will handle all the incoming objects to node n (object O in the algorithm). In both cases, the object O is handled according to its type. If object O is discrete, its nominal termination date is postponed by the value of the indeterminism Ind (lines 7-8). Otherwise, if the object is of a continuous type, a delay of the value Ind is inserted after its termination (lines 9-10). 5.3. Combination of both approaches The dynamic formatter and the repairing formatter are combined in a complementary way. Once the presentation of an incontrollable object (say X) terminates, an event is generated and the indeterminism handler is called. As a first step, the indeterminism handler calls the dynamic formatter which applies the technique presented in section 5.1. The dynamic formatter answers back to the handler whether it has fully treated the observed indeterminism or not. If not, the dynamic formatter creates a waiting list where each entry represents a chain associated to which the value of uncompensated indeterminism on this chain. The waiting list is then passed to the repairing formatter in order to handle the remaining uncompensated indeterminism. Dealing with uncertain durations in synchronized multimedia presentations 17 5.4. Experimental evaluation This algorithm has been implemented in our multimedia authoring and presentation system Madeus. It allowed the desynchronization period to be reduced by a factor up to 58.82 % (see Fig. 13). In the general case, a scenario authored with sufficient information on the flexibility it contains will be better handled at runtime by our scheduler. In the other hand, a scenario which includes a significant number of parallel chains with no flexibility is likely to be desynchronized when a delay occurs. The source of flexibility comes from the nature of media because discrete objects are less sensitive to delays or duration changes. The desynchronization reduction on a larger set of tests including half of the scenarios with no flexibility gives around 35 % of desynchronization reduction. In these cases, we prevented the dynamic formatter from using the media flexibility to resynchronize the presentation. Therefore, the repairing formatter was a key component in this later cases as the dynamic formatter was only used to identify articulation points and chains. In general, it is difficult to provide general measures of performances which cover all the possible scenarios and presentation conditions. We made different scheduling tests on some scenarios and we applied a desynchronization function during the execution. This function gives the instantaneous desynchronization at each instant of an execution. It is defined as the sum of the sequential and parallel desynchroniza- tions occurring at that instant. In Fig. 12, the following executions are represented together with their desynchronization function and desynchronization period (a) The ideal execution (the incontrollable object X respects its nominal duration). (b) The execution with BSI desynchronization due to object X without applying neither dynamic formatting nor repairing formatting (c) The execution with BSI desynchronization due to object X while applying only the dynamic formatting (objects F and B are flexible). (d) The execution with BSI desynchronization due to object X while applying both the dynamic formatting and the repairing formatting. Desynchronization period35 Observation pointDesynchronization period Desynchronization periodAvailable flexibility A A Time A A Time Time Desynchronization Desynchronization Desynchronization (a) Ideal execution (b) Execution with BSI, without formatting (c) Execution with BSI, with dynamic formatting (d) Execution with BSI, with dynamic and repairing formatting Figure 12. Indeterminism with a single incontrollable object MTAP197-99. Dealing with uncertain durations in synchronized multimedia presentations 19 With dynamic and repairing formatting With dynamic formatting formatting desynchronization Reduction of incontrollable Number of objects d (sec) (sec) (sec) (sec)2514 57.14% 54.05% Figure 13. Results of the algorithm on different scenarios This example shows that the dynamic formatting reduces the desynchronization level thanks to object's flexibility it uses while the repairing formatting shifts the remaining desynchronization ahead and so reduces the desynchronization period \Delta desync . We have applied the repairing algorithm on scenarios that have several incontrollable objects. As expected, best results are obtained when only one incontrollable object is involved at a time (Fig. 13). In fact, the most interesting effect of this algorithm is to stop the cumulative propagation of the indeterminism along the scenario thanks to an incremental application of the reparation. This advantage is partially lost in very uncertain situations where successions of incontrollable objects occur unless they are located on articulation points or chains. But even in the first case, the algorithm enhances the resynchronization by bringing the scenario as close as possible to its nominal schedule. The experimental environment used in this paper was based on the Madeus system running on an Ultra-sparc 1 machine from Sun Microsystems and the solaris 2.6 operating system. The Madeus client is a fully functional multimedia authoring and presentation system capable of rendering remote documents and media objects using HTTP and RTSP protocols. The client is written in C language and the scenario specification is XML-based mark-up where the objects durations are defined as minimum and maximum bounds and are of two types controllable and incontrollable. In the experiment, the delays were introduced in two manners: first by accessing media items located in remote sites and second by artificially overloading the system's CPU. The banchmarks are documents written by several authors. They did not necessarily use the capabilities of the tool to describe precisely the flexibility contained in the documents. Nabil Layaida and al. 6. Conclusion and perspectives This paper addressed scenario-based scheduling of multimedia presentations in the presence of indeterministic durations. The presented algorithms are adaptive in that they use the flexibility of media object and the temporal relations given by the author to resynchronize the presentation. Furthermore, this operation is achieved dynamically each time a desynchronization occurs. The algorithms are based on two complementary phases: \Gamma The reformatting which attempts to modify the duration of the objects while maintaining the author's specifications. The resynchronization is achieved in a non-blocking manner and even when it partially succeeds (due to the lack of flexibility), it reduces the postponement delays required by the reparation phase. \Gamma The reparation process which is activated when the reformatting does not totally succeed, i.e. when author's specifications cannot be respected. This process aims at minimizing the period of desynchronization resulting from the indeterminism. Both algorithms take full advantage of the predictive knowledge of the temporal scenario represented as a graph. Furthermore, the organization of the graph as a set of concurrent chains allows to measure the impact of the indeterminism on the presentation. It allows also to identify the durations to modify in order to re-synchronize the presentation. Our algorithms can be easily integrated in other media players where the document is described in terms of media objects and relations. It is particularly suited for environments subject to dynamic load conditions and bandwidth resulting in variable object durations. Examples of players are SMIL document format players like RealPlayer G2 (Real- G2, 1998), GRiNS (Bulterman, 1998) and SOJA (SOJA, 1999). SMIL documents are already in use and disseminated through the internet and intelligent scheduling policies are highly needed in that context. The flexibility on which our algorithms are based can be affected by the presentation engine depending on the nature of the objects, their locations, etc. Directions of future work might include a fine tuning of the reformatting on the different chains. For example, flexibility is in our case taken from objects in the nearest future independently from the media types. A better method would be to set priorities between media objects in a manner that affects the least the presentation quality. Another solution MTAP197-99. Dealing with uncertain durations in synchronized multimedia presentations 21 would be to capture more information at the documents level about the author's intents and to translate them in terms of priorities. --R "Maintaining Knowledge about Temporal Intervals" "A Framework for scheduling as Controller Synthesis" "Automatic Temporal Layout Mechanisms" "GRiNS: A GRaphical INterface for creating and playing SMIL documents" "Retrieval Schedules Based on Resource Availability and Flexible Presentation Specifications" De Oliviera R. "Using Temporal Constraints Networks to manage Temporal Scenario of Multimedia Documents" "Teleorchestra With Independent Sources : Part 1 - Temporal Modeling of Collaborative Multimedia Scenarios" "Multimedia Documents with Elastic Time" "Maintaining Temporal Consistency of Multimedia Documents using Constraint Networks" "Madeus: un syst'eme d" RealNetworks Announcing RealSystem G2 "Design Methodology and Formal Validation of Hypermedia Documents" "Doing FLIPS: Flexible Interactive Presentation Synchronization" "Modeling logical and temporal synchronization in hypermedia systems" "Barbizon" "Contingent durations in temporal CSPs: from consistency to controllabilities" "Synchronized Multimedia Integration Language (SMIL) 1.0 Specification" --TR --CTR Rogrio Ferreira Rodrigues , Luiz Fernando Gomes Soares, Inter and intra media-object QoS provisioning in adaptive formatters, Proceedings of the ACM symposium on Document engineering, November 20-22, 2003, Grenoble, France Rogrio Ferreira Rodrigues , Marcio Ferreira Moreno , Luiz Fernando Gomes Soares, Presentation control of declarative applications in interactive digital tv system receivers, Proceedings of the 12th Brazilian symposium on Multimedia and the web, November 19-22, 2006, Natal, Rio Grande do Norte, Brazil M. Cecelia Buchanan , Polle T. Zellweger, Automatic temporal layout mechanisms revisited, ACM Transactions on Multimedia Computing, Communications, and Applications (TOMCCAP), v.1 n.1, p.60-88, February 2005
multimedia;uncertain durations;dynamic formatting;scheduling;synchronization
597254
A Sequence-Based Object-Oriented Model for Video Databases.
Structuration, annotation and composition are amidst the most crucial modeling issues that video editing and querying in the context of a database entail. In this paper, we propose a sequence-based, object-oriented data model that addresses them in an unified, yet orthogonal way. Thanks to this orthogonality, the interactions between these three aspects are properly captured, i.e., annotations may be attached to any level of video structuration, and all the composition operators preserve the structurations and annotations of the argument videos. We also propose to query both the structuration and the annotations of videos using an extension of ODMG's OQL which integrates a set of algebraic operators on sequences. The overall proposal is formalized and implemented on top of an object-oriented DBMS.
Introduction For a long time, videos were managed by specific environments due to their huge size and demanding hardware requirements. Improvements in data compression (such as MPEG-2), continuously increasing network transfer rates and processing capacity, and advances in operating systems, now allow conventional computing systems to handle videos, thereby opening new application areas such as video-on-demand, video conferencing and home video editing. The specificities of these applications have been addressed from several perspectives by a large body of research works, prototypes and commercial tools (see [EJA + 97] for a survey). Many of these efforts have focused on important performance issues related to storage, real-time transfer in distributed environments, quality of service, synchronization, etc. However, as the needs of these applications evolve, other issues such as content-based retrieval, summary extraction, interactive editing and browsing, etc. become increasingly important. In particu- lar, advances in automatic indexing techniques, together with video metadata standardization efforts (such as MPEG-7), have accentuated the need for high-level representation models and querying tools for video annotations. In this setting, we believe that database technology is likely to play an increasingly important role in video management, provided that it offers high-level concepts and interfaces for storing, retrieving and editing video data. Our work is intended to be a contribution in this direction. Video modeling in the context of a database entail numerous issues which have been addressed separately in several works. In this paper we focus on three of them, namely structuration (also known as segmentation), annotation, and composition, and we address them in a comprehensive framework. This framework is essentially based on ideas developed in the context of Temporal Databases [TCG assumes an underlying object-oriented data model (e.g. the ODMG [CB97] one). However, modulo some restrictions, the basic concepts can be adapted to an object-relational setting. Since the proposed data model is based on concepts stemming from temporal databases, it is possible to query it using operators defined in this context. Accordingly, in this paper we propose to query video annotations using a variant of a temporal extension of ODMG's OQL previously proposed by the authors [FDS99]. This is an important feature, since it entails that most of the evaluation techniques developed in the context of temporal query languages may be adapted to efficiently evaluate queries on videos. Perhaps, the main originality of the proposed approach is that it properly captures the interactions between the three addressed aspects of video modeling. In particular, annotations may be independently attached to any level of video structuration, and video composition operators are defined so as to preserve the structurations and annotations of the argument videos. s The next four sections successively deal with structuration, annotation, querying and composition of videos. Throughout these sections, the proposed data model and query language are formally defined and illustrated through several examples. Next, in section 6, we describe the current state of the prototype that we are developing to validate the proposal, and include several implementation notes. Finally, a comparison with related works is included in section 7 and conclusions are drawn in section 8. structuration Video structuration is the process of grouping the frames of a video according to their semantical correlations. For instance, a video can be structured into shots, scenes, and video sequences 1 . The structure of a video is analogue to the table of contents of a text document. As such, it can be used as a guide for browsing, as the entry point for building video abstracts, or as a mean to retrieve the context of a particular piece of video. There is a strong similarity between the structuration of a video and the structuration of time in calendars. Accordingly, we propose a video structuration model based on the concept of granularity. This concept has been extensively studied in several contexts such as temporal reasoning in artificial intelligence, and temporal databases. The definition of granularity that we adopt here is not completely novel, but rather generalizes the one developed in [WJS95]. It is important to note that in this work, the concept of granularity is merely used to model structuration levels, and not as an absolute temporal metric system, as it is the case in many other contexts. Indeed, when time is structured into "regular" granularities such as minutes and hours, these granularities may then be used to express distances between time points. 2.1 Time-lines and granularities The basic concept of the video data model that we consider is that of time-line. At an abstract level, a time-line TL is a pair (D, ! of a finite set of time-marks D, and a binary set defining a total linear order. Time-lines model independent time-coordinate systems, with respect to which data and meta-data may be temporally anchored. Each video has its own time-line, which captures the temporal relations between its elementary components (i.e. its frames). A granularity over a time-line TL is defined as a partition of sets: each of these convex sets is then seen as an atomic granule and every time-mark of the time-line is approximated by the granule which contains it. A granularity is intrinsically attached to a 1 The term "video sequence" as used here is not to be mistaken with the datatype "sequence" introduced in section 3.1. s unique time-line. The function that maps a granularity into a time-line is subsequently denoted TimeLine. Thus, the expression TimeLine(G) denotes the time-line that granularity G partitions. A hierarchical structure is defined over the set of granularities of a time-line through the definition of the following relation. Definition 1 (Finer-than relation). A granularity G1 is finer-than another granularity G2 (noted G1 OE G2) if each granule of G2 may be associated to a set of consecutive granules of G1. Formally, G1 OE G2 iff: For any two granularities G1 and G2 such that G1 OE G2, two mapping functions are defined: one for expanding a granule of G2 into a set of granules of G1 (noted ffl G2,G1 ), and the other for approximating a granule of G1 by a granule of G2 (noted ff G1,G2 ), as shown in figure 1. x Approximation of x Expansion of x e a (x) Figure 1: Granule expansion and approximation 2.2 Using granularities to model video structuration Any level of structuration of a video is naturally modeled by a granularity over its time-line. Indeed, the set of shots of a video may be seen as a set of disjoint intervals of time-marks covering the whole time-line of the video. Notice that it is also possible to view the set of frames as a "degenerated" partitioning of a video time-line, in which each partition is composed of a single time-mark. The advantage of this modeling is that the notion of frame is seen as a structuration level of a video in the same way as shots or scenes. This allows to attach annotations to shots or scenes in the same way as they are attached to frames, as detailed in the next section. In the general case, the finer-than relation over the granularities defining the structuration levels of a video is not necessarily a total order [WJS95]. In other words, it is possible to define s two non-comparable structuration levels over a single video. This feature is not supported by most previous video models (e.g. [HMS95]). The following ODMG interface shows how granularities can be used to define an ODMG interface for videos that integrates the classical levels of video structuration (i.e. video se- quences, scenes and shots). This interface may be specialized (through inheritance), so as to handle situations where other structuration levels are needed. For instance, in the context of a video about a tennis match, structuration levels such as point, game and set may be defined. interface TimeLine; /* not detailed here */ interface Granularity f bool finerThan(Granularity other); interface Video f attribute TimeLine VTL; /* standing for Video Time-Line */ attribute Granularity sequences; /* Granularity modeling video sequences */ attribute Granularity scenes; /* Granularity modeling scenes */ attribute Granularity shots; /* Granularity modeling shots */ attribute Granularity frames; /* Granularity corresponding to frames */ Other attributes described in section 3 */ For a given object V belonging to a class which implements the above interface, the following constraints apply: denotes the function which retrieves the finest granularity of a time-line (this is the granularity whose granules are all singletons). Such granularity is usually called the chronon of a time-line in the temporal database literature [TCG ffl V.shots OE V.scenes OE V.sequences Notice that it is the responsibility of the application programs to ensure the above con- straints, since ODMG does not support general-purpose integrity constraints. 3 Video annotation Given the current state of image processing technology, it is not reasonable to dynamically extract semantical information from a video during query evaluation over a video database. As a result, in order to formulate content-based queries over videos, their semantical content must be previously described as annotations. s These annotations are generally stored separately from the "raw" video data. This approach is quite natural, since video annotations are normally only needed during video querying 2 , while access to raw video data is only required during video playing. In addition, this approach allows to share the "raw" video data among several "virtual" videos, without necessarily sharing all the corresponding annotations. Our approach to video annotation is based on a single parametric type, namely Sequence (see 3.1). By instantiating this type with some adequate parameters, it is possible to model the temporal relationships between the annotations attached to a video (see 3.2), as well as those between the references to the raw video frames composing a virtual video (see 3.3). 3.1 Basic abstract datatypes On the basis of the granularity model introduced in the previous section, the following ADTs are introduced to model temporal values and sequences. ffl Instant: An instant is as an approximation of a connected region of a time-line by a granule. It is represented by a pair made up of a natural number (the position of the denoted granule) and a granularity. ffl Duration: a duration is a number of granules of a granularity. Durations are signed so as to differentiate forward from backward motion in time. A duration is described by a pair composed of an integer (the size) and a granularity. ffl ISet: an ISet (standing for Instant Set) models a collection of instants with no assumption on its representation. The Interval ADT is defined as a restriction of the type ISet which includes all convex instant sets. ffl Sequence: a sequence is a function from a set of instants observed at some common granularity, to a set of values sharing a common structure. The domain of a sequence is not necessarily an interval. The Sequence ADT is parameterized by the type of the range of the sequence. In the sequel, we will use the notation Sequence!T? to denote the instantiation of the parametric type Sequence with type T. Notice that in order to integrate the sequence datatype into an object-oriented data model, this latter should support parametric polymorphism. Unfortunately, this is not the case of ODMG. In section 6, we will discuss how this limitation can be circumvented at the implementation level. Close captions are an exception, since they are annotations that must be displayed during video playing. 3.2 Using sequences to model annotations One of our main objectives is to provide a video annotation model fulfilling the following requirements: (1) the structure of the annotations is not constrained, and (2) annotations may be independently attached to each level of structuration. The first of these requirements is essential since video annotations are generally domain- dependent. Indeed, in the context of a movie, annotations may deal with the characters or actors appearing on it, while in a news TV program, they may deal with the events being reported. In addition, as we will see later, videos may be obtained by composition of several videos, whose annotations may have heterogeneous structures. The second requirement on the other hand, increases the expressive power of the video data model. Indeed, in most previous proposals (e.g. [OT93, GR94, ACC annotations are only attached to the video frames 3 . This withholds the user from expressing properties which are true of a scene, without being true at each frame in this scene. For instance, saying that in a given scene two characters talk to each other, is something that is true at the granularity of that scene, without being true of each frame in this scene. To achieve the first requirement, we allow any object of a database to be used as a video annotation. It is not until the definition of the database schema, that the database designer may impose type restrictions on the annotations so as to model the specificities of a particular application. Therefore, in some context, an annotation may have a simple textual structure, while in another context it may be structured into sets of keywords, or other arbitrarily complex structure or object. We have studied in a previous work [LM98], how such heterogeneous annotations may be queried using generalized path expressions [CACS94]. Finally, to achieve the second requirement, we attach to each video, as many sequences of annotations as there are levels of structuration defined over it, as depicted in figure 2. 3.3 Using sequences to share raw video data Up to now, we have modeled what is traditionnally called the meta-data of a video, and have omitted to discuss about the images and sound samples that appear during video playing. Since this is generally the most bulky part of a video, any effort to compress or share it is extremely important. Video compression is a subject that has been thouroughly studied and most of the video formats (e.g. MPEG-2), are based on some compression technique. Sharing video data on the other hand, has received much less attention. In the context of an object database, this is relatively easy to achieve, since videos can be modeled as objects and object identifiers can be used to refer to them. 3 In [ACC + 96, LGOS97] annotations are attached to intervals of frames, but the underlying semantics is that the annotation is valid at each frame in this interval. <subtitle: - Hi Tom - Hi . Perhaps. Scenes Shots Video sequences Frames <actors: {Ed}> <actors: {Ed, Tom}> <actors: {Ed, Tom, Mike}> {Al, Hans}> <actors: sh1 <place parking> <place <place house> <place <place sh2 sh3 sh7 sh8 sh9 <action: a sh4 sh5 sh6 Figure 2: Sequences of annotations attached to a video It is at this point that the distinction between raw videos and virtual appears. A raw video is a low-level concept modeling an image dataflow without any structuration nor indexing information (i.e. without meta-data). Virtual videos are then built from segments of raw videos, and may have some meta-data attached to them. Virtual videos do not "copy" the data contained in the raw videos, but rather reference them. Therefore, a given segment of a raw video may be shared by several virtual videos. This issue will be illustrated in section 5, where the creation and composition of virtual videos is discussed. To model references to raw video data, we introduce the interface RVRef (standing for Raw Video Reference). An object of a class implementing this interface is composed of an instance of the RawVideo class (not described here), and a positive integer denoting the position of the referenced frame inside this raw video. interface attribute RawVideo source; attribute short frameNumber; The following ODMG interface (which completes the one given in section 2) summarizes the above discussion. This interface is not intended to be used "as is". Instead, the user may specialize it to account for particular kinds of videos. For example, to model movies, an interface inheriting from the above one may be introduced, adding some attributes such as the title, director, casting, etc. interface Video f /* Models virtual videos */ attribute TimeLine VTL; attributes described in section 2 */ attribute Sequence!Object? sequencesAnnotations; attribute Sequence!Object? scenesAnnotations; attribute Sequence!Object? shotsAnnotations; attribute Sequence!Object? framesAnnotations; attribute Sequence!RVRef? rawDataRef; For a given object V belonging to a class which implements the above interface, the following constraints apply: stands for the granularity of the domain of sequence S. ffl The domain of V.rawDataRef is an interval, i.e. discontinuities are not allowed between the successive images of a video. Notice that this restriction is not imposed over the sequences of annotations V.framesAnnotations, V.shotsAnnotations, etc. This means that it is optional to attach an annotation to a given frame (or shot) of a video, while it imperative to attach an image to each frame of a video. 4 VideOQL: a query language for video databases In this section, we formally define an extension of ODMG's Object Query Language (OQL) that integrates the datatypes defined in the previous sections as well as a set of operators over them. We also illustrate through some significant examples, how this extension can be used to formulate structure-based and content-based queries on videos. The following notations are used throughout this section: denotes the type of all functions with domain T1 and codomain T2. ffl fTg denotes the type of sets of T. stands for the type of tuples whose i th component is of type n). Tuple components may be labeled using the notation hL1: T1, L2: denotes a tuple value whose i th component is vi. If the tuple attributes are labeled then the notation hL1: v1, L2: used instead. 4.1 Operators on temporal values Constructors The instant constructor, noted P @ G, builds an instant from a natural number (the position with respect to the origin) and a granularity G. The duration constructor is defined similarly and noted #. There are two interval constructors: [I1.I2] which builds an interval with lower bound I1 and upper bound I2, and [I j D] which yields an interval with lower bound I and duration D. Selectors Two elementary selectors are defined on durations, namely Granularity and Size, such that Granularity(N # Similarly, two selectors are defined on instants: Granularity and Position. The function Duration(IS) (IS being an ISet) yields a duration whose size is equal to the number of instants in IS. Conversions Conversion operators on instants are defined on the basis of the approximation and expansion operators described in section 2.1. For instance, given two granularities G1 and G2 such that G1 OE G2, it is possible to expand an instant with granularity G2 into an interval with granularity G1, or to approximate an instant with granularity G1 by an instant with granularity G2. These conversions are performed by the following operators expand: Instant, Granularity ! Interval approx: Instant, Granularity ! Instant 4.2 Operators on sequences The following functional specification introduces the selectors over the Sequence ADT. domain of the sequence seen as a function */ Range: range of the sequence seen as a function */ value of S at I; precondition: I 2 Domain(S) */ Duration /* A set of algebraic operators is defined on sequences. These operators are divided into five groups: pointwise mapping, join, restriction, partitioning and splitting. The first three correspond to the classical projection, join and selection operators of the relational algebra, while the latter two are proper to sequences. In fact, partitioning and splitting are tightly connected to two important characteristics of sequences: granularity and order. 4 In this specification, a granule is represented by its position among the other granules of its granularity. s The pointwise mapping operator map, applies a function to each element in the range of a sequence while leaving the domain of the sequence intact. The join operator on the other side, merges two sequences into a single one by combining synchronous values. There are two restriction operators on sequences. The first one (noted during) restricts the domain of a sequence to the instants lying in a given set of instants. The second one (noted restricts a sequence to those instants at which its value satisfies a given predicate. Such predicate is given as a boolean function whose parameter denotes a value of the sequence's range. Syntactically, the operator when is coupled with map, in the same way as OQL's select operator on collections is coupled with the where operator. The exact syntax of the constructs of the language is discussed below. The partitioning operator, namely partitioned by, allows to change the granularity at which a sequence is observed. More precisely, S partitioned by G2, S being at granularity G1 (G1 OE G2), makes a partition of S according to granularity G2. The result is a sequence, at granularity G2, of sequences at granularity G1, such that the value of the main sequence at any instant I (at granularity G2) is the restriction of S to the interval expand(I, G1). This is illustrated in figure 3. Assumptions: <f2, a1>, <f1001, a3>, <f1002, a3>, <f2552, a2>, [<f1, a1>, <f3, a1>, [<s1, [<f1, a1>, [<s2, [<f1001, a3>, <f2, a1>, <f3, a1>, <f1002, a3>, . <f2552, a2>]>, <f2551, a2>, S partitioned by scenes frames finer than scenes - . Note: Figure 3: Sequence partitioning operator. Instants at the granularity called frames (respectively scenes) are denoted as f1, The condition frames OE scenes should hold. To reason about successive values of sequences, four "splitting" operators are provided, namely afterfirst, beforefirst, afterlast and beforelast. S as x afterfirst P(x) yields the tail of S starting at the first instant at which the value of S satisfies predicate P, or the empty sequence if such instant does not exist. S as x beforefirst P(x), on the other hand, restricts S to those instants preceding the first instant at which the value of S satisfies P, or S if such instant does not exist. For any sequence S and any predicate P, S is equal to the union of S as x beforefirst P(x) with S as x afterfirst P(x) (which are disjoint). Similar remarks apply to afterlast and beforelast. s Syntax: !query? ::= map !query? on !query? as !identifier? Typing: Semantics: Syntax: !query? ::= !query? during !query? Typing: during Semantics: during q 2 Syntax: !query? ::= map !query? on !query? as !identifier? when !query?. Typing: Semantics: Typing: Semantics: Syntax: !query? ::= !query? partitioned by !query? Typing: Semantics: partitioned by q 2 during expand(I, granularity([[ q 1 Syntax: !query? ::= !query? as !identifier? afterfirst !query? Typing: afterfirst Semantics: afterfirst q 2 Syntax: !query? ::= !query? as !identifier? beforefirst !query? Typing: beforefirst Semantics: beforefirst q 2 Note: Operators beforelast and afterlast are defined symmetrically to afterfirst and beforefirst. Figure 4: Syntax and semantics of VideOQL's algebraic operators on sequences s Figure 4 provides a complete formalization of the above operators. the formalization of each language operator is made up of three parts: ffl Syntax: in a BNF-like notation with terminal symbols typeset in boldface. ffl Typing: a typing rule for the operator using the notation premise implication . The notation q::t means that the query q has type t, while q[x::t']::t means that query q has type t assuming that variable x has type t'. ffl Semantics: the semantics of the operator in terms of a first-order calculus-like expression defining the graph of the resulting sequence (which is a set of pairs hinstant, valuei) in terms of that of the argument(s). The semantics of each operator is parametrized by a valuation function which fixes the values of free symbols in the corresponding query. For instance, denotes the result of evaluating q under valuation . Finally, the notation [x / v] denotes the valuation equal to except that it assigns value v to symbol x. In addition, the following macros are introduced as a syntactical sugar; they combine up the map and the partitioned by operators and introduce a having operator on partitioned histories. map q1 on q2 partitioned by q3 j map q1 on (q2 partitioned by q3) as partition map q1 on q2 as x when q3 partitioned by q4 j map q1 on ((map x on q2 as x when q3) partitioned by q4) as partition map q1 on q2 partitioned by q3 having q4 j map q1 on ((q2 partitioned by q3) as partition when q4) as partition map q1 on q2 as x when q3 partitioned by q4 having q5 j map q1 on (((map x on q2 as x when q3) partitioned by q4) as partition when q5) as partition Notice that in all these macro definitions, the variable partition is used in the map and having clauses to refer to the sub-sequences generated by the partitioning phase. This convention is analogue to that adopted in OQL's ``group by'' clause [CB97]. For further details on the language, the reader may refer to [FDS99], where we define a temporal extension of OQL whose syntax and semantics are close to those of VideOQL, and to [DFS98], where an operator similar to partitioned by is introduced. Notice also that in this section, we do not consider any modification operator on variables of type Sequence. This is because VideOQL, as well as OQL, is not intended to be a complete data manipulation language (as does SQL), but just a data retrieval one. 4.3 Queries To illustrate the ease of use and the expressive power of VideOQL, we consider a database managing a collection of movies. Each movie is identified by its title. The frames of each movie are annotated with the names of the actors appearing on them, while the scenes are annotated s with the location where they take place. The following extended ODL statements describe the class Movie, which implements the Video interface described in section 3.2. Notice that the attribute framesAnnotations "inherited" from this interface, is specialized to account for the structure of the annotations managed in this context. A similar remark applies to attribute scenesAnnotations. class Movie : Video (extent TheMovies, key title) f attribute string title; attribute sequence!Location? scenesAnnotations; attribute sequence!Set!string?? framesAnnotations; The first two queries that we consider, illustrate the restriction operators on sequences. In the first one, a sequence of annotations attached to the frames of a video is restricted to a given interval. The annotations appearing in this portion of the sequence are then extracted and furtherly processed using standard OQL operators. In the second query, a sequence of annotations is restricted based on a condition on the values that it takes, and the result is aggregated using the Duration selector on sequences (see section 4.2). Restriction (based on the domain) Retrieve the names of actors that are present at least once during the first 20 seconds of the movie "Hopes" (assuming a constant presentation rate of flatten(select anActorSet from TheMovies as F, range(F.framesAnnotations during [ 0 @ F.frames j (20 * 30) # F.frames ]) as anActorSet Operators @, # and j were introduced in section 4.1 */ Restriction (based on the range) and sequence aggregation In which movies, is John present during more that 15 minutes (assuming the same presentation rate as above). select Fmax from TheMovies as FMax where duration(FMax.framesAnnotations as anActorSet when "John" in anActorSet) Notice that these two queries, we assumed a constant presentation rate when converting a number of seconds into a number of frames. However, virtual videos may involve several raw videos possibly recorded (and therefore presented) under different frame rates. In these situations, the conversion function between "seconds" and "frames" becomes far more complex. To our knowledge, this problem has not been addressed by any of the existing video data mod- els. Indeed, the models which offer conversion functions between metric temporal values (e.g. s durations expressed in terms of seconds) and frame numbers, assume a constant presentation rate (see for instance [DC98]). We believe that this is an interesting perspective to our work. Perhaps one of the most important characteristics of videos is their sequenced structure. Therefore, queries dealing with this structure are expected to be frequent. To some extent, these queries may be expressed using the splitting operators on sequences (see section 4.2) as in the following expression. splitting sequences In which movies does John appear for the first time before Tom does so. select F from TheMovies as F where exists actorSet2 in range(F.framesAnnotations as actorSet1 beforefirst "Tom" in actorSet1) : "John" in actorSet2 /* i.e. there is an actor set containing "John", within the range of the original sequence restricted to the instants before the first time when "Tom" appears. */ However, these splitting operators (even combined with the other operators of the model) are not sufficient to express all queries involving succession. In particular, they cannot express the query "For each actor appearing in a given movie, how many times does he/she appears in this movie", where "an actor appears" means that she/he is present in one frame, without being present in the previous one. The same is true of queries involving maximal intervals during which a fact is uninterruptedly true, e.g. "Who is present uninterruptedly in Freedom during a longest interval of time than Tom does". Two approaches are possible to cope with these limitations. The first is to introduce new operators addressing these kinds of queries, and to study the expressive power of the resulting language. The alternative is to define a selector on the Sequence ADT which retrieves an interval-based representation of a sequence, i.e. a collection of pairs h Interval, Object i. For instance, given the sequence whose graph is: fh1, v1i, h2, v1i, h4, v1i, h5, v2i, h6, v2i, h7, v2i, h8, v3i, h9, v1i, h10, v1i g , its interval-based representation is: f h[1.2], v1i, h[4.4], v1i, h[5.7], v2i, h[8.8], v3i, h[9.10], v1i g. Once a sequence represented in this form, standard OQL operators on collections combined with an adequate set of operators on intervals, could be used to express the above two queries. The expressive power of the language regarding sequences, would then exactly match the expressive power of OQL for handling collections of intervals. Exploring and comparing the above alternatives is an interesting perspective to the work developed in this paper. Since in our model, annotations may be independently attached to each level of video structuration, it is necessary to provide a mechanism for switching between these levels. The partitioned by operator provides this mechanism in our OQL extension. sequence partitioning Retrieve the scenes of "Freedom" in which John is in at least half of the frames of the scene. s select domain(map partition on F.framesAnnotations partitioned by F.scenes having duration(partition as anActorSet when "John" in anActorSet) from TheMovies as F where F.title = "Freedom" In combination with the join operator, the sequence partitioning operator allows to answer queries which simultaneously involve annotations at the granularity of the scene and at the granularity of the frame, as in : "Retrieve those scenes in film Freedom, which take place in Paris, and in which John is present in at least half of the frames of the scene. 5 Video composition 5.1 Building elementary virtual videos The duality between raw and virtual videos introduced in section 3.3 enforces a separation between the data related to the images composing a video (which are encapsulated into raw videos) and its meta-data (i.e. its structuration and annotations). The former is shared among several virtual videos, thereby avoiding its expensive duplication, while the latter is mainly duplicated, so that the user can edit it depending on a particular context. A question that remains to be answered is: how virtual videos are created? Actually, this is performed in two steps. First, "elementary" virtual videos are obtained by extracting "segments" of raw videos. These elementary virtual videos are then combined into complex ones through the set of algebraic composition operators presented below. The creation of elementary virtual videos is conducted through a method extractSegment, defined over the RawVideo interface. This method takes as parameter two integers, denoting the begining and the end of the extracted segment. The result is a virtual video (i.e. an instance of the Video class), whose attributes are all undefined (i.e. equal to nil), except for the VTL and the rawDataRef ones, which respectively contain a time-line of the size of the extracted segment, and a sequence of references to the raw video. This newly created virtual video may then structured and annotated using some creation and update operators on granularities and sequences that we do not describe in this paper. 5.2 Virtual video composition operators Five algebraic operators are defined on videos: extraction, concatenation, intersection, union and difference. Operators similar to these ones have been previously proposed in e.g. [WDG95, s HMS95, LM98]. However, none of these proposals defines them in such a way as to preserve the structuration of the argument videos. Extraction. This operator takes as parameters a virtual video V and an instant set IS, defined at lowest granularity of V (i.e. V.frames). It creates a new video by restricting V to the instants in IS. As the other operators of the algebra, the structuration and annotations of the operand is preserved in the result, as shown in figure 5. . scenes shots frames scenes shots frames Extract(V, {f2,f3,f4,f8,f9}) a f2 f3 f4 f5 f6 f7 f8 f9 a a b c c a b a a b a b A Figure 5: The video extraction operator. Characters a, b and c denote annotations attached to the frames, while A, B and C are annotations attached to the scenes. The derivation of the granularities of the resulting video is essentially carried out by the operator Restrict on granularities defined in appendix A. Intuitively, Restrict(G, IS) derives a new granularity by restricting granularity G to the granules referenced in IS. The derivation of the annotations, on the other hand, is performed in two steps. First each of the sequences of annotations of the argument video are restricted through the operator during on sequences. Then, the resulting sequences are transformed into equivalent sequences over the new time-line, using the operator Compact defined in appendix A. Intuitively, this operator maps a sequence with a non-convex domain, into one with a convex domain. For example, Compact(fh3, v1i, h5, v2i, h6, v2i, h9, The overall definition of the operator is given below. a time-line is represented as an interval of integers */ .framesAnnotations during IS) .shotsAnnotations during expand(IS, V /* see section 4.1 for the definition of "expand" */ .scenesAnnotations during expand(IS, V Concatenation \Phi V . This operator takes two videos as parameters. The resulting video is composed of all frames belonging to the first video, followed by all frames in the second one. The definition of this operator involves two auxiliary operators: Translate and Shift, both described in appendix A. The operator Translate on granularities, corresponds to a translation of the origin of a time- line. Intuitively, it shifts the time-marks contained in the granules of a granularity, by the number given as parameter. E.g. g. The operator Shift on sequences, forwardly "shifts" the domain of a sequence by the number of granules given as a parameter. For instance, Shift(fh3, v1i, h5, v2i, h6, v2i, h9, v1ig, the remaining granularities are defined in a similar way */ The remaining sequences of annotations are obtained similarly */ Intersection. This operation creates a new video where only common footage of both videos is captured. .rawData as x when x in range(V 2 .rawData)) in Difference. This operation creates a new video which is composed of the frames of the first operand without the common frames of the second operand. .frames as x when not (x in range(V 2 .frames))) in s Union This operation has the same features as the concatenation one, but common footage is not repeated. Formally: Figure 6 illustrates some of the above operators. This figure puts forward the raw video data sharing resulting from virtual video composition. Figure Virtual video composition and raw video data sharing: RV1 and RV2 denote raw videos, while VV1 through VV4 denote virtual videos. 5.3 Video composition and querying Embedded into the query language, the composition operators allow to build new videos by retrieving and combining segments of existing ones. Typically, the retrieval phase of this process involves a "select/from/where" query expression (which returns a collection of videos). To combine all the videos of the resulting collection into a single one, it is necessary to extend the composition operators so as to apply to lists of videos. The following operator generalizes the binary \Phi V operator to deal with lists of videos. Operators IntersectAll and UnionAll are defined similarly. Using these operators, most of the queries presented in section 4.3 can the be easily rewritten so as to generate a new video from the videos or video segments that they retrieve. Create a new video by concatenating all the movies where John appears for the first time before Tom does so. s select F from TheFilms as F where exists actorSet2 in range(F.framesAnnotations as actorSet1 beforefirst "Tom" in actorSet1) : "John" in actorSet2 order by F.title) 6 Implementation The video model presented has been implemented as a prototype on top of the O 2 DBMS. In this section, we present the overall architecture of the prototype, and detail its components. 6.1 Overall architecture The overall architecture of the prototype is shown in figure 7. It is composed of seven mod- ules. Four of them, namely the schema definition language preprocessor, the query language preprocessor, the video editing user interface and the video player, operate as front-ends to the DBMS. The other three modules (the schema manager, the video meta-data manager and the raw video repository) directly operate within the DBMS. query language preprocessor extended extended schema definition language preprocessor Video player Video meta-data manager Sequence interface Video interface Schema manager DBMS editing user interface MPEG files repository Other related interfaces ODMG-compliant Figure 7: Overall prototype architecture The schema definition and the query languages preprocessors are adapted from those developed in the context of the Tempos temporal database system [FDS99]. In the current state of the implementation, we have not yet considered any optimization issue: the query language preprocessor simply translates queries formulated in VideOQL, into OQL queries containing invocations to the methods implementing the operators of the Sequence ADT. However, in a future work, we plan to explore how temporal query evaluation techniques could be adapted to efficiently evaluate queries written in VideOQL. s The video editing user interface and the video player (which we detail in section 6.2), are also adapted from previous work done by the authors in the context of the VSTORM video database model [LM98]. Together, these two modules provide an interactive environment for editing, browsing and playing videos stored in the database. The screen shot in figure 8 illustrates the edition of a video sequence using the video editing interface. The box entitled "current level" lists all the existing scenes of the video sequence. When a scene is selected, all the data attached to it are displayed in the rest of the canvas, so that the user may browse or edit them. A new scene can be added by clicking on the "NEW" button. The shots composing the new scene are entered through the "Control panel" or directly by giving the cardinal numbers of the first and last shots of the scene. The "Browse" button is used to link objects with this scene (i.e. to annotate the scene). The "KEYFRAME" button allows to select a representative frame of the scene (i.e. a key-frame). The set of key-frames of a given structuration level may subsequently be viewed by selecting the "keyframes only" button. This functionality is extremely useful for video browsing. Finally, the "relevance factor" entry is intended to measure the current scene's relevance with respect to all other scenes in the current video sequence. This factor is subsequently used for summary extraction as discussed in [LM99]. Figure 8: Screen shot from the video editing user interface The schema manager has two functionalities. First, it acts as a mediator between the external preprocessors and the DBMS catalog. This mediation ensures some independence between the preprocessors' design and the underlying DBMS. Indeed, the ODMG standard does not define an interface to update the DBMS catalog, although it defines an interface to access it (which, by the way, is currently not implemented by the object DBMS vendors). Second, this module keeps track of the instantiations of the parametric class Sequence used s within a given database. This is necessary to simulate parametric polymorphism on top of the ODMG object model as discussed later in section 6.3. The video meta-data manager is a library of classes providing an interface to the data related to video structuration, annotation, and composition, stored within the DBMS. These classes implement the ADT (or interfaces) described throughout the paper. Finally, the raw video repository contains the compressed files containing the images and sound samples of each physical video. In the current implementation, these data are partially managed outside the DBMS due to some limitations of the O 2 DBMS. 6.2 Implementation notes related to the video player In the current state of the prototype, the video player module is implemented as an extended version of an MPEG player developed at the University of California 5 . The features that we have integrated into the original MPEG player concern three main aspects: ffl The original video player was designed to read its input from a single physical file, while virtual videos may stem from several raw videos stored in separate files. To avoid generating the entire MPEG data corresponding to a virtual video, and dumping it into a physical file before starting its presentation, we modified the original player so as to accept reading data from a dynamically generated file (i.e. a pipe). Several bufferization problems were tackled at this point. ffl A virtual video may stem from several physical videos having different window sizes. The player was therefore modified so as to dynamically resize the video presentation window in such situations. An alternative approach that we considered, is to fix a window size for the whole virtual video presentation, and to dynamically rescale each involved physical video so as to fit on it. However, we did not implemented this latter solution since it involves complex modifications into the video player. ffl Similarly, several physical videos involved in a single virtual video may have been recorded with different frame rates. The original video player was therefore modified so as to accept changing the frame displaying rate on the fly. Otherwise, the user would perceive some portions of the virtual video as going faster or slower than the others. In the future, we plan to decompose the video player into two subcomponents: one which video data, and another that displays it under some presentation parameters (e.g. window size and speed). In this way, it will be quite straightforward to consider other compression formats than MPEG (e.g. M-JPEG, AVI and H.261), and even to play virtual videos composed of physical videos stored under different formats. 5 Downloadable at ftp://mm-ftp.cs.berkeley.edu/pub/multimedia/mpeg. This video player only plays images. 6.3 Implementation notes related to the Sequence ADT Perhaps, the major problems that we faced during the design of the prototype, were those related to the lack of parametric classes in the O 2 model (which is true of the ODMG object model as well). Indeed, the Sequence ADT could be naturally mapped into a parametric class. A first solution that we envisaged, is to generate a class for each kind of sequence involved in an application. In our example database, this implies generating a class for sequences of Location, another for sequences of Set!string?, etc. We believe that in realistic situations, these would rapidly lead to an undesirable proliferation of classes. In addition, some operators, such as the sequence joins, cannot be satisfactorily implemented using this approach, since the type of the resulting sequence intrinsically depends on that of the argument sequences. Instead, we decided to partially simulate parametric classes by exploiting the preprocessors included in the architecture. In this approach, a single non-parametric class Sequence, corresponding to sequences whose values are of type Object (the top of the ODMG's class hi- erarchy), is first implemented. Then, during schema definition, each sequence-valued attribute is declared as being of type Sequence by the data definition languages preprocessor, while its exact type specification is stored in the schema manager. Since the schema manager is accessed by the VideOQL preprocessor, this latter knows the exact type of the sequences involved in a query. With this knowledge, the VideOQL preprocessor adds explicit downcastings in the translated query expression, whenever a value of a sequence is extracted. In this way, the user of VideOQL manipulates sequences as if they were parametrically typed. The above solution has several drawbacks. First, adding explicit downcastings in the translated queries introduces a burden during query evaluation, since the OQL interpreter performs a dynamic type checking whenever an object is downcasted. Second and foremost, the above solution does not take into account that the database objects are not only accessible through the query language, but also, through any of the programming language bindings (e.g. the C++ and Java bindings defined in the ODMG standard). An outcome of this limitation is that, in the current implementation of the prototype, the application programmer must introduce downcastings and explicit dynamic type checkings when manipulating sequences. 7 Related works There is a wealth of works dealing with semi-structured formats for representing semantical video contents (i.e. annotations). The results of these works are currently being exploited by ongoing standardization efforts, such as MPEG-7 [ISO98] and the Dublin core metadata proposal [WKLW98]. In both of these approaches, annotations are represented as "segment descriptors", i.e. hierarchically structured entities attached to a particular segment of a docu- sment, or possibly to an entire document. MPEG-7 is intended to be flexible, in the sense that user-defined annotation types are allowed in addition to the ones provided by the standard. Our proposal is complementary to the above ones, since it is not intended to define a low-level format for video storage, but rather a high-level data model for browsing, editing, composing and querying videos using the functionalities of an object DBMS. The choice of an object-oriented approach has several important advantages. Indeed, inheritance can be exploited to provide a flexible schema annotation, while the concept of object identity allows to easily share video segments among several "virtual videos". The idea of using DBMS functionalities to store, browse, and query video contents is not novel; it has been applied in many prototype systems and data model proposals (see [EJA for a survey). The main innovation of our approach, lies on the orthogonality with which the different aspects of video modeling are tackled. For instance, in our proposal annotations may be independently attached to each level of the video structuration, whereas in most of the existing video data models (e.g. AVIS [ACC + 96] and CVOT [LGOS97]), annotations may only be attached to the frames. Moreover, in most existing approaches, the structure of the annotations is restricted (generally to full-text keywords), while in our proposal, any database object may be used to annotate any video segment. [HMS95] is perhaps one of the closest works to ours. This paper describes a framework for modeling video and audio through the notion of media stream. Annotations are attached to intervals over these streams, and temporal queries are formulated by using comparison operators on the lower and upper bounds of these intervals. This work does not address the issue of defining high-level temporal query operators. In addition, the proposed query language uses an ad hoc syntax, and is not integrated into a general-purpose query language. This remark also applies to other related proposals such as VideoSQL [OT93] and VIQS [HS95]. In contrast, the query language that we propose is a fully compliant extension of OQL, therefore allowing to formulate both video and "conventional" queries in the same framework. The idea of using temporal database concepts to model video data has been explored in [LGOS97]. In this work, the authors suggest to handle videos using histories as defined in the TIGUKAT object model [GO93]. Queries on videos are then expressed using high-level operators on histories. Unfortunately, some important features of video annotations are not taken into account. For instance, it is not possible to attach different kinds of annotations to different levels of video structuration as discussed above. Furthermore, the authors assume that video annotations are located with respect to a global time-line (i.e. each annotation is conceptually attached to an anchored date such as "14/8/1999 at 5:00 a.m."), so that the modeling issues arising from the unanchored nature of time in videos are skirted. In some respect, the work reported here is close to that of [SLR96], which proposes an ADT-driven model for sequences and an associated query language. This latter work focuses on discretely-varying data such as time-series, and the authors do not discuss how it may be extended to deal with stepwisely varying data such as video annotations. Most of the video composition operators that we considered in this paper are inspired from those studied in [WDG95]. These operators also appear, with slightly different semantics, in other related proposals such as [OT93] and [HMS95]. However, none of these works discusses how the logical structuration of the composed videos is reflected in the resulting one, nor how these composition operators can be integrated into a query language. Finally, other related works include the numerous data model proposals for multimedia presentations (e.g. [Adi96]). These works however, are not directly relevant to our proposal, since they do not attempt to model the internal contents of videos, but rather to provide support for building interactive presentations by composition of multimedia documents. 8 Conclusion We have detailedly presented a data model providing high-level support for storing, browsing, querying and composing videos on top of an object-oriented DBMS. Through a detailed analysis of related works, we have shown that the proposed data model includes several important novelties that ensure an increased user-friendliness, flexibility and expressive power. In addition, the soundness of the data model and its associated query language have been validated through a complete formalization and a prototype implementation on top of an industrial object-oriented DBMS. An important feature of our proposal is that it is based on concepts stemming from Temporal This leads us to believe that many of the techniques developed in this latter setting may be adapted to design an efficient and scalable implementation of our model. Validating this claim is one of the main perspectives to the work reported in this paper. There are several other research directions that we would like to explore in the future: Summary extraction. In section 6.1, we mentioned the possibility of annotating a video segment with a measure of its relevance with respect to other video segments (i.e. a relevance factor). A practical application of this kind of annotations may be to extract a "condensed" version of a video fitting some given duration constraints. We have started to examine this issue in [LM99]. ffl Database-driven collaborative video edition, i.e. studying how the distribution, concurrency, and security facilities provided by current DBMS may be exploited to support collaborative edition of structured video documents. For a long time, videos have been managed as unstructured entities. Recent works, such as s one reported in this paper, show that accurately and formally modeling this media significantly improves the user-friendliness and the expressive power of the tools used to handle it. This fact demonstrates that it is not because a media is complex that it should be modeled fuzzyly. On the contrary, it is in such situations that the structuration efforts are of greater concern. --R The Advanced Video Information System: data structures and query processing. From structured documents to novel query facilities. The Object Database Standard: ODMG 2.0. A unified data model for representing multimedia Handling temporal grouping and pattern-matching queries in a temporal object model Video Database Systems: Issues A representation independent temporal extension of ODMG's Object Query Language. Temporal extensions to a uniform behavioral object model. A data model for audio-video data A temporal foundation of video databases. Querying video libraries. International Standards Organization - Coding of moving pictures and audio working group (ISO/IEC JTC1/SC29/WG11) Modeling video temporal relationships in an object database management system. Querying virtual videos with path and temporal expres- sions Int'egration de donn'ees vid'eo dans un SGBD 'a objets. L'Objet The Definition of Standard ML - Revised implementation of a video-object database system The design and implementation of a sequence database system. Temporal Databases. Composition and search with a video algebra. Temporal modules Dublin core metadata for resource dis- covery --TR --CTR Marlon Dumas , Marie-Christine Fauvet , Pierre-Claude Scholl, TEMPOS: A Platform for Developing Temporal Applications on Top of Object DBMS, IEEE Transactions on Knowledge and Data Engineering, v.16 n.3, p.354-374, March 2004
temporal databases;object-oriented databases;video databases;ODMG
597338
Coordinating electronic commerce activities in MANIFOLD.
Modern electronic commerce environments are heavily web-based and involve issues such as distributed execution, multiuser interactive access or interface with and use of middleware platforms. Thus, their components exhibit the properties of communication, cooperation and coordination as in CSCW, groupware or workflow management systems. In this paper we examine the potential of using coordination technology to model electronic commerce activities and we show the benefits of such an approach. Furthermore, we argue that control-oriented, event-driven coordination models (which enjoy some inherent properties such as security) are more suitable for electronic commerce than data-driven ones which are based on accessing an open shared communication medium in almost unrestricted ways.
Introduction Modelling of activities within an information system or between different information systems has become a complex task. Performing these activities (often known as groupware, workflow, electronic commerce and enterprize reengineering) is often done in conjunction with computer-based cooperative environments such as electronic mail, voice and video teleconferencing, electronic classrooms, etc. In addition, the emergence of the World Wide Web as the main medium, not only for passive presentation of information but also for active cooperation between different agents collaborating in a single task, further enhances some properties of those activities such as distribution and openess. Typical examples of such complex-in-nature activities range from finding suitable time-slots and locations for group meetings, to performing administrative procedures (e.g., organising conferences), to carrying out reviews of draft documents, to developing distributed web-based electronic commerce applications (e.g. reserving flight seats and hotel rooms by means of dedicated WWW servers). Modelling these activities has become a task, which is often impossible to perform by single individuals, requiring groups of people, sometimes distributed over different organisations, countries, etc. Recently, we have seen a proliferation of so-called coordination models and their associated programming languages ([2,6,16]). Coordination programming provides a new perspective on constructing computer software. Instead of developing a computer program from scratch, coordination models allow the gluing together of existing components. Coordination, as a science in its own right whose role goes beyond computer programming, has also been proposed ([11]). More to the point, it is argued that coordination has a number of advantages over traditional process models, such as explicit representation of organisational goals, constraints and dependencies (as opposed to "compiled" process descriptions), opportunistic selection of required mechanisms given current coordination requirements (as opposed to having fully-defined processes ahead of time), and sensitivity to exception handling as well as the ability to adapt dynamically (as opposed to having processes with rigid, well-defined behaviour). In this paper we use the generic coordination model IWIM (Ideal Worker Ideal Manager) and a specific control-oriented event-driven coordination language (MANIFOLD) based on IWIM ([3,4]) to model Electronic Commerce activities. Electronic Commerce makes heavy use of all aspects related to coordination technologies, namely communication (between, say, sellers and potential customers), cooperation (as in the case of brokering) or coordination (as in the case of distributed auction bidding). Furthermore, web-based Electronic Commerce environments are inherently distributed and require support for security measures. IWIM and its associated language MANIFOLD are based on point-to-point communication and are therefore inherently secured coordination systems, as opposed to the category of Shared Dataspace coordination models which are inherently weaker in security aspects (see the following section). The rest of this paper is organised as follows: in section 2 we briefly compare the two main approaches to developing coordination models and languages. In section 3 we describe the coordination model IWIM and its associated language MANIFOLD. In section 4 we use MANIFOLD to model Electronic Commerce activities, and, finally, in section 5 we present some conclusions, and related and further work. 2. Data- vs Control-Driven Coordination Models and Languages Over the past few years a number of coordination models and languages have been developed ([2,6,16]). However, the first such model, which still remains the most popular one, is Linda ([1]). In Linda, the underlying view of the system to be coordinated (which is usually distributed and open) is that of an asynchronous ensemble formed by agents where the latter perform their activities independently from each other and their coordination is achieved via some medium in an asynchronous manner. Linda introduces the so-called notion of uncoupled communication whereby the agents in question either insert to or retrieve from the shared medium the data to be exchanged between them. This shared dataspace is referred to as the Tuple Space and information exchange between agents via the Tuple Space is performed by posting and retrieving tuples. Tuples are addressed associatively by suitable patterns used to match one or more tuples. In general, the tuples produced do not carry any information regarding the identity of their producers or intended consumers, so communication is anonymous. Although Linda is indeed a successful coordination model, it has some potentially serious deficiencies (at least for some applications such as Electronic Commerce) which penetrate to all other related models that are based on it. These deficiencies are: . It is data-driven. The state of an agent is defined in terms of what kind of data it posts to or retrieves from the Tuple Space. This is not very natural when we are interested more in how the flow of information between the involved agents is set-up and how an agent reacts to receiving some information, rather than what kind of data it sends or receives. . The shared dataspace through which all agents communicate may be intuitive when ordinary parallel programming is concerned (offering easy to understand and use metaphors such as the one of shared memory), but we believe that it is hardly intuitive or realistic in other cases, such as for modelling organisational activities. People in working environments do not take the work to be done by others to common rooms where from other people pass by and pick the work up! It is true that sometimes there is selective broadcasting (e.g. in providing a group of people doing the same job with some work and letting them sort out the workload among themselves) but the unrestricted broadcasting that the Tuple Space and its variants suggest and enforce is hardly appropriate and leads to unnecessary efficiency overheads. . Furthermore, and perhaps more importantly, the use of such a widely public medium as the Tuple Space and its variants, suffers inherently from a major security problem which gives rise to problems in at least three dimensions related to the fate of the data posted there: (i) they can be seen and examined by anyone; (ii) they can be removed by the wrong agent (intentionally or unintentionally); and even worse, (iii) they can be forged without anyone noticing it. The repercussions of these deficiencies in modelling information systems are rather obvious and need not be discussed any further. It suffices to say, as an example directly related to the context of this paper that we would not want to broadcast to the tuplespace our credit card number hoping that it will be picked up by the intended recipient. Some of the above problems have already been of concern to researchers in the area of shared-dataspace-based coordination models and solutions have been sought ([7,12,16]). Nevertheless, implementing these solutions requires quite some extra effort and effectively leads to the design of new coordination models on top of the "vanilla" type ones; these new models are often counter-intuitive and relatively complex when compared with the inherent philosophy of their underlying basic model. 3. The IWIM Model and the Language MANIFOLD MANIFOLD ([4]) is a coordination language which, as opposed to the Linda family of coordination models described in the previous section, is control- (rather than data-) driven, and is a realisation of a new type of coordination models, namely the Ideal Worker Ideal Manager (IWIM) one ([3]). In MANIFOLD there are two different types of processes: managers (or coordinators) and workers. A manager is responsible for setting up and taking care of the communication needs of the group of worker processes it controls (non-exclusively). A worker on the other hand is completely unaware of who (if anyone) needs the results it computes or from where it itself receives the data to process. MANIFOLD possess the following characteristics: . Processes. A process is a black box with well-defined ports of connection through which it exchanges units of information with the rest of the world. A process can be either a manager (coordinator) process or a worker. A manager process is responsible for setting up and managing the computation performed by a group of workers. Note that worker processes can themselves be managers of subgroups of other processes and that more than one manager can coordinate a worker's activities as a member of different subgroups. The bottom line in this hierarchy is atomic processes, which may in fact be written, in any programming language. . Ports. These are named openings in the boundary walls of a process through which units of information are exchanged using standard primitives analogous to read and write. Without loss of generality, we assume that each port is used for the exchange of information in only one direction: either into (input port) or out of (output port) a process. We use the notation p.i to refer to the port i of a process instance p. . Streams. These are the means by which interconnections between the ports of processes are realised. A stream connects a (port of a) producer (process) to a (port of a) consumer (process). We write p.o -> q.i to denote a stream connecting the port o of a producer process p to the port i of a consumer process q. . Events. Independent of streams, there is also an event mechanism for information exchange. Events are broadcast by their sources in the environment, yielding event occurrences. In principle, any process in the environment can pick up a broadcast event; in practice though, usually only a subset of the potential receivers is interested in an event occurrence. We say that these processes are tuned in to the sources of the events they receive. We write e.p to refer to the event e raised by a source p. Activity in a MANIFOLD configuration is event driven. A coordinator process waits to observe an occurrence of some specific event (usually raised by a worker process it coordinates) which triggers it to enter a certain state and perform some actions. These actions typically consist of setting up or breaking off connections of ports and channels. It then remains in that state until it observes the occurrence of some other event, which causes the preemption of the current state in favour of a new one corresponding to that event. Once an event has been raised, its source generally continues with its activities, while the event occurrence propagates through the environment independently and is observed (if at all) by the other processes according to each observer's own sense of priorities. Figure 1 below shows diagramatically the infrastructure of a MANIFOLD process. out Figure The process p has two input ports (in1, in2) and an output one (out). Two input streams (s1, s2) are connected to in1 and another one (s3) to in2 delivering input data to p. Furthermore, p itself produces data which via the out port are replicated to all outgoing streams (s4, s5). Finally, p observes the occurrence of the events e1 and e2 while it can itself raise the events e3 and e4. Note that p need not know anything else about the environment within which it functions (i.e. who is sending it data, to whom it itself sends data, etc. The following is a MANIFOLD program that computes the Fibonacci series. manifold PrintUnits() import. manifold variable(port in) import. manifold sum(event) port in x. port in y. import. event overflow. auto process v0 is variable(0). auto process v1 is variable(1). auto process print is PrintUnits. auto process sigma is sum(overflow). manifold Main() { begin:(v0->sigma.x, v1->sigma.y,v1->v0,sigma->v1,sigma->print). overflow.sigma:halt. The above code defines sigma as an instance of some predefined process sum with two input ports (x, y) and a default output one. The main part of the program sets up the network where the initial values (0,1) are fed into the network by means of two "variables" (v0, v1). The continuous generation of the series is realised by feeding the output of sigma back to itself via v0 and v1. Note that in MANIFOLD there are no variables (or constants for that matter) as such. A MANIFOLD variable is a rather simple process that forwards whatever input it receives via its input port to all streams connected to its output port. A variable "assignment" is realised by feeding the contents of an output port into its input. Note also that computation will end when the event overflow is raised by sigma. Main will then get preempted from its begin state and make a transition to the overflow state and subsequently terminate by executing halt. Preemption of Main from its begin state causes the breaking of the stream connections; the processes involved in the network will then detect the breaking of their incoming streams and will also terminate. 4. Electronic Commerce Frameworks in MANIFOLD In this section we show how a control-based event-driven coordination model like MANIFOLD can be used to model transactions for Electronic Commerce. We concentrate on three aspects: modelling e-commerce transactions, realizing security mechanisms, and illustrating the integration of different components. In the process we take the opportunity to introduce some additional features of MANIFOLD. 4.1. Modelling e-commerce activities We start with considering the case of a general scenario whereby sellers and potential buyers are exchanging control and data information as follows: . A seller can raise the event offer_service whereby it informs the market of some product that it is able to offer (for simplicity, we assume here that the seller in question can offer just one product whose nature is self-evident by the event that is being raised - this, certainly, need not be the case, and the seller may be offering more than one product). In addition to raising this event, the seller places the tuple < > with detailed description of the offered ptoduct to its default output port. . A potential buyer detects the raising of the event, and if interested, uses the id of the event's sender to connect to the seller's output port in order to retrieve the detailed description of the offered product (here we use the atomic process propose, an instant of CheckDescr, which decides as to whether there is interest in continuing the transaction activities). Then, if it decides to buy, it raises the event i_am_interested (again for simplicity we assume that the event's meaning is self-evident in the sense that no other seller exists and there can be no confusion as to the intention of the potential buyer - we point out once more that this need not be the case and our model can handle arbitrarily complex transaction patterns). . Upon detecting the presence of the event i_am_interested, the seller uses the event's source id to connect to the default input port of the potential buyer and place there his detailed offer (including, perhaps, discounts, special prices, etc. . The potential buyer decides as to whether he wishes to complete the transaction or abort it (here we use the atomic process CheckSpecs process introduced above while describing Advisor) and sends the appropriate accept or reject message to the seller, in the former case possibly along with some further information (e.g. his credit card number). . If a reject message is sent, the transaction process is aborted. If, instead, an accept message is sent (possibly along with some verification information), the buyer sends the product to the user. Finally, the user sends the buyer the required amount of money. The above scenario is presented graphically below. It is interesting to point out that figure 2 comes very close to being the visual coordination program that would be written in the visual interface of MANIFOLD, namely Visifold ([5]). This suggests the use of visual programming in modelling Electronic Commerce scenarios. Furthermore, we should stress the point that, by virtue of the IWIM model, the transactions are secured. In particular, the agents involved in the transaction (namely the seller and the potential buyer) broadcast only their intention of selling something and their intention of possibly buying something respectively. The rest of the information involved in the transaction, i.e. the description of the product, the particular offer that the seller may make to the potential buyer and the acceptance of the offer by the buyer along with possibly sensitive information such as a credit card number, are exchanged between them by means of point- to-point port connections, which are by default secure, private and reliable. offer_service << Prod_Descr >> << Prod_Descr >> i_am_interested << Proposal >> Figure << Accept . >> / << Reject >> << Product >> << Money >> Furthermore, we should stress the point that, by virtue of the IWIM model, the transactions are secured. In particular, the agents involved in the transaction (namely the seller and the potential buyer) broadcast only their intention of selling something and their intention of possibly buying something respectively. The rest of the information involved in the transaction, i.e. the description of the product, the particular offer that the seller may make to the potential buyer and the acceptance of the offer by the buyer along with possibly sensitive information such as a credit card number, are exchanged between them by means of point- to-point port connections, which are by default secure, private and reliable. The actual MANIFOLD code for a seller and a potential buyer is shown below. event offer_service, i_am_interested. manifold { event got_answer, got_money. begin: (raise(offer_service), < > -> output, i_am_interested.*buyer: { begin: < > -> buyer; if (input==< > then (< > -> buyer, buyer -> payment). manifold Buyer (port in itemspeecs) { port out specs. stream KK -> specs. auto process myspecs is variable(itemspecs). check product's description / auto process propose is CheckDescr(). check product's specs */ auto process advise is CheckSpecs(myspecs). begin: (variable(itemspecs) -> specs, offer_service.*seller: { begin: (getunit(seller) -> propose, continue.propose: (raise(i_am_interested), getunit(input) -> advise, recommend.advise: (<<Accept .>> -> seller, < > -> seller. got_product: < > -> seller. next: post(begin). We should probably stress here the fact that the actual information and particular heroes of our scenario are parametric. In other words, the code specifies and implements, in a well-defined way, the coordination protocol of the transaction, paying attention to important issues such as security and anonymous communication (by virtue of the IWIM model) but also paying little attention to what is being offered, who is offering it or is interested in buying it, and in the case of the purchase actually taking place, how the buyer pays. Thus, the protocol is reusable and can be applied to many similar cases, combined with other protocols to form more general and complicated ones, etc. 4.2. Realizing security mechanisms In the previous case we have seen how MANIFOLD can provide the necessary security at the implementation level; in other words, we can be sure that the basic communication among interacting agents is secured and the transmitted data cannot be lost, intercepted or forged. However, we have not tackled the issue of security at a logical level; i.e., whether the involved agents are of the right type, have a valid identity, and behave in the intended way. So, although the transaction process in figure 2 will be secured as far as communication needs are concerned, the framework allows agents A and B to do anything they wish without restricting or checking their behaviour in any way. This happens because we have mixed together the communication and the behaviour protocols, with every agent being free to define completely its own behaviour irrespective of how it may affect other agents. However, MANIFOLD coordinators can be used in a somewhat different manner, whereby in addition to the security at the implementation level, we also enjoy security at the logical level. This can be achieved by having special MANIFOLD coordinators which are used as interfaces between the actual agents (themselves being possibly other MANIFOLD coordinators). An agent, say a seller or a buyer, cannot arbitrarily communicate with some other agent but instead it will have to ask for permission a special coordinator; the latter may allow the communication to continue or it may itself do it on behalf of the agent that requested it. Thus, these special coordinators which interpose themselves between an agent and the rest of the world, regulate the behaviour of the agents and provide logical security. These coordinators can be seen as law enforcers where the law itself is defined and implemented by their MANIFOLD code; the idea of special law enforcing agents has been introduced in [12,13] and in this section we illustrate how the framework described in [13] can be implemented naturally in our model. The overall setup is illustrated in figure 3 below where for each e-commerce agent (implemented in MANIFOLD and other typical programming languages such as Java) there exists a controller or law enforcer implemented in MANIFOLD; the latter is used to intercept all messages sent from the agent to the rest of the world (i.e. other agents with which it cooperates) as well as messages sent to this agent from other agents. No agent is allowed to enter and get involved in some transaction without the presence of a MANIFOLD controller. Rest of the world MANIFOLD Law Enforcers E-Commerce Agent Figure In particular, we show a number of regulator coordinators that enforce the following N-ticket law as defined in [13]. A client wishing to buy goods, first sends to a ticket seller a request consisting of the value N of the ticket and an electronic certificate. If the certificate is valid, the ticket seller sends back to the client the N-ticket. The client then can use the ticket up to N times to buy goods. In addition to the elementary security that is needed at the implementation (or communication) level, we also want logical security in the sense that: (i) only a ticket seller should be allowed to provide tickets, (ii) tickets should not be duplicated by clients, and (iii) clients should not use a N- ticket for more than N times. The MANIFOLD code for this scenario follows promptly. event send_ticket. auto process agora is Mall(). auto process seller is TicketSeller(). auto process client is Client(). manifold client_law(process client) { event get_ticket, buy, req_ok. auto process ec is ElectronicCertificate(). auto process value is variable. auto process certificate is variable. begin: terminated(self). get_ticket.client: client -> value; <<&self,value,certificate>> -> seller; terminated(self). send_ticket.seller: { auto process id_seller is variable. auto process id_client is variable. begin: getunit(input) -> if id_seller==seller && id_client=client then value -> client; { begin: terminated(self). buy.client: if value>=1 then auto process request is variable; auto process valid is Validate(); client -> valid, -> request); req_ok.valid: request -> agora; manifold ticket_law (process seller) { event ec_ok; auto process value is variable. auto process ec is variable. auto process id_client is variable. begin: getunit(input) -> <<id_client,value,ec>>; <<value,ec>> -> seller; terminated(self). <<&self,id_client,value>> -> id_client). For every client wishing to get an N-ticket before starting buying goods and every seller providing tickets, there exist respectively a client_law and a ticket_law regulator, which enforce the law and intercept any communication between a client and a seller. When a client process wants to get a ticket, the corresponding client_law process sends the tuple <<client_id,N-value,electr_certificate>> to the ticket_law process. The latter informs the seller process it monitors that a ticket is being requested and seller checks the certificate. If the certificate is valid, seller informs ticket_law and the latter uses the client_id part of the tuple it received to connect to client_law and send the requested ticket. Upon receiving the ticket and checking by means of comparing ids that the ticket has been sent by the right seller and is addressed to the intended client, client_law informs client that the ticket has arrived. It then monitors any attempted transaction between client and agora (a group of service providers, themselves monitored by some other regulator coordinator not shown here), making sure that the client does not exceed the N-value limit. Note that the above coordinators enforce security at both the logical and the implementation level. A client process cannot copy a received ticket to some other similar process since the ticket is being held by its regulator client_law process; nor can client exceed the ticket's value since when N=0 any additional transaction between client and agora will not be allowed. Furthermore, a ticket_law process makes sure that tickets can only be issued by a valid seller process and, once a ticket is issued, it is forwarded to the client process that requested it; this is achieved again by making use of the ids of itself as well as the client process that requested the ticket. Finally, as we have already discussed previously, elementary security at the level of exchanging information is guaranteed by virtue of the IWIM model and MANIFOLD's implementation. 4.3. Integrating different components In this section we show the applicability of control-based event driven coordination models such as MANIFOLD for the development of generic interaction frameworks, often referred to as shopping models ([10]), where the interaction and communication part (in other words the program logic) is separated from low level details such as the security or payment mechanisms employed, etc. The top-level environment follows the logic of ([10]) and consists of four main components: a merchant handler, a customer handler, a shopping controller and a services controller. The first two are used to intercept and handle the requests, messages and data interchanged between a customer and a merchant, the third one coordinates the interaction between the previous two entities while the last one controls the invocation of specific services such as payment methods. As illustrated in figure 4 below, customers and merchants interchange messages indirectly via a shopping controller, which monitors their interaction, and, if the need arises, plays the role of an objective referee. Furthermore, clients interact with service controllers to whom they delegate the, often of lower level nature, tasks of invoking specific services. All interactions are event driven and the coordinators for these four basic entities (shown in shaded rectangular boxes) are implemented in MANIFOLD. The actual model we have in mind is quite elaborate and complicated but for the purposes of this paper we show the most important parts of the MANIFOLD code for the case of initiating a payment from a customer to a merchant assuming that the order has just been completed. event order_complete, commence_payment, receive_order, payment_complete. manifold CustomerHandler() { event proceed. process checkpayment(proceed) is CheckPayment atomic. begin: terminated(self). pay.*shopping_controller: (activate checkpayment, terminated(self)). proceed.checkpayment: raise(commence_payment). manifold MerchantHandler() { event order_ok. auto process checkorder(order_ok) is CheckOrder atomic. begin: terminated(self). receive_order.*shopping_controller: (shopping_controller -> check_order, raise(order_complete). manifold ShoppingController() { begin: terminated(self). raise(pay). payment_complete.*services_controller: . manifold ServicesController() { event payment_done. process paymentservice(payment_done) is PaymentService atomic. begin: terminated(self). commence_payment.*customer_handler: (activate paymentservice, terminated(self)). payment_done.paymentservice: raise(payment_complete). After being alerted (by means of observing the event receive_order) by the Services Controller to the arrival of a new order, the Merchant Handler checks if the order is complete. The lower level details of how this is done are immaterial to the basic program logic and are delegated to some atomic process (typically a C program accessing a database of information and making any necessary checks). Upon receiving by this atomic process a confirmation that the order is ok, the Merchant Handler raises the event order_complete, indicating that the phase of a customer ordering some goods has been completed. The Services Controller then commences the payment phase by raising the event pay. In response to observing this event, a Customer Handler first makes sure that he agrees with the details of the payment procedure (this lower level activity is performed by the atomic process CheckPayment possibly by contacting the Merchant Handler) before raising the event commence_payment; the latter will be observed by the Services Handler which will proceed to perform the payment. Again here the lower level details of the actual payment transactions are being delegated to some atomic process (PaymentService) which is parametric to the top level generic shopping model and can be substituted at will (e.g. initially DigiCash is used and later on a switching is made to First Virtual). Customer Services Shopping Controller Merchant MANIFOLD coordinator Figure Exchange of messages 5. Conclusions - Related and Further Work In this paper we have examined the use of a control-oriented, event-driven coordination mechanism (namely the IWIM model and its associated language MANIFOLD) in modelling Electronic Commerce activities. We believe an Electronic Commerce framework based on MANIFOLD enjoys a number of desirable properties such as natural distribution, hiding of lower level details, exploitation of high-performance computational resources and secure communication without compromising the flexibility and openess that any such environment should support. Our approach allows for the formation of coordination patterns for Electronic Commerce transactions which can be used for many cases irrespective of the types of potential sellers and buyers, offered services and products, etc. Coordination languages like MANIFOLD support complete decoupling in both time and space; i.e., agents send information without worrying as to who (if anyone at all) receives this information, while other agents receive information without worrying who has sent it or whether the sender is still alive. Thus, it is possible to introduce new players to a coordination protocol for some Electronic Commerce transaction, enhance or replace existing offered services, etc. Furthermore, the use of coordination technology along the lines described in this paper is orthogonal to many other issues relevant to the case of Electronic Commerce. More to the point, the work here can be combined with work on intelligent agents (typically used to offer customer support in finding and selecting the most appropriate service) to derive coordination protocols where each MANIFOLD process behaves as such an agent, dedicated to perform some particular task. Furthermore, atomic processes (i.e. processes not written in MANIFOLD due to their involvement with aspects not directly related to the coordination protocols) can be as elaborate as necessary without further complicating the communication protocols. For instance, CheckDescr or CheckSpecs (and other similar processes) could actually be interfacing to a sophisticated knowledge base or use constraint satisfaction techniques, in order to reach any decisions. On another front, MANIFOLD processes can be seen as mobile agents, migrating from one place to another in order to be as efficient as possible and also exploit the underlying hardware infrastructure. We are currently designing an elaborate environment for Electronic Commerce based on the principles described in this paper. Our paper complements (initial) work by others in the use of coordination models for modelling Electronic Commerce activities. More to the point, [8] describes such a model based on the Linda coordination framework. As we have argued in this paper and elsewhere ([14,15,16]), the (vanilla) Linda formalism is based on the use of an open and public shared communication medium (in the case of [8] this is the PageSpace) where access for either placing or retrieving information is almost unrestricted. Thus, the basic model is inherently insecure and extra devices must be built on top of it. The same can be said about the work presented in [9] where Prolog is used to model agents communicating via MarketSpace, a medium very similar to Linda's tuplespace. On the other hand, our framework is based on secured (by virtue of the underlying IWIM model) point-to-point communications with broadcasting limited only to publicizing the most necessary information. --R Linda and Friends The IWIM Model for Coordination of Concurrent Activities An Overview of Manifold and its Implementation Visifold: A Visual Environment for a Coordination Language Communications of the ACM 35(2) Collaborative Applications Experience with the Bauhaus Coordination Language Coordinating Distributed Applets with Shade/Jada Surfing the Market and Making Sense on the Web: Interfacing the Web to an Open Agent-Based Market Infrastructure A Flexible Architecture for Information Commerce The Interdisciplinary Study of Coordination A Mechanism for Establishing Policies for Electronic Commerce Modelling Activities in Information Systems Using the Coordination Language MANIFOLD Coordination Models and Languages --TR --CTR Peter McBurney , Simon Parsons, Posit spaces: a performative model of e-commerce, Proceedings of the second international joint conference on Autonomous agents and multiagent systems, July 14-18, 2003, Melbourne, Australia
coordination models and languages;web-based applications;electronic commerce
597926
Model-based analysis of configuration vulnerabilities.
Vulnerability analysis is concerned with the problem of identifying weaknesses in computer systems that can be exploited to compromise their security. In this paper we describe a new approach to vulnerability analysis based on model checking. Our approach involves: Formal specification of desired security properties. An example of such a property is "no ordinary user can overwrite system log files". An abstract model of the system that captures its security-related behaviors. This model is obtained by composing models of system components such as the file system, privileged processes, etc. A verification procedure that checks whether the abstract model satisfies the security properties, and if not, produces execution sequences (also called exploit scenarios) that lead to a violation of these properties. An important benefit of a model-based approach is that it can be used to detect known and as-yet-unknown vulnerabilities. This capability contrasts with previous approaches (such as those used in COPS and SATAN) which mainly address known vulnerabilities.This paper demonstrates our approach by modelling a simplified version of a UNIX-based system, and analyzing this system using model-checking techniques to identify nontrivial Vulnerabilities. A key contribution of this paper is to show that such an automated analysis is feasible in spite of the fact that the system models are infinite-state systems. Our techniques exploit some of the latest techniques in model-checking, such as constraint-based (implicit) representation of state-space, together with domain-specific optimizations that are appropriate in the context of vulnerability analysis.Clearly, a realistic UNIX system is much more complex than the one that we have modelled in this paper. Nevertheless, we believe that our results show automated and systematic vulnerability analysis of realistic systems to be feasible in the near future, as model-checking techniques continue to improve.
Introduction System configuration vulnerabilities can be traced back to classic problems in software engineer- ing, such as unexpected interactions between different system modules and violation of hidden assumptions. For instance, consider a vulnerability that existed in early versions of the fingerd service. In servicing a query "finger user," this program needs to read a file named .plan in the home directory of user. The fingerd service runs with root privileges, and in the earlier versions of UNIX used to open the .plan as root. In the presence of symbolic links, this creates the following vulnerability. User u could symbolically link a file f as his/her .plan even if u has no read access to f . User u can then read f by simply running finger u! This vulnerability arises due to the interaction between the way the finger server operates and the way symbolic links are implemented. As a second example, consider the vulnerability involving the mail notification program comsat, which waits for reports of incoming mail for any user and prints the first few lines of the message on the terminal on which the user is logged. This terminal is determined from the file /etc/utmp, which used to be configured as world-writable (so that it can be written to from user level at the time of login). A malicious user can modify /etc/utmp, substituting /etc/passwd in the place of the terminal that he/she is logged on. The user can then send mail to self containing a line that starts with root::0:0: (which means that root has an empty password). Upon receiving this mail, comsat will overwrite the password file with the message. The user can now login as root without providing a password. 1.1 Our Approach Formal methods are a good choice to address software engineering problems that arise due to unexpected interactions among system components [9]. In this paper, we describe an approach for analyzing system configuration vulnerabilities using techniques drawn from formal methods research. Our approach involves: Construction of high-level models of system components. In order to detect the kind of vulnerabilities described above, we would start with abstract models that capture the behavior of UNIX file system, comsat and mailer programs, and a model of user behavior. Currently, we are developing these abstract models manually. In future, we expect that the model extraction process will be machine-assisted, employing program analysis techniques. Formal statement of desired security-relevant properties of the composite system. Vulnerabilities can be viewed as "flaws" in system configuration that can be exploited to violate certain security objectives of the overall system. To detect vulnerabilities, we need a formal statement of such security properties. One example of a property is that no ordinary user can overwrite system log files. Another example is that the password file cannot be modified except by a superuser, or by using a password changing program. Automated analysis of system model to check deviation from desired security properties. Configuration vulnerabilities can be identified by analyzing the overall system behavior (ob- tained by composing the models developed above), and determining if it violates the desired security properties. We use model-checking [6, 7, 16] for this analysis. An important benefit of model checking is that when a property is violated, a model checker provides a counterexample that shows how the property is violated. This paper demonstrates our approach by modelling a simplified version of a UNIX-based system, and discovering nontrivial configuration vulnerabilities in this system through automated analysis. Clearly, a realistic UNIX system is much more complex than the one that we have modelled in this paper. Nevertheless, we believe that our results show that automated analysis of realistic systems are feasible in the near future, especially since faster techniques for model-checking are being developed. Although the use of model-checking has been examined in related contexts such as verification of cryptographic protocols and network vulnerabilities [20], ours is the first attempt at using model-checking for system configuration vulnerability analysis. One of the principal difficulties in this context is that system models tend to possess an infinite number of states. This is because we need to model such aspects of the system as file names and (nested) directory structures, with the ability to create or destroy an infinite number of files. Traditional model-checking techniques (such as those employed in [20]) are limited to finite-state models only. A key contribution of this paper is to show that nontrivial vulnerabilities can be discovered using automated model-based analysis, in spite of the fact that the system models are infinite-state. It shows that known techniques such as model abstraction and constraint-based representations can be employed to tackle the infinite-state model-checking problems that arise in vulnerability analysis. The rest of this paper is structured as follows. In Section 1.2, we describe previous approaches for vulnerability analysis and summarize the main advantages of a model-based approach. In Section 2, we describe our approach for modelling a simplified subset of UNIX. Our analysis technique is described in Section 3. The results of this analysis are presented in Section 4. Finally, concluding remarks appear in Section 5. 1.2 Related Work Research in vulnerability analysis has focused primarily on identification of configuration errors such as improper file permission settings. Existing works [2, 11, 23] employ a set of rules that enumerate known causes for vulnerabilities. We call these works collectively rule-based. Widely used tools such as COPS and SATAN search for occurrences of such known vulnerabilities [11]. However, the generation of the rules relies on expert knowledge about interactions among many components of the system. Few experts have a complete understanding of the interactions among all components of a modern computer system. Issues such as race conditions, many possible interleavings, hidden assumptions etc. [3] make it very hard for humans to come up with all such rules. A model-based approach does not suffer from these disadvantages. Human involvement is needed primarily to develop models of individual system components. The problem that is hard for human reasoning, namely, that of reasoning about interactions among system components, is relegated to a mechanical procedure. The advantages of a model-based approach are: Identification of known and unknown vulnerabilities. Analysis of formal models can identify known and as-yet-unknown vulnerabilities. In contrast, the rule-based approaches have been limited to examining the system for known vulnerabilities. Modularity. The effort required to add new system components (e.g. new privileged programs or significant software upgrades) is determined only by the new components to be added. Models of existing components need not be changed. This contrasts with rule-based approaches, where new rules need to be added that capture not only the interactions among new components, but also interactions between new and old components. Generating patterns for misuse intrusion detection. When vulnerabilities are identified by our analysis, we may sometimes be able to rectify them. At other times, there may be no immediate fix, as it may require changes to vendor-provided software, or since the changes may interfere with legitimate functionality of the system. A second line of defense for vulnerable systems is misuse intrusion detection, where system use is monitored in order to detect known exploitations. The exploit scenarios are usually specified by an expert, while the process of detection of exploits is automated. The approach outlined in this paper enables automation of the first task as well, since the counter examples generated by our model-checking technique correspond to exploits. We can mechanically translate these exploits into patterns for a misuse intrusion detection system. Automatic generation of rules for checking vulnerabilities of specific configurations. The proposed approach can detect system vulnerabilities even when no information is provided about the initial system configuration. Our model-checking technique produces exploit scenarios that are conditional upon the (unspecified) initial configuration. Each of these conditions then capture a potential vulnerability that can be checked using a rule. The main benefit of using these rules is that they can potentially be checked more economically (in terms of time and memory usage) than running the model checker. This paper builds on some preliminary results on model-based vulnerability analysis we had reported earlier in [17]. Since then, Ritchey and Ammann [20] have suggested a promising approach for automating network vulnerability analysis. Their approach starts with higher level models than ours. Their models capture known exploits on individual systems, e.g., that a given version of a web server contains a vulnerability that allows a remote user to gain access as a local user, and that a certain host is running this version of the server. Model checking is then used to check if these exploits can be "strung together" to achieve a greater degree of access than what can be obtained by individual exploits. In contrast, our approach is aimed at discovering the individual exploits from models of (legitimate) behaviors of systems. Another important difference is that their models are finite, which enables them to use widely available model checking tools such as SMV [8] and SPIN [13] to perform vulnerability analysis. In contrast, we need to deal with infinite state systems. This is because finite models cannot capture components such as file systems where files can be added, renamed or removed, and there is no bound on how many times these operations may be repeated. Modelling Security-Related Behaviors of Systems In this section, we first describe our model for a small subset of a UNIX-based system. This subset captures a simplified view of the file system and other operating system facilities, and is sufficient to uncover nontrivial vulnerabilities during the analysis process. We begin with a short description of the language we use for modelling, described in enough detail to understand the models. complete description of the language is not relevant for the purposes of this paper, and hence not include here.) 2.1 Modelling Language We describe our model using a modelling language similar to CSP [12], but extended with object-oriented capabilities. Since our underlying model checker is based on the Prolog language, many features of the modelling language are similar to those in Prolog. In addition, some of the syntactic features are similar to those used in Promela, the modelling language used in the SPIN [13] verification system. In this language, a system is modelled as a collection of concurrently executing processes that communicate with each other. Each process is viewed as an object. Its internal state is encapsu- lated, and cannot be accessed by other processes. Communication among processes takes place via method invocations. Method invocation is synchronous: it causes the invoking process to block until the method invocation is completed, and return values sent back. Objects are instances of classes. A class definition consists of the definition of the encapsulated state, definitions of externally visible methods and definitions of local methods (otherwise known as private methods or helper functions). Single inheritance is supported in the language. Thus, a class definition is of the form: class ClassName(DataMemberNames) [:BaseClassName(DataMemberNames1)] fMethodDefng+ An object is created by invoking the class name with parameters corresponding to its data mem- bers, using the syntax: Methods are defined using the following syntax. Like predicates in the Prolog language, method invocations in this language always return a boolean value. In addition, some of the arguments to a method may get instantiated as a result of invoca- tion. This feature is used to communicate return values. We use the convention that all of the return parameters appear after the input parameters in method invocations. The language supports basic data types such as booleans, integers, floats and strings. Usual operations on these types are also supported, and can be used to construct complex expressions from values (or variables) of basic types. The language also supports compound types based on an algebraic type system, similar to that provided by Prolog. These types are used to represent structured data such as file names, file contents, and the contents of the entire file system. Two of the most common compound types are tuples and lists. We assume that different processes execute concurrently. The language uses an interleaving semantics to determine the result of concurrent executions. At the lowest level, operations such as assignment are performed atomically. A method body consists of a sequence of operations. All operations return a boolean value, with the value true denoting successful completion of the operation and false denoting failure. Method invocation begins with the execution of the first operation in the sequence. If this operation succeeds, then the next operation is executed and so on. If all of the operations in a sequence succeed, then we say that the entire sequence succeeds. Otherwise, the sequence fails, returning the value false. In such a case, the method invocation itself returns false, indicating failure. Operations can either be primitive or compound. A primitive operation is either a method invocation, or an application of a predefined predicate, such as equality or other relational opera- tions. Note that the equality predicate has the same semantics as in Prolog - in particular, it can bind values to variables. A compound operation is constructed from primitive operations using the following constructs: Atomic execution: atomic OpSeq has the same semantics as OpSeq, except that the operations within OpSeq will be executed atomically, i.e., their execution will not be interleaved with the execution of other processes. Alternation: OpSeq1 jj OpSeq2 will succeed if either OpSeq1 or OpSeq2 succeeds. Other- wise, it will fail. Note that OpSeq2 will be executed only if OpSeq1 fails. Parallel composition: OpSeq1 j OpSeq2 will result in concurrent execution of operations in OpSeq1 and OpSeq2. If either of these sequences succeed, then the entire construct succeeds. if-then-else: if OpSeq1 then OpSeq2 else OpSeq3 will result in execution of OpSeq1. If it succeeds, then OpSeq2 will be executed, and its success or failure will determine the success or failure of the if-construct. If OpSeq1 fails then OpSeq3 will be executed, and its success or failure will determine the success or failure of the if-construct. Guarded command: G1 > OpSeq1 jj G2 > OpSeq2 jj jj Gn > OpSeqn has the following semantics. One of the guards that evaluate to true, say Gk, will be chosen arbitrarily, and the corresponding operation sequence OpSeqk will be executed. If this sequence fails, an alternative guard that evaluates to true will be chosen, and the operation sequence corresponding to that guard will be executed. If none of the operation sequences (corresponding to guards that evaluate to true) succeed, then the guarded construct fails. Otherwise, it succeeds. For simplicity, we restrict the guards to contain only predefined operations, such as equality checking. They cannot contain method invocations. Loop construct: loop OperationSequence construct has the meaning that OperationSe- quence will be executed repeatedly. More precisely, its behavior can be specified using the recursive definition loop Semantics of operation failure is similar to that of Prolog. When a failure occurs, execution backtracks to the point where an alternative execution path could be taken. All variable bindings made between this point and the point of failure are undone, and execution now proceeds down the alternate path. Note that this implies that (a) the same operation may succeed many times, possibly with different variable bindings, and (b) in an operation such as OpSeq1 jj OpSeq2, it is possible for OpSeq1 to succeed, but a subsequent operation that follows alternation may fail, in which case, execution may backtrack to the alternation construct, at which point OpSeq2 may be tried. Additional details about the language are provided together with the examples below. 2.2 Model of File System The state of a file system is modelled as a set of tuples of the form (FileName, Owner, Group, Permissions, Content). The file name is represented as a list: a name such as "/a/b/c" would be represented as [a,b,c]. The owner and group are represented as integers. The permission field captures the usual UNIX permission information on files. The file content is represented as normal(C) for normal files whose content is given by C, and link(F) for (symbolic) links to another file F. To simplify the presentation, we are not representing directories as files. However, the directory structure is captured implicitly in the way files are named. In effect, this means that information such as directory level permission cannot be represented directly; it must be propagated and represented as permission on files contained in the directory. The file system behavior is captured by the fileSystem class shown below. Note the use of Prolog-style convention: variable names start with a capital letter, while constant, class and function names start with a lower case letter. The file system supports operations to read and write files. The write operation can also be used for file creation, while a remove operation is provided for file deletion. File attributes such as ownership and permission can be changed using the operations chmod, chgrp and chmod. Our file system model does not capture hard links, but symbolic links can be created using the symlink operation. All of the file operations make use of a helper function called resolve that first resolves symbolic links into real file names, and then performs permission checking. class fileSystem(S) { // public methods chown(F,U,G,O) ::= resolve(F,U,G,root,F1), chngOwner(F1,O) A number of other helper functions such as getContent and updateFile are used in the above methods. The definition of these helper functions is straightforward. Of these, we provide the definition of getContent below, while omitting the others in the interest of conserving space. getContent(F, C) ::= member((F,U,G,P,normal(C)), S) The helper function resolve is nontrivial, and we provide its definition below. Its parameters are: the file name F to be resolved, the user and group identifiers U and G with respect to which permission checking needs to be done, and an option argument Opt. It returns the resolved name F1 in the fifth parameter. The resolve method will fail either if the file name does not exist, or if the permission check fails. member((F2,O,G1,P,normal(C)), S),// check if tuple is present in set S no permission checks for root check if user U is file owner then resolveLink(F, F1)) || . // other options omitted else The resolve method uses a helper function resolveLink. The latter is a recursive function that keeps following symbolic links until a normal file name is identified. It does this by checking if a file named F is present in the file system. (Note that the state of the file system itself is being captured as a list, and member is a predicate that is used to search for a specified element in the list.) If F is not present, then resolveLink fails. Otherwise, if the content of F is of the form link(F2), then resolveLink is invoked recursively to follow this link. Otherwise, it must be a normal file and hence F is returned as the resolved name. Note that the definition of resolveLink correctly captures the fact that no permission checking is done for symbolic links. Once symbolic links are resolved, resolve proceeds to check file permissions. Note that no checking is done if the userid U corresponds to that of root. Otherwise, permission check proceeds, based on the value of option Opt. If the option is read, write or execute, the corresponding permissions are checked. If the option is owner, then the permission check operation needed is one of checking if the userid provided as a parameter is the same as the file owner. 2.3 Model of UNIX Processes UNIX processes are modelled using a base class called unixProc that captures behaviors common to all processes, plus a derived class per program that we wish to model. The state of a unixProc object is characterized by its real and effective user/group identifiers, plus information about groups known to the system. In addition, it contains a reference to the file system object, and the values of command line arguments. It provides helper functions that correspond roughly to system calls. class unixProc(UID, EUID, GID, EGID, ArgList, FS, UserGroups) { . // definition of several other similar methods is omitted corresponds to fork+exec(F) in UNIX FS.resolve(F,EUID,EGID,exec,F1), if FS.resolve(F1,EUID,EGID,setuid,F2) then FS.getOwner(F1, EUID1) else if FS.resolve(F1, EUID, EGID, setgid,F3) then FS.getGroup(F1,EGID1) else FS.getContent(F1, program(C)), // F1 must contain a program create(C, UID, EUID1, GID, EGID1, ArgList1, FS, UserGroups) // create is a language construct that results in creation of // a new object belonging to the class of its first argument. // The state of the object should correspond exactly to the // parameters supplied to create . // Other methods omitted Subclasses of unixProc define externally accessible methods, and make use of the methods provided by unixProc class. They also need to provide a main function that gets executed as soon as a process is created. The process terminates (and the object destroyed) when the main function terminates. Based on unixProc, we can define an lpr class as follows. At the level of the file system, lpr either copies the file to be printed into a spool directory or links it there symbolically, depending upon a command line option. // In addition to usual process parameters, lpr takes 2 arguments: // the name of the file to be printed, and an option that indicates if this // file is to be copied to the spool directory before printing, or just // symbolic-linked from the spool directory. class lpr(U, EU, G, EG, [File, Opt], FS, UG): { atomic { // N is used to create a temporary name for the spool file read([var,spool,lp,count], N), FS.resolve(File,U,G,read,F1), // accessiblity of File checked for U, subsequent operations are then symlink([var,spool,lp,N], File) // performed with root privilege else read(File,C), In a similar manner, we can define the behavior of a highly simplified mail receiver/sender as follows. This mail server operates by storing every incoming email message in a spool directory corresponding to the recipient. For simplicity, we model the act of storing in a way that loses previous contents of the spool file. class mailer(FS, UG): unixProc(root, root, sys, sys, [], FS, UG) { send(U, M) ::= write([var,spool,mail,U], M) Finally, we model the action of the comsat mail notifier program. It looks up the file /etc/utmp to identify the terminal where each user is logged in. Whenever a new message is received for a user, comsat prints the message on the user's terminal. We represent the content of the /etc/utmp as a list of records. We add additional helper functions to the file system model to support writing and reading from such structured files. Of particular interest is a helper function called readRec that allows access to a specific record whose first component is specified as an argument to readRec. class comsat(FS, UG): unixProc(root, root, sys, sys, [], fs, ug) { main() ::= loop { read([var,spool,mail,Rcvr], Msg) readRec([etc,utmp], Rcvr, Tty), write(Tty, Msg) The loop construct indicates that the operations inside the loop are executed forever, until the process is killed. These operations make use of an unbound variable Rcvr. Such variables are treated as existentially quantified. Operationally, this amounts to binding the variable to an arbitrary value in its domain. Thus, comsat nondeterministically chooses some file in the mail directory such that the corresponding user is logged in, and printing the message on the user's terminal. Data-nondeterminism, as captured by the use of such unbound variables, is a key mechanism that simplifies our models. We now develop a model of a user. The user's behavior is also highly nondeterministic in nature: he/she selects an arbitrary file in the system, and may read this file or overwrite it with arbitrary content. The user may also run arbitrary commands, or send an arbitrary message to an arbitrary user. Arbitrary choice in data values is captured by using unbound variables. The arbitrary choice among the commands is captured by the guarded command construct within the loop. The guarded command construct is within a loop, which indicates that the user will keep performing these actions indefinitely. class user(U,G,FS,UG): unixProc(U,U,G,G,[],FS,UG) { main() ::= loop { true -> read(F1, C) || true -> write(F1, C) || true -> run(lpr, Args) || true -> mailer.send(U1, M1) Finally, we put all of the classes defined so far into a single system model using a class called init. Note the use of j operator, which denotes parallel composition of multiple processes. class init(FS, UG) { main() ::= mailer(FS, UG) | comsat(FS, UG) | user(U, G, FS, UG) Detecting System Vulnerabilities In our approach, we use model checking techniques to analyze the behaviors of the system model. In the simplest case, security properties are invariants: properties that must hold at every state of the system. For instance, the simple model described in the previous section does not model legitimate ways to modify the password file (e.g., passwd); hence, the constancy of the password file is a desired system invariant. In Section 3.3 we describe how more complex (temporal) properties that depend on order of events can be specified. One of the important features of model checking techniques is their ability to generate counter- examples, which are sequences of states that lead to violation of the given property. In our ap- plication, the counter-examples correspond to the steps that an attacker can use to exploit system vulnerabilities. However, current model checking tools cannot be used as is, since many components of the system model described in Section 2 have infinitely many reachable states (e.g., the states of the file system). Current model checking tools work mainly with finite-state systems. Hence we developed a prototype model checker based closely on the XMC system [18], a system that has been developed by one of the authors of this paper. XMC can handle certain classes of infinite-state systems by using implicit representation of state space using constraints. The XMC system is implemented using the XSB tabled logic programming system [22] by casting the model checking problem as a query evaluation problem. Tabling provides stronger termination properties for XSB in comparison with (untabled) logic programming systems. In particular, computations for solving equations using iterative procedures (e.g., fix-point iteration) can be programmed very easily, thus making XSB an ideal platform for rapid implementation of program analyzers and model-checkers. In XMC, the transition relation of the system model is treated as an external database; the verification problem is solved by running reachability queries over this database. Our prototype follows the same approach. The significant difference is that the reachability queries are made over an infinite transition system in the case of vulnerability analysis. This infiniteness is handled by exploiting the following features of the XSB system. Following XMC, we represent states of the system model using terms. The difference in our prototype is that these terms may contain logical (unbound) variables that represent unknown data in the system models. We use constraints between terms to relate states in the system model. In the finite-state case handled by XMC, the states are represented by ground (i.e. variable-free) terms, and relation between states is a simple table. In our prototype we relate states, now represented by possibly non-ground terms, using equality constraints among the variables. We use the power of tabling in XSB to identify "similar" states (in our case, states that differ only in the names of bound variables) and to reuse computations when a state similar to one encountered earlier is seen again. In our implementation, we translate the high-level model of the system into a Prolog database (a set of facts) that represents the system's transition relation. As noted in Section 2, our modelling language resembles Prolog in many ways. This factor considerably simplifies the translation al- gorithm. (In fact, the translation is very similar to that described in [10] for translating processes described in a value-passing process algebra into logic program rules representing the transition relation.) Although the translation algorithm is conceptually simple, its implementation still requires significant effort. Given the small scale of our models, we have found it easier to perform this translation manually. In the following, we first assume that the property to be verified is specified as a formula in temporal logic [14]. We then describe the notion of intentions model (see Section 3.3) which eliminates the need to encode complex security properties in temporal logic. The model checking procedure is implemented as reachability query, and is evaluated using the XSB system. 3.1 Model Checking Infinite-State Systems The infiniteness in the state space of a system arises from two factors- data nondeterminism (in- finite branching factor), and execution histories (infinitely long paths)- each of which is handled using a different feature of the model checker. Infiniteness due to data nondeterminism is handled by term constraints. Recall that data non-determinism arises from unbound variables in the system model. Term constraints capture the possible values of such variables succinctly. The constraints are represented and manipulated by the XSB system itself, and need no further programming. For instance, consider the problem of verifying whether /etc/passwd can be overwritten in the system model in Section 2. Observe from the example that the system can evolve when an arbitrary user chooses to perform a write action of some file, or when a user sends mail. With the logic-programming-based model checker, neither the user nor the message needs to be bound to any particular value: we represent these as logical variables. Unification and backtracking automatically generate the cases of interest, by binding the variables only to values that lead to vulnerabilities. For instance, when a user sends mail, the process comsat is enabled, which sends a notification (using write) to the destination specified in /etc/utmp. Note that, at this point, neither the contents nor the permissions on /etc/utmp are known. The model checker tries each case in turn, by binding the variables to the needed set of values. If /etc/utmp is unreadable or if the required entry (the destination for notifying incoming mail) is not found, no notification is sent and the system reverts back to its original state. On the other hand, if the destination D for notification is present in /etc/utmp, then a write to D is issued. Since the contents of /etc/utmp are unknown, note that D will be left as a variable. If the destination D can be /etc/passwd, then it is indeed possible to change the password file in our model. Thus, the model checking algorithm concludes that if /etc/utmp specifies /etc/passwd as one of the notification destinations, then it is possible to violate system security. Infinite execution sequences are handled by abstracting the sequences to finite (possibly re- peating) segments of a certain kind. Of particular importance is the abstraction that bounds the lengths of sequences. Capturing unknown (or don't-care) values by variables can automatically abstract infinite execution sequences. For instance, consider a user write action to an arbitrary file in the system model in Section 2. This does not constitute "progress" since it does not enable any state change that was impossible before. The lack of progress is easily captured by term con- straints. In the state before a write operation to an arbitrary file F , the file's content is represented by a variable, say C F . In state after the write operation, the file's content is changed to C 0 F , which is simply a variant (i.e., identical modulo variable renaming) of the original content. If the effect of write operation is known (say, the new content is ), then the new state is an instance of (i.e., is subsumed by) the old state: hence, no new transitions are possible. Thus we see that progress can be seen as change modulo term subsumption. The above scenario assumed that nothing is known about the initial state of the system: the files, their contents, the relevant permissions, etc. When the system's initial state is (at least par- tially) known, a user's write action changes the system state; for instance, the constraint that /etc/utmp has no reference to /etc/passwd may no longer be true after an arbitrary write action is done, if the access permissions of /etc/utmp allow the write action to succeed. Thus, the state of the system after an arbitrary write action is different from the initial state of the sys- tem. The model checker will explore the system evaluation from this state, and can again conclude that there is a potential vulnerability as long as /etc/utmp can be modified by an arbitrary user. Variable abstraction alone is insufficient in general, and we employ approximations that lose information by either ignoring state changes (thus pruning execution sequences), or ignoring conditions on state changes (thus repeating execution sequences). Note that such an abstraction may be "incomplete" in the sense that vulnerabilities in the original model may not be present in the abstract model. However, this limitation is reasonable in our case if we assume that the system vulnerabilities will be exploited by human attackers using their intuition and expertise to come up with attack scenarios. This implies that the sequence of actions that they would perform to achieve intrusion will typically be a short sequence, and thus it may be acceptable to miss out vulnerabilities that require long sequences of actions. Based on this assumption, our method uses a search procedure with iterative deepening, stopping the search after a predetermined depth. The search procedure uses the programming and tabling capabilities of XSB. 3.2 Generating Counter-Examples The counter-example traces produced by a model checker correspond directly to attack scenarios. Hence the set of all counter-examples can be used to drive intrusion detection. Note that, even in the finite-state case, it is infeasible to enumerate all possible counter-examples. To overcome this problem, we avoid an explicit enumeration of all counter examples, instead choosing to represent them using a finite-state automaton. The automaton represents the set C of counter-examples, such that each example c 2 C corresponds to a path in the automaton. The automata representation is succinct and can be used directly for intrusion detection. Moreover, such an automaton can be constructed by inspecting the memo tables built during model checking: the table entries form the states of the automaton and the dependencies between the entries form the transitions. The automata-based representation of counter-examples extends naturally to the case of infinite- state systems as well. In this case, each state in the automaton is associated with a set of variables, while the transitions specify conditions on their values. Such automata have the ability to represent generic counter-examples: those that are parameterized with respect to specific system configura- tions. We can generate such counter-examples by leaving the initial state of the system unbound and using data nondeterminism to lazily binding the state variables, as explained earlier with the comsat example. The automata representing these generic examples can then be instantiated for particular system configuration parameters to check for vulnerabilities. Thus the automata themselves are generic with respect to configurations. However, the automata must be regenerated when system's capabilities change, e.g., when new services are added. Note that in general, for infinite-state systems, there may be no finite representation for the set of all counter-examples. However, note that the abstractions we use bound the length of counter example sequences, thereby making it possible to find a finite representation for the set of all counter examples. 3.3 Beyond Invariant Properties In the comsat example explained earlier, the property of interest was an invariant. In general, however, one would be interested in path properties. For instance, there may be a password changing program passwd on a system that allows a user to modify his/her password, and thus change the contents of the password file. Clearly, execution paths where the password file is changed by the passwd program, or by a system administrator, do not correspond to any vulnerabilities. Path properties can be encoded in temporal logic [14]. They can eliminate "degenerate paths" such as those where the superuser changes the password file or it is changed by the passwd pro- gram. This is done by adding antecedents to the original safety property that are violated by such degenerate paths. A problem that arises in the context of vulnerability analysis is that the description of degenerate paths tends to become very large, since there are many degenerate cases. For instance, there may be many different ways in which a superuser can change the password file: by overwriting it, by using an editor, by using the passwd command, etc. Enumerating all such degenerate paths is impractical since the temporal logic formula becomes very large and difficult to understand, and hence is likely to contain errors. To address this problem, we propose the following approach where the original safety property is left unchanged. In order to eliminate degenerate paths, we develop a second model called the intentions model. An intentions model captures the intended outcome of executing every program. These intentions are stated in terms of the files that may be written or executed in the course of executing the program. The system model has vulnerabilities if it contains paths to unsafe states for which there exists no corresponding path in the intentions model. For example, an intention model of mail daemon would be that it writes files in the directory /usr/spool/mail. The intention model of lpr would be that it writes files in the directory /usr/spool/lp. The intention model of passwd program would be that it writes /etc/passwd file. The intention model, by default, will refer to normalized file names, which correspond to an absolute file names that are not a symbolic links. This would be appropriate in the case of mail daemon and lpr. Situations where symbolic links are permitted, will be made explicit in the intentions model. For instance, an intention model of cp program will state that it will overwrite a file provided as an argument, regardless of whether it is a symbolic link or not. When an intentions model is used, the model checker must disregard the "intended paths," i.e., paths where every action is also in the intentions model. A simple way to do this is to leave the model checker unchanged, but prune away paths from the counter-example automaton. Clearly, more efficient techniques to eliminate intended paths can be developed, and is a topic of current research. 4 Analysis Results Our current implementation finds vulnerabilities expressed as violations of invariant properties. When reporting the violations, we distinguish between the value of initial system configuration parameters and the sequence of events that leads to the violation. We present the results in the when scenario where condition specifies the configuration parameters and exploit is the path that leads to the violation. 4.1 Vulnerabilities due to comsat Given the simple model of a UNIX system described in Section 2, our current implementation identifies the following vulnerabilities that would ultimately enable the password file to be overwritten. These vulnerabilities were found using a query to check for reachability of _.write([etc, passwd], _): a state where an arbitrary process writes to /etc/passwd. The first vulnerability identified is a trivial one: it corresponds to the case when the password file is world-writable. Even though this an obvious vulnerability, it is nevertheless an interesting discovery, given that the model does not even mention the file /etc/passwd. The use of data- nondeterminism in our models, and its implementation using term-constraints, enables us to derive this scenario. when FS.resolve([etc, passwd],U1,G1,write,F1) scenario [user(U1,G1,FS,UG).write([etc, passwd], M)] The way to read this is as follows: if there exists a file /etc/passwd that is writable by some user U1 belonging to a group G1, then this user can write the password file with arbitrary data M. The second vulnerability identified is the comsat vulnerability described in the introduction. It happens when a user U1 has permission to write the/etc/utmp file. Note again that this vulnerability was identified, even when the model checker was provided no information about the original state of the system. By virtue of the way term constraints are handled in our model-checker, it is able to infer the appropriate relationships that must hold between the contents of the /etc/utmp file and the password file, as well as the file permissions that must hold for the vulnerability to be exploited. when FS.resolve([etc, utmp],U1,G1,write,F1) scenario [user(U1,G1,FS,UG).write([etc, utmp], (U2, [etc, passwd])), user(U3,G3,FS,UG) invokes mailer.send(U2, M), mailer.write([var, spool, mail, U2], M), comsat.read([var, spool, mail, U2], M), comsat.readRec([etc, utmp], U2, [etc, passwd]), comsat.write([etc, passwd], M)] The scenario can be read as follows: in the first step, user U1 writes the file /etc/utmp with the record (U2, /etc/passwd). In the next step, user U3 invokes the mailer program to send a message M to user U2. This causes the mailer to write the message M into the spool file /var/spool/mail/U2. In the fourth step, the comsat program reads this spool file. In the fifth step, comsat reads the record from /etc/utmp that indicates that U2 is logged in on the terminal /etc/passwd (this record having been written in the first step of the scenario), and then overwrites /etc/passwd with the mail message M. Note that although the scenario mentions three users U1, U2 and U3, all three are existentially quantified variables - which means that they can all be the same user. The third vulnerability is similar to the second one, but the user directly overwrites the spool file instead of using the mailer to update the spool file. In order to do this, this user must have write permission to the spool file, and this extra condition is captured in the condition: when FS.resolve([etc, utmp],U1,G1,write), FS.resolve([var, spool, mail, U2],U3,G3,write) scenario [user(U1,G1,ug).write([etc, utmp], (U2, [etc, passwd])), user(U3,G3,ug).write([var, spool, mail, U2], M), comsat.read([var, spool, mail, U2], M), comsat.readrec([etc, utmp], U2, [etc, passwd]), comsat.write([etc, passwd], M)] Another attack scenario is an interesting variation on the previous attack, and does not require write permission to /etc/utmp. It brings together two known exploits, one involving the use of symbolic links and the other being the comsat vulnerability mentioned above. Although we had developed the models ourselves, we had not realized that our model contained this vulnerability. It is noteworthy that in spite of the simplicity of the models used, our model checking procedure identified vulnerabilities that were unknown to us. when FS.resolve([var, spool, mail, U2],U1,G1,write,F1) scenario [user(U1,G1,FS,UG).symlink([var, spool, mail, U2], [etc, utmp]), user(U3,G3,FS,UG) invokes mailer.send(U2, (U4, [etc, passwd])), mailer.write([var, spool, mail, U2], (U4, [etc, passwd])), user(U5,G5,FS,UG) invokes mailer.send(U4, M), mailer.write([var, spool, mail, U4], M), comsat.read([var,spool,mail,U4], M), comsat.readrec([etc, utmp], U4, [etc, passwd]), comsat.write([etc, passwd], M)] In this scenario, an user U1 first symbolically links the spool file /var/spool/mail/U2 to /etc/utmp. In the second step, user U3 invokes the mailer to send a message to the user U2. The message body consists of the single record (U4, [etc, passwd]). In the third step, the mailer writes this record onto the spool file /var/spool/mail/U2. Since this spool file had been linked to the /etc/utmp file in the first step, the record is actually written to the /etc/utmp file. Note that this step happens because the mailer blindly overwrites the spool file corresponding to the user U2 without checking (a) whether any user (in particular U2) has write permission for that file, and (b) whether it is a symbolic link. The rest of the steps in the exploit are identical to those of the previous vulnerability. 4.2 Vulnerabilities due to lpr Before analysis, we abstracted the system model for lpr by making the temporary spool file name to be a constant (i.e., making the counting modulo 1 instead of 1000). The combination of symbolic links and the standard spool file naming convention introduces the following vulnerability: when FS.resolve(F1,U1,G1,write,F2), FS.resolve([etc, passwd],U2,G2,read,F3), scenario [user(U1,G1,FS,UG).write(F1,C1), user(U2,G2,FS,UG).run(lpr, user(U3,G3,UG).run(lpr, [F1])] Since we start with an initial state that corresponds to an unbound variable, there are no files that can be printed in the initial state. The scenario shows that such a file can be created, and later read. It also requires read permission on the password file. Concluding Remarks In this paper, we presented a new model-based approach for analyzing configuration vulnerabili- ties. Whereas previous approaches relied on expert knowledge to codify causes of configuration vulnerabilities, this step is not necessary in our approach. Consequently, our approach can not only identify previously exploited vulnerabilities, but also discover new ones that have never been exploited. Our examples demonstrate the capability to discover such vulnerabilities: knowledge about vulnerabilities was never encoded into the system model, but our analysis was able to detect the vulnerabilities. It even identified vulnerabilities whose presence in the system model were unknown to us. The results of our analysis can be used in many ways. The first and obvious use is in re-configuring the system to eliminate the vulnerabilities identified by model-based analysis. The reconfigured system can be reanalyzed to ensure that (most) vulnerabilities have been eliminated. A second use is to feed the counter-examples generated by our analysis into an intrusion detection system. The intrusion detection system can now identify all attempts to exploit the vulnerabilities identified by our analysis, and may be able to prevent them from succeeding. A third way to use our analysis is to begin with minimal information about the initial state of the system, in which case our analysis generates assumptions about the initial system that lead to vulnerabilities. These assumptions correspond to the "vulnerability causes" that can be encoded into configuration checkers such as COPS and SATAN. The main challenge in using the approach presented in this paper is one of scale. Although our model checker can easily handle the models described in this paper, more realistic system models will be much larger, making it significantly harder to perform an accurate analysis. However, we believe this is a temporary difficulty: some of the authors of this paper, as well as a number of other researchers, are developing better and better model checkers that are able to handle larger and larger systems. A second challenge is the effort required for developing models. We are investigating source code analysis techniques that can help automate the model generation process. --R A Taxonomy of Security Faults Rule based analysis of security checking. Checking for Race Conditions in File Access. A critical analysis of vulnerability taxonomies Tabled evaluation with delaying for general logic programs Design and synthesis of synchronization skeletons using branching-time temporal logic Automatic verification of finite-state concurrent systems using temporal logic specifications Computer Aided Verification'96 State of the art and future directions An Optimizing Compiler for Efficient Model Checking The COPS Security Checker System The model checker SPIN The Temporal Logic of Reactive and Concurrent Systems: Specifi- cation Communication and Concurrency Specification and verification of concurrent systems in Cesar. XMC: A Logic-Programming-Based Verification Toolset Efficient model-checking using tabled resolution Using Model Checking to Analyze Network Vulnerabilities OLDT resolution with tabulation The XSB logic programming system v2. --TR Communicating sequential processes Automatic verification of finite-state concurrent systems using temporal logic specifications OLD resolution with tabulation The temporal logic of reactive and concurrent systems Tabled evaluation with delaying for general logic programs Formal methods The Model Checker SPIN Communication and Concurrency An Optimizing Compiler for Efficient Model Checking Specification and verification of concurrent systems in CESAR Efficient Model Checking Using Tabled Resolution Symbolic Model Checking Design and Synthesis of Synchronization Skeletons Using Branching-Time Temporal Logic Using Model Checking to Analyze Network Vulnerabilities RULE BASED ANALYSIS OF COMPUTER SECURITY --CTR Wei Li , Rayford B. Vaughn , Yoginder S. Dandass, An Approach to Model Network Exploitations Using Exploitation Graphs, Simulation, v.82 n.8, p.523-541, August 2006 Gordon Thomas Rohrmair , Gavin Lowe, Using data-independence in the analysis of intrusion detection systems, Theoretical Computer Science, v.340 n.1, p.82-101, 13 June 2005 Xinming Ou , Sudhakar Govindavajhala , Andrew W. Appel, MulVAL: a logic-based network security analyzer, Proceedings of the 14th conference on USENIX Security Symposium, p.8-8, July 31-August 05, 2005, Baltimore, MD Peng Ning , Dingbang Xu, Learning attack strategies from intrusion alerts, Proceedings of the 10th ACM conference on Computer and communications security, October 27-30, 2003, Washington D.C., USA Peng Ning , Dingbang Xu, Hypothesizing and reasoning about attacks missed by intrusion detection systems, ACM Transactions on Information and System Security (TISSEC), v.7 n.4, p.591-627, November 2004
model checking;automated verification;intrusion detection;computer security;vulnerability analysis
597944
Explicit Solutions for Variational Problems in the Quadrant.
We study a variational problem (VP) that is related to semimartingale reflecting Brownian motions (SRBMs). Specifically, this VP appears in the large deviations analysis of the stationary distribution of SRBMs in the d-dimensional orthant Rd+. When d&equals;2, we provide an explicit analytical solution to the VP. This solution gives an appealing characterization of the optimal path to a given point in the quadrant and also provides an explicit expression for the optimal value of the VP. For each boundary of the quadrant, we construct a cone of boundary influence, which determines the nature of optimal paths in different regions of the quadrant. In addition to providing a complete solution in the 2-dimensional case, our analysis provides several results which may be used in analyzing the VP in higher dimensions and more general state spaces.
Introduction Semimartingale reflecting Brownian motions (SRBMs) in the orthant have been proposed as approximate models of open queueing networks (see e.g, Harrison and Nguyen [16]). Such di#usion processes were first introduced in Harrison and Reiman [17]. Since then, there have been two primary lines of active research s related to SRBMs. One line has concentrated on proving limit theorems that justify the Brownian model approximations of queueing networks under heavy tra#c conditions. (For recent surveys, see Chen and Mandelbaum [7] and Williams [37].) The other focus has been to study the fundamental and analytical properties, including recurrence conditions, of SRBMs. (For a survey, see Williams [36].) The topic of this paper is related to the latter category. The focus of our paper is a variational problem (VP) which arises from the study of SRBMs. The rare event behavior of the stationary distributions of SRBMs can be analyzed with the help of a large deviations principle (LDP). When such a principle holds, the optimal value of the VP describes the tail behavior of the stationary distribution and the corresponding optimal paths characterize how certain rare events are most likely to occur. Below, we provide some motivation both for studying the stationary distributions of SRBMs and in particular for examining the rare event behavior. The stationary distribution of SRBMs has been a primary object of study because it provides estimates of congestion measures in corresponding queueing networks. Unfortunately, even these Brownian approximations are not immediately tractable. In fact, Harrison and Williams [18,19] showed that the stationary density function admits a separable, exponential density if and only if the covariance and reflection matrices satisfy a certain skew-symmetry condition. When this condition is not satisfied, one must generally resort to developing numerical algorithms to estimate the stationary distribution of the SRBM. One such algorithm has been devised by Dai and Harrison [8]. If one knows the tail behavior of the stationary distribution for the SRBMs, such algorithms can be made to be more e#cient. Furthermore, in a recent paper of Majewski [27] it was demonstrated that, roughly speaking, one may switch the heavy tra#c and large deviations limits in feed-forward networks, indicating that the rare event behavior of an SRBM can give insight into the rare event behavior of an associated heavily loaded queueing network. This provides ample motivation for studying the large deviations theory of SRBMs. The study of LDPs can be roughly divided into two primary topics: (i) proving that an LDP holds for a class of processes and (ii) analyzing the variational problem which arises from the LDP. Our study is concerned only with the second topic, but we provide some discussion of the first topic, both here and in the body of the paper, since there is a close relationship between the two. As noted above, the VPs studied in this paper are related to the stationary distribution of an SRBM. Thus, the LDP corresponds to SRBM on the entire time interval [0, #). When considering LDPs on a finite time interval, the large deviations principle is easier to establish. For example, when the reflection matrix is an M-matrix, as the one used in Harrison and Reiman [17], the SRBM can be defined through a reflection mapping which is Lipschitz continuous on [0, T ] for each T > 0. In this case, the LDP for the SRBM readily follows from the Contraction Principle of large deviations theory, as demonstrated in Dupuis and Ishii [12]. To investigate large deviations theory for the stationary distribution of an SRBM, we must consider SRBMs on the interval [0, #), which complicates matters considerably. However, LDP for SRBMs of this type have been established in special cases. In particular, Majewski has established such an LDP for a stationary SRBM when the reflection matrix R is an M-matrix [28] and when the reflection matrix has a special structure arising from feed-forward queueing networks [26]. For a general stationary SRBM, establishing an LDP remains an open problem (see Conjecture 4.1), even in two dimensions. The major thrust of this paper is to investigate the VP which arises for the aforementioned LDPs. Our analysis provides a complete, explicit solution to the VP when the state space is the 2-dimensional orthant R 2 . In particular, we characterize the optimal paths to a given point v # R 2 . It turns out that the optimal path to v is influenced by a boundary if v is contained within a cone associated with that boundary. We identify precisely each of these "cones of boundary influence." When v is not in either of the cones, the optimal path is a direct, linear path. When v is contained in one of these cones, however, the optimal path first travels along a boundary, and then travels directly to v. Furthermore, such a path leaves the boundary and enters the interior at a unique entrance angle which can be determined directly from the problem data. For VPs which arise from a large deviations analysis of random walks in the quadrant, Ignatyuk, Malyshev, and Scherbakov [21] demonstrated that similar behavior is manifested in the optimal paths. Specifically, they are able to identify analogous regions of boundary influence in the solutions to such VPs. Another work closely related to our study is Majewski [28]. In this paper, Majewski examines a general class VPs in high dimensions and among other things, provides a general purpose numerical algorithm to solve these VPs. Our work complements his numerical work for the 2-dimensional case. Also, a crucial assumption in implementing such numerical algorithms is that the optimal path consists of a finite number of linear pieces. An intermediate result in our paper s shows that an optimal path, in two dimensions, consists of at most two linear pieces. It seems clear from the literature (see, e.g. Atar and Dupuis [1]) that explicitly characterizing the solution to VPs which arise from queueing networks or other systems is significantly harder in three dimensions or higher versus the 2-dimensional case. Although this paper primarily focuses on the 2-dimensional problem in R 2 should be noted that several of our results indeed hold in higher dimensions and for general polygonal state spaces. In addition to this more direct connection to higher dimensional problems, we hope that the problem framework which we establish in the SRBM setting will provide motivation for further research into the interesting and challenging open problems beyond the 2-dimensional case. There is a large body of literature on LDPs for random walks and queueing networks. The book [33] by Shwartz and Weiss contains an excellent list of references. We can only provide a short survey of the latest works which are most closely related to our study. Recent work on LDPs for queueing networks include O'Connell [30,31] and Dupuis and Ramanan [13] on multi-bu#er single-server systems, Bertsimas, Paschalidis and Tsitsiklis [4] on acyclic networks, Kie#er [22] on 2-station networks with feedback, and Dupuis and Ellis [10] and Atar and Dupuis [1] on general queueing networks with feedback. The works by Ignatyuk, Malyshev and Scherbakov [21] and by Borovkov and Mogulskii [5] investigate random walks that are constrained to an orthant. Knessl and Tier [24,23,25] used a perturbation approach to study rate functions for some queueing systems. We now provide a brief outline of the paper. In Section 2, we introduce the Skorohod problem and the VP. The main result of this paper (Theorem 3.1) is stated in Section 3. In Section 4 we introduce semimartingale reflecting Brownian motions and the large deviations principle that connects the VP with the SRBM. We examine the VP in depth in Section 5 and characterize the optimal escape paths in Section 6. Finally, we provide some examples in Section 7. 2. The Skorohod and Variational Problems Let d # 1 be an integer. Throughout this paper, # is a constant vector in R d , # is a d - d symmetric and strictly positive definite matrix, and R is a d - d matrix. In this section, we first define the Skorohod problem associated with the matrix R, and then define the variational problem (VP) associated with (#, R). 2.1. The Skorohod Problem Let C([0, #),R d ) be the set of continuous functions x R d . A function x # C([0, #),R d ) is called a path and is sometimes denoted by x(-). The space C([0, #),R d ) is endowed with a topology in which convergence means uniform convergence in each finite interval. We now define the Skorohod problem associated with R and state space R d (sometimes called an R-regulation). Note that all vector inequalities should be interpreted componentwise and all vectors are assumed to be column vectors. Definition 2.1 (The Skorohod Problem) Let x be a path. An R-regulation of x is a pair of paths (z, y) # C([0, #),R d ) - C([0, #),R d ) such that y(-) is non-decreasing, When the R-regulation (y, z) of x is unique for each x # C([0, #),R d ), the mapping is called the reflection mapping from C([0, #),R d ) to C([0, #),R d When the R-regulation of x is not unique, we use #(x) to denote the set of all z which are components of an R-regulation (y, z) of x. When the triple (x, y, z) is used, it is implicitly assumed that (y, z) is an R-regulation of x. Bernard and El Kharroubi [3] proved that there exists an R-regulation for every x with only if R is completely-S as defined in Definition 2.2 below. For a d-d matrix R and a subset D # {1, . , d}, the principal submatrix associated with D is the |D| - |D| matrix obtained from R by deleting the rows and columns that are not in D, where |D| is the cardinality of D. Definition 2.2 A d-d matrix R is said to be an S-matrix if there exists a u # 0 such that Ru > 0. The matrix R is completely-S if each principal submatrix of R is an S-matrix. 2.2. The Variational Problem In this section we introduce the variational problem (VP) of interest to us. This problem arises in the study of large deviations for semimartingale reflecting Brownian motions (SRBMs) to be defined in Section 4, and we will make this connection in Section 4.2. Recall that #(x) maps x to one unique path, if the corresponding Skorohod problem has a unique solution. If the Skorohod problem is non-unique, then #(x) represents a set of paths corresponding to x. Now, in order to establish a general framework for posing VPs, we wish to include cases for which the Skorohod problem is not unique. For T > 0 and v # R d , we will adopt the following convention. We will take to signify that there exists a z #(x) such that z(T v. Next, for vectors v # R d and w # R d we define the inner product with the associated norm We are now prepared to present the VP that will be the main focus of this paper. Definition 2.3 (The Variational Problem - VP) x#H d ,#(x)(T )=v2 # T|| - where H d is the space of all absolutely continuous functions x(-) which have square integrable derivatives on bounded intervals and have Definition 2.4 Let v # R d . If a given triple of paths (x, y, z) is such that the triple satisfies the Skorohod problem, z(T then we will call (x, y, z) an optimal triple, for VP (2.5), with optimal value I(v). The function x is called an optimal path if it is the first member of an optimal triple and z is called an optimal reflected path if it is the last member of an optimal triple. Such a triple (x, y, z) is also sometimes referred to as a solution to the VP (2.5). 3. 2-Dimensional Results In this section, we state our main theorem, which gives an explicit solution to the VP in terms of the problem data, (#, R), for the 2-dimensional case. We introduce much of the notation in this section, but defer the proof until Section 6. The proof relies on three components: 1. A reduction of the search for optimal paths to the space of piecewise linear functions with at most two segments. 2. An analysis of "locally" optimal paths with a given structure. 3. A quantitative comparison of the VP value for the various types of locally optimal paths to determine the globally optimal path. It turns out that the solution to the VP in two dimensions can be stated in an appealing way by defining "cones of boundary influence." Both this solution and the proof method yield insights into higher dimensional VPs. For the majority of this section, we restrict ourselves to the case 2. We will use the term face F i , to denote one of the axes in R 2 We retain the term face because in later sections we will consider faces of the orthant in higher dimensions. To state our main theorem, we need to define the cone C i associated with a face F i , 2. For a face F i , each cone C i defines a region of boundary influence on the solutions to the VP. It turns out that the boundary influence depends on two quantities which we will term the "exit velocity" and the "entrance velocity," which will lead to the concept of "reflectivity" of a face. We define and discuss the relationship between these terms presently. Let p i be a vector that is orthogonal (under the usual Euclidean inner product) to the ith column of the reflection matrix R, and is normalized with 1. For example, if will be a multiple of (-r 1 , 1) # and p 2 will be a multiple of (1, -r 2 ) # . s Definition 3.1 The exit velocity a i associated with face F i is defined to be a We defer the explanation of this term until later in the section. Definition 3.2 Face F i is said to be reflective if the ith component of a i is negative, i.e., a i When F i is not reflective, C i is defined to be empty. In this case, the face F i has no boundary influence on solutions to the VP for any v # R 2 . When F i is reflective, the characterization of the cone C i is more involved. We need to define a key notion, the "entrance velocity" associated with face F i . It is defined to be the "symmetry" of a i around face F i . To make this concept precise, let e i be a directional vector on face F i , and n i be a vector that is normal to F i , pointing to the interior of the state space. We assume that e i and n i are normalized so that ||e i 1. For example, when have . One can check that #e i , #n i Thus, e i and #n i form an orthonormal basis in R 2 under the inner product #. Therefore, any vector v # R 2 has the following (unique) representation Thus, a One can then define a symmetry - a i of a i around face F i to be Definition 3.3 We call the symmetry - a i the entrance velocity associated with a face F i . One can easily check from the definition that - a i thus F i is reflective if and only if - a i When F i is reflective, C i is defined to be the cone generated by e i and - a i , namely, It is possible that - a i points to the outside of R 2 , even if F i is reflective. In this case, . The cone C i identifies precisely the region in which the face F i has boundary influence. With two cones, C 1 and C 2 , defined, we can partition the state space into three regions: (R 2 and one of the two regions, that one of the latter two regions is always empty, namely, either R 2 Before we state the main theorem of this paper, we introduce some additional notation and terminology. For a v # R 2 a (||#||/||v||)v. The next two expressions will appear in the locally optimal value of the VP for various cases. For v # R 2 I I 2. (3.7) Now we wish to define three triples, which start at the origin and terminate at v. In will turn out that one or more of these triples will be a solution to the VP. The first triple, direct triple to v, with x 0 , the corresponding reflected path z an R-regulation of x for any R. One can more generally define a direct triple from w to v. The next two triples, are broken triples through the corresponding face. For a face F 1 , we introduce a broken triple from the origin to v through face F 1 , which consists of two segments. Each segment of x 1 is linear, and hence we can chose linear y 1 and z 1 , within each segment. In the first segment, x 1 has a velocity a 1 such that z 1 stays on the boundary F 1 . The segment ends when z 1 reaches uniquely determined by the condition that v - v 1 is parallel to - a 1 . The second segment is simply the direct triple traveling in the interior of the state space from v 1 to v, with velocity of x 1 and z 1 being equal to - a 1 . A broken triple through F 2 is defined similarly. Note that in order for such a broken triple to be well-defined, we must have (i) that F 1 is reflective and (ii) that v # C 1 (see Figure 1). In such a case, a 1 is the velocity at which x exits the state space, and - a 1 is the velocity of x when z enters a 1 Figure 1. An optimal broken path to v # C1 through F1 the interior of the state space. The terms exit velocity and entrance velocity are introduced primarily to define these broken triples, although the interpretations above are not always meaningful when a face is non-reflective. Now we are prepared to state our main theorem, which completely characterizes the solutions to the VP presented in the previous section, for the 2- dimensional case. Theorem 3.1. Consider the VP as defined in (2.5) with associated data (#, R), with R taking the form in (3.1). Let v # R 2 and suppose that R is completely-S and that the data satisfies the conditions where, for an a # R, a (a) If v # C 1 # C 2 , the optimal value is given by I 0 (v) and the direct triple (b) If v # C 1 \ C 2 , the optimal value is given by I 1 (v) and the broken triple (c) If v # C 2 \ C 1 , the optimal value is given by I 2 (v) and the broken triple (d) If v # C 1 # C 2 , the optimal value is given by min{I 1 (v), I 2 (v)}. When I 1 (v) # I 2 (v), the broken triple the broken triple Conditions (3.8) and (3.9) are the so-called "recurrence conditions" for the corresponding SRBM (see Section 4.1 for more discussion). The proof of Theorem 3.1 is deferred until Section 6. Several preliminary results needed in the proof, but which are also applicable in higher dimensional problems, are given in Section 5. For (v) is a linear function of v, whereas I 0 (v) is not since - a 0 (v) depends on v. In fact, in Lemma 6.1 we will check that I 0 Also it will be verified in Theorems 6.1 and 6.3 that, for I i (v) =2 # T|| - where T is the first time for z i to reach v, and we let C . More interestingly, we observe that the optimal value I i (v), depends on the velocity of the "last segment" of z i , which is always given by - a i . In R d with d # 3, it is possible to have more complicated types of optimal paths. We would now like to outline three principles which are valid for locally optimal paths in higher dimensions. We do not demonstrate the validity of these propositions in this tract, rather leaving this for a subsequent paper. i. Orthogonality law. If a locally optimal triple (x, y, z) is such that z traverses a face F , x must have a velocity of the form: a = #p while z is on F . In the general setting, p is a vector orthogonal (under the Euclidean inner product) to all the reflection vectors of the face. ii. Norm preservation law. For a broken triple (x, y, z), which in general may travel along several faces, the norm of the intermediate velocity of x must be equal to the norm of the drift #. iii. Symmetry law. For a broken triple (x, y, z) along F , the di#erence of the velocity of x before and after leaving F must be orthogonal to F with respect to the inner product induced by the covariance matrix. With these general principles in hand, it is possible to compute locally optimal broken paths of any chosen type (i.e. any prescribed order of traversing the faces). One can then compare the values of each such "locally optimal" path to discover the globally optimal path for a given point. This essentially reduces the resolution of the VP to a numerical task. Unfortunately, to be sure that this numerical task will indeed yield the optimal value for the general VP, one must establish a principle as outlined in Step 1 at the beginning of Section 3. Such a principle has been established for R 2 (see Theorem 5.1), but is lacking for more general state spaces. 4. Semimartingale Reflecting Brownian Motions and Large Deviations In this section, we define semimartingale reflecting Brownian motions (SRBMs). Such processes arise in the study of heavy tra#c approximations to multiclass queueing networks (see, e.g., Harrison and Nguyen [16]). We also discuss conditions under which an SRBM is positive recurrence. Finally, we introduce large deviations principles (LDPs) for an SRBM. The LDPs connect the VP introduced in (2.5) with a corresponding set of SRBMs and provide the motivation for our study of such VPs. 4.1. SRBM Throughout this section, B denotes the #-algebra of Borel subsets of R d . Recall that # is a constant vector in R d , # is a d-d symmetric and strictly positive definite matrix, and R is a d - d matrix. We shall define an SRBM associated with the data (R d R). For this note, a will be called a filtered space if# is a set, F is a #-field of subsets of # and {F t } # {F t , t # 0} is an increasing family of sub-fields of F , i.e., a filtration. If, in addition, P is a probability measure will be called a filtered probability space. Definition 4.1 (SRBM) Given a probability measure # on (R d reflecting Brownian motion (abbreviated as SRBM) associated with the data (R d #) is an {F t }-adapted, d-dimensional process Z defined on some filtered probability continuous paths and Z(t) # R d (a) X is a d-dimensional Brownian motion with drift vector #, covariance matrix # and X(0) has distribution #, (b) {X(t) -X(0) - #t, F t , t # 0} is a martingale, (iv) Y is an {F t }-adapted, d-dimensional process such that P # -a.s. for each (b) Y j is continuous and non-decreasing, (c) Y j can increase only when Z is on the face F j # {x # R d An SRBM associated with the data (R d is an {F t }-adapted, d-dimensional process Z together with a family of probability measures {P x , x # R d } defined on some filtered }) such that, for each x # R d (i)-(iv) hold with being the point distribution at x. A (R d #)-SRBM Z has a fixed initial distribution #, whereas a (R d #, R)-SRBM has no fixed start point. The latter fits naturally within a Markovian process framework. Condition (iv.c) is equivalent to the condition that, for each t > 0, Z Loosely speaking, an SRBM behaves like a Brownian motion with drift vector # and covariance matrix # in the interior of the orthant R d , and it is confined to the orthant by instantaneous "reflection" (or "pushing") at the boundary, where the direction of "reflection" on the jth face F j is given by the jth column of R. The parameters # and R are called the drift vector, covariance matrix and reflection matrix of the SRBM, respectively. Reiman and Williams [32] showed that a necessary condition for a (R d to exist is that the reflection matrix R is completely-S, as defined in Definition 2.2. Taylor and Williams [34] showed that when R is completely-S, for any probability measure # on (R d (R d Z exists and is unique in distribution. Let # be a probability measure on (R d B). The measure # is a stationary distribution for an SRBM Z if for each A # B, When # is a stationary distribution, the process Z is stationary under the probability measure P # . Harrison and Williams [18] showed that a stationary dis- tribution, when it exists, is unique and is absolutely continuous with respect to the Lebesgue measure on (R d use # to denote the unique stationary distribution when it exists. When # exists, the SRBM Z is said to be positive recurrent. For a (R d R is an M-matrix as defined in Bermon and Plemmons [2], it was proved in [18] that Z is positive recurrent if and only if In the 2-dimensional case, we have a characterization of positive recurrence given by Hobson and Rogers [20] and Williams [35], who have shown that a (R 2 in the quadrant is positive recurrent if and only if (3.8) and hold. The following theorem by Dupuis and Williams [14] provides a su#cient condition to check the positive recurrence of an SRBM. Let R and # be given. For a # R d set x a Theorem 4.1 (Dupuis and Williams). Suppose that for each a # R d and each z #(x a ), lim t# the (R d positive recurrent for each positive definite matrix #. Using Theorem 4.1, Budhiraja and Dupuis [6] provided a slight generalization of the result of Harrison and Williams. For SRBMs in the orthant, no general recurrence condition has yet been established. 4.2. Large Deviations In this section, we provide some motivation for our study of the VPs introduced in (2.5). The primary impetus for our study comes from the theory of large deviations. An excellent reference for this material is Dembo and Zeitouni [9]. Most large deviations analyses can be divided into two principal parts: proving an LDP, and solving the associated VP. For SRBMs in the orthant, considerable progress has been made in the first area by Majewski [28] and we quote his result shortly. The following conjecture, for SRBMs in the d-dimensional orthant, provides motivation for our VP. Conjecture 4.1 (General Large Deviations Principle). Consider a (R d SRBM Z. Suppose that R is a completely-S matrix and that there exists a probability measure P # under which Z is stationary. Then for every measurable A # R d lim sup log d lim inf log where A c and A are respectively the closure and interior of A. Our goal in the next section is to provide some results which simplify the analysis and solution of the VPs which appear in Conjecture 4.1. In Section 6, we narrow our focus to the 2-dimensional case. For this class of VPs, we are able to provide a complete analytical solution. Special cases of Conjecture 4.1 above have indeed already been established. The most general result of which we are aware was given by Majewski [28]: Theorem 4.1 (Large Deviations Principle). Consider a (R d where R is an M-matrix and suppose the recurrence condition (4.2) holds. Let # be the probability measure under which Z is stationary. For every measurable A # R d For clarification, it should be noted that Majewski states his result for reflection matrices R which he terms K-matrices. This class of matrices is equivalent in our context to what we have chosen to call M-matrices, following Bermon and Plemmons [2]. In this case, the Skorohod problem has a unique solution and the reflection mapping is Lipschitz continuous. 5. Optimal Path Properties The variational problem in (2.5) requires a search over a large class of absolutely continuous functions. In this section, we argue that, in R 2 , the optimal reflected path can be chosen such that it consists of at most two linear pieces, the first of which travels along one of the boundaries of the positive orthant and another which then traverses the interior. The main result of this section is the following theorem, which will be used to prove Theorem 3.1. Theorem 5.1. Consider the VP as given in (2.5) and let v # R 2 . An optimal triple (x, y, z) from 0 to v can always be chosen so that (x, y, z) is a two-segment, piecewise linear path; during the first segment, z stays on one of boundaries of , terminating at a point w on the boundary; during the other segment, z is a s direct, linear path from w to v. The first segment can be void, that is we may have In this case, x, and hence z, is a direct, linear path from 0 to v. When the reflection matrix is an M-matrix, this result can also be inferred from Majewski [29], using Lemma 14 of Majewski [28], and Lemma 5.2 below. We provide a direct proof in this section, which is based on a series of lemmas that are of independent interest in R d with arbitrary d # 1. Our first lemma follows directly from Jensen's inequality. Recall that H d is the space of all absolutely continuous functions x(-) : [0, # R d which have square integrable derivatives on bounded intervals and have Lemma 5.1. Let g be a convex function on R d , and let x # H d . Then for dt. (5.1) In other words, a linear path minimizes this unconstrained variational problem. For our VP, the g(v) we contend with is of the form: We now consider the boundary of R d . Note that each face of the boundary can be defined by partitioning the coordinates of R d into zero and non-zero com- ponents. For a partition (K 1 , K 2 ) of {1, . , d}, we then define a face associated with the partition by letting the coordinates in K 1 be zero and the coordinates of K 2 be non-zero. Note that, for our purposes, the interior of R d is also considered a face, corresponding to K Below, for a partition (K 1 , K 2 ) we also let xK j be the vector . For the reflection matrix R, we define two submatrices: R 1 is the principal submatrix of R with the rows and columns in K 2 deleted, R 21 is the submatrix of R with row indices in K 2 and column indices in K 1 . Definition 5.1 We say that a reflected path z is anchored to a face corresponding to the partition (K 1 , K 2 ) in the interval finitely many t # (t 1 , t 2 ). Lemma 5.2. Consider the VP as given in (2.5) and let (x, y, z) be an optimal triple for this VP. If z is anchored to a face of the boundary of R d in the interval there exists an optimal triple (-x, - y, - z) such that and - z Proof. For completeness, we now explicitly write out the variational problem under consideration. For a given v 1 consider the minimization problem: ds (5.2) subject to y(-) is non-decreasing, We consider an optimal triple (x, y, z), with z anchored to a face corresponding to some partition (K 1 , K 2 ). Without loss of generality, we assume that y(t 1 for each optimal triple (x, y, z). Thus, z(t 1 By the complementarity condition, - with our convention that y(t 1 Therefore, we have and it follows that By condition (iii) of Definition 5.1, s and we then have which implies In other words we can "linearize" the paths x and y as follows: and then (5.3) and (5.4) show that the new reflected path - z is anchored to the same face as z on the interval (t 1 , t 2 ). In fact, - z is now on the face for the entire interval. Furthermore, it can be checked that - hence the new reflected path also has the same endpoints. By Lemma 5.1 #dt. Thus, - x has equal or lower energy than the original path and hence any optimal path can be reduced to an equivalent optimal path which has a constant derivative while its reflection is on a fixed face of the boundary. The reduction of the VP to a class of piecewise linear functions is not particularly surprising. Other authors, including O'Connell [31] and Dupuis and Ishii [11] have achieved similar reductions, but only for special cases, i.e. in R 2 or for a limited class of reflection matrices. Since Lemma 5.1 holds for any convex function and in large deviations applications, the kernel which appears in the VP is always convex (for LDPs associated with random vectors), our proof is valid for VPs arising from a wide range of LDPs. We have not specifically addressed the nature of the piecewise linear functions which may solve the VP. In particu- lar, we have not ruled out a piecewise linear function with an infinite number of discontinuities in - x. With the help of the next several lemmas, we can rule out such paths, at least in R 2 . Lemma 5.3 (Scaling Lemma). Consider the VP in R d as given in (2.5), with target point v in the positive orthant. (a) For any positive k, (b) If (x, y, z) is an optimal triple for v, then (-x, - y, - z) is an optimal triple for kv, Proof. Let (x, y, z) be an optimal triple which solves the Skorohod problem with It is clear that (-x, - y, - z) also solves the Skorohod problem with - thermore, we Hence I(kv) # kI(v). Now since, k > 0 is arbitrary, we have I(kv). Thus, we have This proves (a) and the above calculation proves (b). A similar scaling lemma for variational problems arising from random walks in an orthant is stated in Ignatyuk et. al. [21]. Lemma 5.4 (Merge Lemma). Let be an R-regulation triple on [0, t 1 with z 1 be an R-regulation triple on [s 2 , with z 2 Suppose that both x 1 and x 2 are absolutely continuous. Define s and y, z) is an R-regulation triple on [0, s] with and such that x is absolutely continuous on [0, s] and2 # s|| - Proof. Since both x 1 and x 2 are absolutely continuous, x is absolutely continuous on [0, s]. Also one can check that y is non-decreasing, We now check that Clearly, (5.6) is satisfied for is an R-regulation with Thus, (5.6) holds for s, from which one can readily show that (x, y, z) is an R-regulation on [0, s]. Finally, (5.5) follows from the definition of x. In the following, we use E i to denote the one-dimensional edge {v # R d Lemma 5.5 (Reduction Lemma). Consider the VP in R d as given in (2.5). Let Suppose that is an optimal triple from 0 to v such that there exists an optimal triple (x, y, z) on [0, T ] from 0 to v such that z(t) # E i for with Proof. We start by assuming that z 1 be an optimal triple with z 1 Next, by the Scaling Lemma 5.3 we have k # 1 and by assumption k #= 1, thus k < 1. Since it follows from Lemma 5.3 that the triple (-x, - y, - z) is an optimal triple from 0 to w, where - By Lemma 5.4, piecing together the triple (-x, - y, - z) on [0, kt 1 ] with the triple we have the triple Furthermore, by (5.5), the triple is optimal, and z 2 (t) ks 1 . We now iterate our argument, with a new scaling parameter in each iteration, . Then we have for each integer n # 1, there exists an optimal triple k < 1, we have that k n # 0 and hence s n and |z n (s n )| both converge to zero. By construction, it can be seen that z on (s n , t n ) for all n, where each c i # R d is a constant independent of n. Thus Now we are prepared to construct an optimal triple with the stated prop- erties. We set (x, y, t, c 3 t) on [0, T ]. By (5.7) we have that y, z) - (x, y, z)(s 1 ) is an R-regulation on [s 1 , t 1 ] and then by Lemma 5.4, y, z) is an R-regulation on [0, t 1 - s 1 ]. From the linearity of the Skorohod problem it is therefore also an R-regulation on [0, T ]. Note that, by construction, we also have z(T It remains only to show that (x, y, z) is optimal. Note that each triple must have optimal cost. Hence, if we show that lim then we are done. By repeated application of the Scaling Lemma 5.3, (5.5), and (5.7), we sn s the first part converges to zero. Since t n # T and s n # 0, the second part, and thus the entire cost, converges to (T/2)||c 1 - #|| 2 , which is just the cost of the constructed triple (x, y, z). Hence (x, y, z) is an optimal triple. apply the Scaling Lemma 5.3 with this k 0 . We are then back in the case z 1 can proceed as before. Now, using the Reduction Lemma 5.5, we can prove the main theorem of this section, which states that in R 2 , an optimal reflected path can be chosen such that it consists of at most two linear pieces. Proof of Theorem 5.1. Throughout the proof we assume that v # R 2 and that all paths are piecewise linear as per Lemma 5.2. We divide our argument into three cases. (1) Let v be in the interior of R 2 and let (x, y, z) be an optimal triple to v. Then z either goes directly from the origin to v or else z reaches some point us assume that t 2 is the last such time. By Lemma 5.2, z must touch another point on hence the triple can be chosen so that z(t) # E then by Lemma 5.5 there exists an optimal triple (-x, - y, - z) from 0 to w with - for two-segment triple, formed by merging (-x, - y, - z) and (x, y, z), is optimal. (2) Suppose v is on a face E 1 of R 2 . Let (x, y, z) be an optimal triple with another point on E 1 \ {0}, then by Lemma 5.5 the triple can be chosen such that it is linear. Otherwise, by Lemma 5.2, z has to touch a (last) point w and stay on E 2 in some time interval. Again by Lemma 5.2, the triple must be linear from w to v. Furthermore, by Lemma 5.5, the triple can be chosen to be linear from 0 to w. Hence, in this case, we can again chose an optimal triple with two linear segments. then we interchange the roles of E 1 and E 2 in the case 2 argument. We have thus shown that for any optimal triple, we can choose an equivalent optimal triple that falls into one of the cases in the statement of Theorem 5.1. A major open problem is to determine whether or not Theorem 5.1 can be extended to the case d > 2. The problem in higher dimensions is to eliminate consideration of paths which "spiral" around the boundary. In R 2 , spiraling cannot occur (without retracing part of a path) and hence the reduction to a piecewise linear path with just two pieces is relatively straightforward. One hopes that in R d that one need only consider piecewise linear paths with d pieces, thus reducing the general VP to a finite dimensional optimization problem. In the case reduced our possible solutions to paths which either go directly from the origin to v through the interior or first travel along one axis and then travel through the interior to v. In particular, we need only search over three types of piecewise paths. In the next section, we will argue that this search can be restricted to just three paths. 6. Further Constrained Variational Problems In this section we provide the analysis of the VP in R 2 which justifies Theorem 3.1. We first consider the VP defined in (2.5), adding additional constraints on the allowed path x(-). Recall that the definitions of the direct triple and the broken triples were given in Section 3. When we restrict x(-) such that it only takes values in R 2 , the corresponding VP has the direct triple as an optimal triple. We next consider "broken" triples in which the reflected path first moves along a face F i and then traverses the inte- rior. When F i is reflective, and v # C i , the broken triple is an optimal triple among all two segment broken triples through F i . Once these principles have been established, the proof of Theorem 3.1 will then follow directly. Before studying these further constrained VPs, we present the following lemma. Lemma 6.1. Let I 0 (v), I 1 (v), and I 2 (v) be given in (3.6) and (3.7). Then, (a) I 0 (b) I i (v) # I 0 (v) for v # R 2 2. Furthermore, I i only if v is in the same direction as - a i . Proof. Part (a). From the definition of I 0 (v) in Section 3, we have I s Part (b). First, note that it follows from (3.2) that #. Hence, ||a i ||#||. Furthermore, from the definition of - a i , we can immediately observe that ||-a i ||, and thus we have Using then (3.6) and (3.7), we conclude I 6.1. Interior Escape Paths Now let us consider a point v # R 2 and the VP as defined in (2.5). In this section, we add the additional constraint that x(-) may only take values in R 2 We will use - I 0 (v) to denote the resulting optimal value, namely, I x#H d ,x(T )=v2 # T|| - for For the VP (2.5), if we only consider paths which travel in the interior of the orthant, then by Theorem 5.2 the optimal path is linear and has constant velocity proportional to the point v that we wish to reach. Hence, we need only determine the optimal speed to minimize the value of the VP. So we set ct v and the VP in (6.2) reduces to the following: I This is a one-dimensional minimization problem which has a unique minimum at leading us to the following result. Theorem 6.1. Among the possible direct triples from the origin to a fixed point v, the direct triple optimal. The corresponding minimal cost - I 0 (v) is I 0 (v). 6.2. Single Segment Boundary Escapes We now consider optimal reflected paths which travel along face F i to reach a point along this face. For v # F i , we use - I i (v) to denote the resulting optimal value, namely, I x#H d ,z(T )=v2 # T|| - where z(-) is a reflected path associated with x(-), and z(t) # F i for Theorem 6.2. Let v # F i . (a) If boundary F i is reflective, then the broken triple is optimal for (6.4) with - I (b) If boundary F i is not reflective, then the direct triple optimal for (6.4) with - I To prove the theorem we will need the following elementary lemma from calculus. Lemma 6.2. Let f(v) and g(v) be two di#erentiable functions on R d . Let f(v)/g(v) be defined for v # R d with g(v) #= 0. Then, for any v satisfying there exists a constant k such that Proof of Theorem 6.2. We prove the theorem for . In this proof, we let the normalization of Section 3. In light of Theorem 5.2, the search of an optimal boundary path can be confined to linear paths be an R-regulation associated with x(-) that satisfies z(t) # F 1 for t # 0. Then we have, Since it is always cheaper to take a z(-) such that z 2 (t) > 0 for we have y 2 have s must be positive and we also must have that I Using Lemma 6.2, it can be checked that each critical point b of the unconstrained form of (6.7) must satisfy From (6.8), b - substituting k#p 1 into the left side of (6.9), we have Thus, the unconstrained form of (6.7) has two critical points with Next, we show that the first critical point corresponding to not feasible. This is true because, in this case the regulated speed, - z 2 (t), along F 1 would then be given by # a detailed calculation, is negative under our stability condition (3.9). The second critical point corresponds to our expression for a 1 given in (3.2). One can check that (a 1 by (3.9), is positive. Note that when |b| #, away from the boundary, the function in (6.7) goes to infinity; when b approaches the boundary b # 0, from the interior of the feasible region, the function in (6.7) goes to infinity. Therefore, the infimum in (6.7) takes place either at a critical point in the interior or at b If F 1 is not reflective, then by definition, we have a 1 In this case, then there are no critical points in the interior of the feasible region and the minimum must occur at the constraint b which indicates that the direct path along F 1 is optimal and we have - I If F 1 is reflective, then a 1 1 < 0, and this quantity is a critical point which is in the interior of the feasible region. The value of the VP (6.4) at the critical point a 1 and we have where the first equality follows from (6.8) and the second from the definition of - a 1 . Since I 1 (v) # I 0 (v), as demonstrated in Lemma 6.1, we then have - I and the theorem is proved. The theorem demonstrates that if a face is reflective, then a regulated boundary path may be part of an optimal path to a point in the face. In the stochastic setting, we envision such paths as "bouncing paths" which repeatedly bounce against a face and are heavily regulated to keep them within the quadrant. Furthermore, it should be noted that the stability conditions (3.8) and (3.9) for SRBM in R 2 are required for our solution to be valid. In particular the conditions are used in the proof to eliminate a critical point. If one of the stability conditions does not hold, then the VP will have optimal value zero for any points along some ray in R 2 . This means that the VPs given in (4.3)-(4.4), will have value zero for many sets of interest. This result should be expected, since a stationary distribution for the SRBM will not exist in cases where the stability conditions do not hold, hence the LDP of Section 4.2 does not hold. It is a subject of ongoing research to determine explicit stability conditions in higher dimensions and analyze their relation to the corresponding VP. It is possible that heretofore unknown stability conditions will manifest themselves in solving the VP in higher dimensions. 6.3. Two Segment Boundary Escapes Recall that, for a point v # R 2 , a broken triple (x, y, z) to v through face F i consists of two segments: during the first segment, z travels from the origin along F i up to a point w # F i , and during the second segment, z is a non-regulated path traveling from w to v. When 0, the broken triple is actually a direct triple. In this section, we consider the VP (2.5) when constrained to all broken triples through a face. For a point v # R 2 , our goal is to determine an optimal broken triple among all such triples. The corresponding optimal value is denoted by - I i (v). The optimal broken triple is an extension of the optimal single segment triple previously considered for a point v on a boundary face. Thus we employ the same symbol - I i (-) to denote the optimal value. s Theorem 6.3. Let v # R 2 . (a) If v # C i , then is an optimal broken triple to v through F i . The optimal broken path z i has unique breakpoint w # F i with v - #. Furthermore, the optimal cost - I i (v) is given by I i (v). (b) If v # C i , then the direct triple among all broken triples to v through F i with - I Proof. When F i is not reflective, by part (b) of Theorem 6.2, Lemma 5.2 and Theorem 6.1, the direct triple among all broken triples. Now we assume that F i is reflective. The optimal total cost for a broken path through F i to v with a breakpoint at I(t, I I 0 (v - w). It follows from Theorems 6.1 and 6.2 that I(t, Note that - I(t, v) # tI i (e i ), which goes to infinity as t #. Hence, the minimum of the function - I(-, v) must either occur at a critical point in (0, #) or at the boundary to minimize this function with respect to t, for t > 0, we take derivatives to obtain: #t I(t, Setting this equal to zero and rearranging yields: . (6.11) by (6.1), the breakpoint must satisfy Thus, v-w must be in the same direction of a i or - a i . The first case is not possible for a reflective face F i . Thus, for some c > 0. To prove part (a), we note that when C i is nonempty, F i is reflective. In this case, one can check that the critical point exists and is unique. To find c, we use the expansion (3.3) on v, (3.4), and the fact that to obtain or #. With breakpoint w, by (6.10) the total cost is # . Note that, again using (6.1) Therefore, we have I(0, v), as demonstrated in Section 3, we have - I and part (a) is proved. When v # C i and F i is reflective, then no such critical point exists. Hence, in this case, the optimum occurs at the boundary point i.e. the optimal triple to v through F i is simply a direct triple, with corresponding cost - I (v). If face F i is not reflective, then the optimal triple to v through F i is also a direct triple, as discussed at the beginning of the proof. This establishes part (b), and hence Theorem 6.3. 6.4. Proof of Theorem 3.1 Now we prove the main theorem of the paper. By Theorem 5.1 we may conclude that any optimal triple can be reduced to an equivalent direct triple or broken triple through one of the faces. Now, let v # R 2 . The remainder of the theorem follows directly from the results we have established in this section. We briefly outline the connection for each case of Theorem 3.1: (a) The fact that the optimal value is I 0 (v) follows directly from part (b) of Theorem 6.3. (b) The result follows from Theorem 6.3, parts (a) and (b), and Lemma 6.1, part (b). (c) Analogous to (b) above. (d) In this case the result follows from part (a) of Theorem 6.3 and Lemma 6.1, part (b). In each case, there is a broken or direct triple which attains the corresponding minimum value. 7. Examples In this section we apply the main theorem of the paper in some illustrative examples. In addition to illuminating the results, we expect that this section will provide a connection to previous results obtained for the stationary distribution of SRBMs. 7.1. An SRBM from a Tandem Network We next provide an example of the solution to the VP for SRBM data arising from di#usion approximations of 2-station tandem queueing networks (Har- rison [15]). We consider a (R 2 with the following data. We let # . It is easy to verify that R is an M-matrix, which implies that the corresponding reflection mapping, and hence the associated SRBM, is well defined. In this case, the recurrence conditions are given by (4.2), which reduce to # 1 < 0 From (3.2) and (3.4), some simple calculations yield: # . Furthermore, we will have I I 1 (v) =-# 1 (v 1 Figure 2. An optimal broken path to v # C1 and an optimal direct path to w # R 2 fixed sign by the recurrence conditions, let us examine more closely the cases # 2 > 0, # 2 < 0, and # In the case that # 2 > 0, we note that - a 1 a 2 reflective and face F 2 is non-reflective, with C the broken triple through F 1 is optimal and the optimal value is given by I 1 (v) above. Within (which is non-empty) the direct triple is optimal and the value of the VP is given by I 0 (v). Figure 2 illustrates this case. now reflective and F 1 non-reflective, and we have that both C 2 and R 2 are non-empty. In the final case, # we see that - a 1 is a multiple of (0, 1) # and - a 2 a multiple of (1, both faces of the quadrant are non-reflective and thus Furthermore, the direct triple is optimal for all v # R 2 and the optimal value I 0 (v) simplifies to I For this case, Harrison [15] explicitly obtained the density function for the stationary distribution of the SRBM, which is given by cr -1/2 cos(#/2) exp # 1 |(v 1 +r) # with It is reassuring to note that, as expected, the exponent obtained by Harrison exactly matches the VP value above. 7.2. Skew-Symmetric case In Harrison and Williams [18,19] it was demonstrated that the stationary density function for a (R d admits a separable, exponential form if and only if the data satisfies the following skew-symmetry condition: us then assume that the skew-symmetry condition holds. In this case, a (R d #, R)-SRBM has a stationary distribution if and only if (4.2) holds. Furthermore, the stationary density is given by c exp(-# v), where c is a normalizing constant and In this subsection, we discuss the solution to the VP in two dimensions in the case that the data satisfies (7.1) and (4.2). This provides a check of the large deviations analysis versus an explicit calculation of the stationary density. Consider a (R 2 loss of we assume the following: is just the identity matrix and the skew-symmetry condition (7.1) in fact reduces to just one equation: With the skew-symmetry condition, we have a number of interesting simplifications to the expressions derived for the VP, which are summarized in our next theorem. Theorem 7.1. Consider a (R 2 whose data satisfies (7.1) and (4.2). For this SRBM the following hold: (a) - a 2 . (b) At least one of the two faces is reflective. (c) If F 1 is reflective, and F 2 is not, C and the cone C 1 covers the entire state space, namely, C 1 # R 2 (d) If F 2 is reflective, and F 1 is not, C and the cone C 2 covers the entire state space. - a - a (i) F2 is non-reflective (ii) F1 is non-reflective (iii) Both F1 and F2 are reflective - a Figure 3. Optimal paths for the skew-symmetric case both faces are reflective, the cones C 1 and C 2 partition the state space R 2 and possess a common boundary which has direction - a (f) For any v # R 2 , the optimal value given in (7.2). Figure 3 illustrates the three general possibilities that can occur for VP solutions in the skew-symmetry case, as outlined in (c), (d), and (e). consequence of our theorem is that, for any v # R 2 an optimal triple is always a broken triple, except when both faces are reflective and v is in the direction of - a. In this exceptional case, the direct path to v is optimal. The theorem also verifies that the optimal value I(v) is given by the exponent in Harrison and Williams [18], as expected. Proof of Theorem 7.1. We first prove (a). Using (3.2), we have By (7.3), we have a 1 a 2 . (7.5) To prove - a is su#cient to show that #). s By the definition of - a i , we have Thus, (7.6) reduces to or # 0# . (7.7) Using the expressions for a 1 1 and a 2 2 in (7.4)-(7.5), one can easily check that (7.7) indeed holds, thus proving - a To prove (b), we first note from (7.1) that v # Rv > 0 for any v # R 2 . Thus, Therefore, with (3.5) and part (a), we have . Furthermore, from (4.2) we also have that Collecting all of these facts we have the following conclusions. If r 1 > 0, then (7.4) implies - a 1 > 0; if r 2 > 0, then (7.5) implies nonnegative entries. This fact, along with the linear equalities (7.4)-(7.5), imply that at least one of the -a i is positive. Since at least one component of - a is positive in every case, we have now established (b). Parts (c), (d) and (e) follow directly from parts (a), (b) and the definitions of C i and reflectivity. It remains to prove (f). From (c), (d) and (e), we know that, for any v # R 2 I(v) is equal to either #-a 1 #, v# or #-a 2 su#cient to prove #-a - #, v# v for any v # R 2 , or equivalently, # #) is equal to either side of (7.7), we have which is equal to # as desired. This concludes the proof of the theorem. 8. Extensions and Further Research We now comment on extending these ideas to more general polyhedral state spaces. It is our hope that our study will provide a framework and road map especially for further research on higher dimensional problems. It is clear that much of the analysis in Section 5 will hold in higher dimensions and for general polyhedral state spaces. However, even for more general regions in two dimensions, we may have to choose an optimal escape path from more than three possible types. In other words, the VP can still be reduced to finite choice problem, but it may be more di#cult to easily characterize the solutions as we did for the orthant in Section 6. We encounter more serious di#culties when passing to the VP in three or more dimensions. A primary challenge to extending the results is to investigate if an analog to Theorem 5.1 holds in higher dimensions. From a computational standpoint, it would be most desirable if we could eliminate paths which "spiral" around the boundary before traversing the interior of the orthant. An example of such a principle is a conjecture of Majewski's [28] which states that at most d pieces are needed to solve the VP in R d . This would limit our search in three dimensions to 10 types of paths, significantly reducing computational e#ort, even if it is no longer practical to completely characterize the solutions to the VP, as we have for the quadrant. It is an interesting open problem to characterize under what conditions, the VP may be so reduced to finite choice problem. Further work is also needed in proving LDPs like Conjecture 4.1 for SRBMs and even more general regulated processes. Acknowledgments : We are grateful to C. Knessl, Kurt Majewski, Neil O'Connell, and Ruth Williams for generously sharing their ideas and preprints. Part of this research was performed while Jim Dai was spending his sabbatical visit to Stanford from December 1998 to June 1999. He would like to thank the financial support of The Georgia Tech Foundation, the Department of Engineering- Economic Systems/Operations Research and the Graduate School of Business of Stanford. Partial support from NSF grants DMI-9457336 and DMI-9813345 is also acknowledged. A good portion of this research was performed while John Hasenbein was visiting the Centro de Investigaci-on en Matem-aticas (CIMAT) in Guanajuato, Mexico. He would like to thank CIMAT and the National Science Foundation, who jointly provided an International Research Fellowship (NSF Grant INT-9971484), which made this visit possible. s --R Large deviations and queueing networks: methods for rate function identification. Nonnegative matrices in the mathematical sciences. "orthant" On the large deviations behaviour of acyclic networks of G/G/1 queues. Large deviations for stationary Markov chains in a quarter plane. Simple necessary and su Hierarchical modeling of stochastic networks II: strong approximations. Reflected Brownian motion in an orthant: numerical methods for steady-state analysis Large Deviations Techniques and Applications The large deviation principle for a general class of queueing systems. Large deviation behaviour of two competing queues. On Lipschitz continuity of the solution mapping to the Skorokhod problem A Skrokhod problem formulation and large deviation analysis of a processor sharing model. Lyapunov functions for semimartingale reflecting Brownian motions. Brownian models of multiclass queueing networks: Current status and open problems. Reflected Brownian motion on an orthant. Brownian models of open queueing networks with homogeneous customer populations. Multidimensional reflected Brownian motions having exponential stationary distributions. Recurrence and transience of reflecting Brownian motion in the quadrant. Boundary e On the di Large deviations of stationary reflected Brownian motions. Heavy tra Large deviations of the steady-state distribution of reflected processes with applications to queueing systems Solving variational problems associated with large deviations of reflected Brownian motions. Large deviations for departures from a shared bu Large deviations for queue lengths at a multi-bu#ered resource A boundary property of semimartingale reflecting Brownian motions. Large deviations for performance analysis. Existence and uniqueness of semimartingale reflecting Brownian motions in an orthant. Recurrence classification and invariant measure for reflected Brownian motion in a wedge. Semimartingale reflecting Brownian motions in the orthant. On the approximation of queueing networks in heavy tra --TR --CTR Sandeep Juneja , Victor Nicola, Efficient simulation of buffer overflow probabilities in jackson networks with feedback, ACM Transactions on Modeling and Computer Simulation (TOMACS), v.15 n.4, p.281-315, October 2005 Florin Avram, On the large deviations approximation for the stationary distribution of skip-free regulated queueing networks, Performance Evaluation, v.51 n.2-4, p.171-190, February
skorohod problems;large deviations;reflecting Brownian motions;variational problems;queueing networks
597978
Fluid approximations for a processor-sharing queue.
In this paper a fluid approximation, also known as a functional strong law of large numbers (FSLLN) for a GI/G/1 queue under a processor-sharing service discipline is established and its properties are analysed. The fluid limit depends on the arrival rate, the service time distribution of the initial customers, and the service time distribution of the arriving customers. This is in contrast to the known result for the GI/G/1 queue under a FIFO service discipline, where the fluid limit is piecewise linear and depends on the service time distribution only through its mean. The piecewise linear form of the limit can be recovered by an equilibrium type choice of the initial service distribution.
Introduction Consider a single server queue with n new jobs residing in the queue at time 0, and a renewal stream of arrivals, rate -. The service times for these jobs are described by a sequence of independent identically distributed (i.i.d.) nonnegative random variables, with processing rate - and with processing time distribution function F , and with associated equilibrium distribution F e . Let Q n (t) be the number of jobs in the queue at time t. We study this system under a time sharing discipline: At time t the server is splitting its service capacity equally between all customers. An important performance measure here is the cumulative amount of processing time per customer allocated by the server until time t, which we denote by j n (t), and refer to as the attained service process. Let - are interested in the limiting behavior as n !1 of these rescaled processes. Under a first-in first-out (FIFO) service discipline, it is well-known that almost surely, in the uniform topology, where - maxfx; 0g). This fluid limit is continuous and piecewise linear. Moreover, it depend on the specific service time distribution only through its mean. The fluid limits under processing sharing are entirely different. In Section 3 we investigate the case of no arrivals after The fluid limit queue length process - Q(t) is then given by (3.1). It depends on the distribution of the processing times and is piecewise linear if and only if the processing time distribution is exponential. It is lower (higher) than in the FIFO case if the processing time distribution is NWUE (NBUE). Also, - Q(t) is discontinuous if the processing time distribution contains atoms (in which case a fraction of the initial n customers departs simultaneously). For this reason one can anticipate that convergence of - holds only in the Skorohod J 1 -topology (see Billingsley (1968)). The time shared system with arrivals is investigated in Section 4, where we consider the cases first show that - is the time at which the FIFO fluid limit queue length process empties. For t ! - we show that a.s. in the uniform topology, where j is given by Theorem 4.9. The result expresses in terms of the equilibrium distribution of the service times, F e . Specifically, we show that is the inverse of an affine transformation of the delay in queue distribution for an M/G/1 queue with F service times. When the inverse of an affine transformation of the renewal function of an F e renewal process. One feature that is retained in common with the FIFO case is the independence of the fluid limits of the interarrival time distribution. The explicit form of the fluid limit attained service process seems quite surprising. It is no doubt related to the a result on stationary M/G/1 with processor sharing, which says that the attained age of jobs in process are distributed as F e (Wolff 1987, Section 10.4, Example 10.8). The heavy traffic limit (in the sense of Kingman, in contrast to functional weak limits) for queues under the processor sharing discipline has been studied by Yashkov (1993) and a strong law of large numbers for the queue length process (among other results) was established for the transient case with stationary interarrival and service times in Jean-Marie and Robert (1994). Specifically, they consider the case where ae ? 1 and Q Their result is that Q(t)=t ! ff, where Q(t) is the queue size at time t and ff is the positive root of the equation R 1e \Gammaffx F e (dx). This, of course implies that - uniformly on compact intervals. We focus on the case where ae - 1 and - prove a functional strong law-of-large-number theorem (FSLLN) for the queue length process. Since the limiting process of the FSLLN may not be continuous when ae - 1, the functional SLLN is not implied by the SLLN. We note that the case where ae ? 1 and - has not been dealt with by either of the above papers. Our motivation to look at this problem is the current interest in fluid limits of multi-class queueing networks. We briefly survey some of the literature on fluid limits of queueing models and comment on their relation to our results. The early work on the fluid approximation is summarized in Newell (1982). Johnson (1983) and Chen and Mandelbaum (1991,1994) derive fluid approximations for single class queueing networks, in particular for generalized Jackson networks under a FIFO service discipline (Note that Johnson (1983) also considered a head-of-line processor-sharing discipline). For more recent work on fluid approximations see Mandelbaum and Massey (1995) and Pats (1994). In Kella and Whitt (1992) a fluid limit for a tandem queueing network is established where the limit is a tandem fluid network with compound Poisson inputs (in contrast to the usual deterministic fluid limits described earlier in the paragraph). Identical arguments imply such a convergence for general Jackson-type networks. Actually, fluid networks with certain stochastic features can be employed as direct models rather than just approximations. For studies of such networks with stochastic inputs see Kaspi and Kella (1996), Kella (1993,1996,1997), Kella and Whitt (1992,1996) and references therein. It turns out that the fluid limit queue length processes for single class queueing networks under FIFO discipline share the features of the single server queue: They are piecewise linear and depend on the service and interarrival time distributions only through their expectations. In particular, if the service times of a customer at the various servers are dependent, this has no effect on the fluid limit queue length process. This will clearly not be the case under processor sharing disciplines. Moreover, it is clear that the times at which the various components of the fluid limit queueing process reach zero will also depend on the service time distribution and will in general differ from those under FIFO. Fluid approximations and their dependence on service discipline came to the forefront in recent studies on multi-class queueing networks. A series of puzzling examples showed that the question of stability of multi-class queueing networks cannot be determined purely by traffic intensity condition. In fact these examples showed that the stability of a multi-class queueing network is not a meaningful question. Rather, one can only talk about the stability of a multi-class queueing network with reference to a specific service discipline. In particular it was found that a multi-class queueing network which has adequate processing capacity may be unstable under a bad priority policy (Kumar and Seidman 1990, Lu and Kumar 1991, Rybko and Stolyar 1992) and, more surprising, under FIFO (Seidman 1993, Bramson 1994a,b). An important portmanteau theorem of Dai (1995,1996, see also Chen 1995, Dai and Meyn 1995, Meyn 1995, Dumas 1995, and the earlier work of Rybko and Stolyar 1992 and of Botvich and Zamyatin 1992) makes the connection that a multi-class queueing network is stable under a given service discipline if and only if its fluid limit queue length processes are stable. Based on this theorem it is possible to prove stability of some priority service disciplines (Kumar and Kumar 1994, Dai and Weiss 1996, Dumas 1995, and Chen and Zhang 1996b) and of FIFO discipline (Bramson 1996, Chen and Zhang 1996a, Foss and Rybko 1995, Winograd and Kumar 1995), for some queueing networks. Also based on this theorem it was possible to characterize global stability regions of various multi-class networks, see Down and Meyn (1994), Kumar and Meyn (1995), Bertsimas, Gamarnik and Tsitsiklis (1995), Dai and Vande- Vate (1996a,b) and Hasenbein (1996). Chen and Yao (1996) is on the existence of a static priority discipline such that a multiclass queueing network is stable under the usual traffic intensity condition. Dai's theorem is a portmanteau theorem in the sense that it does not make a single state- ment. Rather it gives a general recipe for showing stability of a service discipline, by performing the following steps: One needs to define a general state space Markov chain which determines the queue length processes under the given discipline, and one needs to construct a set of equations which characterize all the fluid limits of the queue lengths processes. The theorem then connects the stability of the Markov chain and of the fluid limits. Dai (1995) also illustrates the appropriate Markov processes and the appropriate fluid equations, for priority disciplines, for the FIFO discipline, and for Head of the Line Processor Sharing Discipline. However, some of the results in that paper need to be modified before they can be applied to the Processor Sharing case. Our current paper may help in such a modification, and in particular the attained service time process may play a role in this. Finally, fluid approximations of a queueing network can be used to obtain heuristics for optimal operation of the network. Work in this direction includes Chen and Yao (1993), Avram, Bertsimas and Ricard (1995), Weiss (1995,1996), Atkins and Chen (1994), Banks and Dai (1996), and Meyn (1996). We observe that the processor sharing service discipline has some good properties, in that it tends to achieve shorter queueing delays without requiring any data on the processing times. Fluid limits for processor sharing systems can be used to assess the efficiency of the processor sharing discipline, and compare it with other control methods. Notation and Formulation In this paper we denote Almost surely, uniformly on compact intervals and without loss of generality are abbreviated by a.s., u.o.c. and w.l.o.g., respectively. 1 B denotes the indicator of an event B (1 if B occurs and 0 otherwise). Consider a single station queue with ffl service times fv k j k - 1g, with ffl service time distribution F , ffl service rate stationary excess distribution associated with F , ffl interarrival times fu k j k - 1g, with ffl arrival rate ffl arrival process ffl traffic intensity We assume that f(u k ; v k )j k - 1g are i.i.d. (nonnegative) random pairs. We consider a sequence of systems for which we would like to establish a strong limit theorem. For the nth system, at time 0, Q n (0) are present at the queue. We assume that a.s. Also we assume that all the customers present in the system at time zero have not received any service. That is, given Q service times are m i.i.d. random variables m , all distributed F (the original service time distribution). It is assumed that Q n (0) and fv 0 are independent of f(u 1g. Note that in this sequence of systems, for all n the systems share the same fv 0 the same f(u k ; v k )j k - 1g, and they differ only in the value of Q n (0). To approach the fluid limit we rescale the systems, using n as the scaling factor. The performance measure of interest is the queue length process Q indicates the number of jobs in the queue at time t when the initial queue length is (0). As in this paper we are interested in a queue with processor sharing discipline, we note that the service rate per customer at some time t is given by 1=Q n (t) whenever Q That is, the server divides his/her time equally between the customers. With Z t'(Q n (s))ds (2.2) be the cumulative rate per customer given by time t. First, we give a description of the queue length process. To this end, we observe that a customer (i, say) present at time zero will also be present at time t if and only if the cumulative service rate per customer by time t does not exceed that customer's service time. That is, if (t). Similarly, a customer which arrived after time zero (k, say), will be present at time t if and only if the cumulative service rate per customer from time U k to t does not exceed that customer's service time. That is, if Therefore, the queue length process must satisfy the following equation We now note that v 0 is the service time that the ith initial customer received up to time t. In the same manner v i - (j n is the total service time allocated to the ith arriving customer by time t. Summing everything up yields the total amount of time that the server was busy. That is t \Gamma L(t) where L(t) is the cumulative idle time. For t smaller than the first time our process hits zero, L(t) is clearly zero, so that for such t's we have or, if we define j we have 3 The case of no Arrivals Let us begin by studying the process with no arrivals. Note that in this case if we let D j be the departure time of the j t h customer, then since this is also equal to the amount of work the server performed by this time, we have that D . This is true since by that time all customers with a smaller or equal service time completed service and all those with larger received the same amount of service as customer j. This gives us a direct and explicit representation for the queueing process which is so that In preparation for the main theorem of this section we will state and prove the following simple lemma. Lemma 3.1 Let X; nonnegative random variables with EX ! 1. Then, a.s., lim sup Proof Let H be the distribution of X and H n bution) and observe thatn (s))ds and E(X - Consequently for t - s, and for s - t, we have that Hence, by the Cantelli-Glivenco theorem (see, for example, Theorem 5.5.1 on page 133 of Chung 1974) and the strong law of large numbers we have, a.s. for all s ? 0, that lim sup and by letting s !1 in the above, the right side vanishes by dominated convergence. 2 Theorem 3.2 Assume that A j 0. Then, as Q in J 1 (the usual Skorohod topology on the space D[0; 1) of right continuous functions having left limits), where e with - is the inverse of F e (noting that F e is continuous and strictly increasing on [0; supfxj F (x) ! 1g)). If F is continuous, then the convergence holds u.o.c. Proof We first observe that when A j 0 we have from(2.3) and (2.4) that and for (the later limit is taken as n ! 1), and, of course, - it follows from (3.2) that for all x - 0. Therefore, by Lemma 3.1, a.s. - n uniformly in x - 0. Since - n is continuous (nondecreasing) on [0; 1) and j n is continuous (strictly increasing) on [0; - n ) we have that - n (j n continuous nondecreasing with e such that - n is linear on [- F e (j n (- n )); -F e (j n (- clear that such a continuous and nondecreasing - n always exists (for every n). In particular - n (t) - n for t -F e (j n (- n )), which implies that - for such a t. uniformly in x - 0 and for a given ffl ? 0 taking n large enough so that - we have that - n Thus it follows that a.s. - n uniformly in t - 0. Now ae - F e where F Qn(0) (x) is the empirical distribution associated with v 0 (x). Note that when T F is finite and is an atom of F , then j n (- n enough n and when this is not the case, - Q(t) is continuous at - . In either case, we can apply Cantelli-Glivenco together with this observation to argue that - Q(t) uniformly in To conclude, we have shown that there is a sequence of continuous nondecreasing time transformations f- n j n - 1g such that a.s. lim sup which is the definition of J 1 convergence (actually somewhat stronger, but in our case equiva- lent). It is well known and easy to check that J 1 and u.o.c. convergence are equivalent when the limit function is continuous, which is the case at hand when F is continuous. 2 When v is exponentially distributed with rate -, we have - . This is expected, since it is easy to check that the process is stochastically identical to one that corresponds to a queue with a FIFO service discipline. When v is uniformly distributed with mean 1=-, it is easy to check that - In fact we also have the following. Corollary 3.3 - Q(0)=- if and only if F is NBUE (NWUE), hence equality holds only for the exponential distribution. Proof The equivalence to F -)F e is easily verified and so is the fact that F -)F e if and only if E[v \Gamma tj v ? t] -)Ev. The latter is definition of NBUE (NWUE), where NBUE is short for new better than used in expectation, and NWUE for new worse than used in expectation. The only distribution which is both NBUE and NWUE is the exponential distribution. 2 Another corollary which is easy to conclude is the following. Corollary 3.4 Let F 1 and F 2 be two distributions of the service times having the same mean 1=-. Denote Q(s))ds (see (2.2) and (3.1)) for each of these distributions by j F 1 and respectively. Then j F 1 (t) for every t if and only if F 1 - cx F 2 where - cx is the usual convex ordering. Proof Follows from j F i ie (t=-) and the fact that F 1 - cx F 2 if and only if - F 2e , which in turn is equivalent to F \Gamma1 2e . 2 Obviously, if - , then F 1 - cx F 2 . The converse may not hold. 4 The Case with Arrivals Here we will prove somewhat weaker statements than we proved in the previous section. With only that (both .a.s. It is weaker in the sense that we are not directly proving that - to a limit, we are excluding the point - from consideration, and we do not make any statements about the case ae ? 1. Our conjecture is that - does indeed converge a.s. in J 1 (u.o.c. if F is continuous) to a limit which can be derived from j, and that there are some meaningful limiting forms also for ae ? 1. On the positive side, it will be shown that j has an interesting form and comparisons will be made with the known limit for the FCFS discipline. We start by recalling a limit theorem for the workload process. Let Z be the workload process. It is well known that where L n is the cumulative idle time, given by It is clear that the workload process under a processor-sharing discipline is the same as that under a FIFO service discipline and is actually the same for all non-idling work conserving disciplines. Therefore, it follows from the FSLLN theorem for a queueing network under a FIFO service discipline that as n !1, Also if we define - then it is well known that - n =n ! - a.s. as n ! 1. Let us first consider the case ae ! 1. Let T be the first arrival epoch after - n . It is easy to see that T n =- n ! 1, a.s., so that T n =n ! - as well. Our first goal is to show that the process f - converges u.o.c. to zero a.s. With this in mind, let us first state the following well known result. Lemma 4.1 Let fX n j n - 1g be a sequence of random variables the absolute values of which are stochastically bounded by some nonnegative random variable Y having a finite mean. Then a.s. as n ! 1. We note that the assumptions (hence the conclusions) of Lemma 4.1 hold whenever fX n j n - 1g is a sequence of identically distributed (not necessarily independent) random variables having a finite mean. Next, let us state and prove the following lemma. Lemma 4.2 Let (fX n (t)j t - 0g; t n ) be a stationary and ergodic sequence, where X is a right continuous process and t n is a nonnegative random variable with tg. Finally denote (a random variable, due to right continuity). If EY converges u.o.c. to zero a.s. Proof Under the assumptions of the lemma it follows that are finite) and that 1. The latter two follow from the inequality S N(t) - t ! S N(t)+1 and the strong law of large numbers for stationary and ergodic sequences. From Lemma 4.1 we have that Y n =n ! 0 a.s. as n !1. Thus, Y N(t)+1 a.s. as t ! 1. It is easy to show that if for a given function f , f(nt)=n converges u.o.c. to zero as Theorem 4 of Glynn and Whitt [27]). Thus, we are done. 2 We note that a special case of the structure of the process X in Lemma 4.2 is that of a regenerative process having i.i.d. cycles. Let us now state and prove the following desired result. Theorem 4.3 f - converges u.o.c. to zero a.s. (note ? rather than -). Proof Let us denote by 0 Q(t) the number of customers in the system for the case where is a regenerative process with an initial delay u 1 . The cycles are the cycle times in a GI/G/1 queue. For each t ? u 1 we have that 0 Q(t) is at most the total number of customers that arrived during the cycle to which t belongs. 1, the number of arrivals in a single cycle has a finite mean, as the first decreasing ladder height in a related random walk having a negative drift. By Lemma 4.2 this implies that 0 converges u.o.c. to zero a.s. We now return to consider the original process Q n (t), and we note that, clearly, 0 Q(T - 1. If we pick - ! a ! b then we can take N such that T n =n ! a for n - N . Hence Therefore, for n - N we have that - and in particular sup a.s. as n !1. Therefore, the proof is complete. 2 Next, for the case ae - 1 we would like to show that j n converges u.o.c. on the half open interval [0; -) (note that To facilitate our analysis, we write an alternative expression for the workload process: We first prove the following result which holds for all ae - 0. Lemma 4.4 Given any 0 ! - there exists an ffl ? 0 such that lim Proof Fix a K ? 0 and consider t In view of (2.3) and (4.4), we have Hence, which implies that By the continuous mapping theorem we have that inf t2[0;- 0 converges a.s. to ffl and recall that - in the above inequality yields dominated convergence that E[v1 fv?Kg ] vanishes as K ! 1. In particular take K ? 0 such that [ - This completes the proof. 2 By Lemma 4.4 it now immediately follows that fj n j n - 1g are nondecreasing, equicontinuous and uniformly bounded (hence c-tight) on [0; - 0 ] for every - actually uniformly (in n) Lipschitz continuous on [0; - 0 ].) This implies the following. Lemma 4.5 Almost surely, every subsequence of fj n j n - 1g has a further subsequence which converges u.o.c. on [0; -). To show that j n converges u.o.c. a.s. on [0; - ), we will need to show that a.s. all convergent subsequences converge to the same limit. Note that the statement in Lemma 4.5 begins with "Almost surely". This is stronger than stating that every subsequence has a further subsequence which converges a.s. The latter, together with having a common limit to all convergent subsequences, implies only convergence in probability. We begin with the following main and fundamental result. R be a Borel measurable function which satisfies the following conditions: 1. Uniform equi-continuity on finite intervals: for every t ? 0 and ffl ? 0, there is a ffi such that if 0 - y for all x 2 R. 2. Domination: jh(x; y)j - g(y) for some nondecreasing finite g. Then, with the notations and under the assumptions of Section 2,n Z tEh(v; s)ds (4.6) a.s., as n !1, where Proof First note that since U i =i pick a random I such that jU i I . In particular if, for a given ffl and for according to property 1 in the statement of this lemma, then we have that for each n such that A(nt) - I , Hence, since A(nt)=n ! -t, then a.s.,n \Gamman as n !1. Next we observe that \Gamman which vanishes a.s. as n !1. Now, as in (4.7) we also have thatn -t a.s., as n !1. To continue, we replace b-ntc by n and observe that which implies that -t By Chebyshev's inequality and the Borel-Cantelli Lemma, this implies, as in the proof of Theorem 5.1.2 on page 103 of Chung 1974, that -t a.s., as n !1. Denote - h(x; and note that - h also satisfies conditions 1 and 2 (with - Since for all 1 we have that and the right side vanishes as n !1, it follows from condition 1 (applied to - that as n !1 and thus D n =n a.s. This implies that, a.s. -t (that is, the entire sequence converges a.s.) Finally, we observe that by dominated convergence, Eh(v; \Delta) is a continuous function and hence Riemann integrable. Thus clearly -t and the proof is complete. 2 As an immediate corollary we now have the following. Corollary 4.7 Let j be a continuous (hence uniformly continuous on compact intervals) and nondecreasing function which is bounded on finite intervals. Then, for a fixed t, h(x; conditions 1 and 2 in Lemma 4.6 and thus, under the assumptions of the lemman a.s., as n !1, for all ae - 0. We are now ready to state and prove the most important result of this section. Theorem 4.8 If - u.o.c. a.s. on [0; -), where j satisfies the following equation Proof For every (u.o.c.) convergent subsequence j n k ! j, it is easy to show that, for a given the difference betweenn k vanishes a.s., as k ! 1. This together with (2.4) and Corollary 4.7 (noting that by equicontinuity of implies the result, provided we are able to show that (4.18) has a unique solution. This is shown in Theorem 4.9 to follow. 2 Theorem 4.9 For ae - 1, equation (4.18) has a unique solution which is the inverse of In particular: (i) When ae ! 1, it is the inverse of where F W jW?0 (x) is the conditional stationary distribution of the waiting time in an M/G/1 queue (excluding service) given that the server is busy. For this M/G/1 queue, the arrival rate is and the service times are distributed like v. it is the inverse of - e is the renewal function associated with F e . Proof as the right continuous inverse of j. Since j is continuous and by Lemma 4.4 also strictly increasing on [0; - ), it follows that - also has these two properties on [0; j(- \Gamma)) and is continuous and nondecreasing on [0; 1) with Therefore, recalling that ae = -Ev and that F e is the stationary excess distribution of v, then Z xF e implying that It is well known that when ae ! 1 the stationary distribution of the waiting time in an M/G/1 queue with FCFS service discipline is given by Thus, ae ae which implies that which implies the result for ae ! 1. For 1, from which the result is immediate. 2 We note that for the case ae ! 1, the time until j(t) becomes constant (so that the limiting queue is at zero) is given by as expected (see (4.19)). Note that j is in fact Lipschitz continuous in any compact subsets of absolute continuous and is differentiable almost everywhere on [0; - ). If we assume that - converges to - Q in some sense, then it follows from (j(t)). It is interesting to compare how - Q(t) relates to - where we recall that 1=Ev. The latter is what we would obtain in the limit if the service discipline was FCFS. In that regard we immediately see that - that Q(t) and From (4.21), this is equivalent to That is, the hazard rate of W jW ? 0 is at least - \Gamma -. It is easy to check that when v is exponentially distributed, then W jW ? 0 is exponentially distributed with rate - \Gamma -, so that in this case (4.23) holds with equality. This is expected, since in this case the original process has the same distribution as the one with the FCFS discipline. For the case ae = 1, when v is exponentially distributed, then F e is also the exponential distribution and thus M e Q(0)x. Thus, in this case which implies that - Q(0) for all t - 0, and is well known to hold for the FCFS case. For the non-exponential F , M(t)=t ! -. Hence, if - Q(1) then from j(t)=t ! - immediately follows that - Q(0). Acknowledgment . The work of Jean-Marie and Robert (1994) was brought to our attention by Vicent Dumas. --R Performance evaluation of scheduling control of queueing networks: fluid model heuristics. Simulation studies of multiclass queueing networks. Stability conditions for multiclass fluid queueing networks (preprint). Convergence of Probability Measures. Ergodicity of conservative communication networks. Convergence to equilibria for fluid models of FIFO queueing net- works Fluid approximations and stability of multiclass queueing networks: work-conserving discipline Discrete flow networks: Bottleneck Analysis and Fluid Approximations. Hierarchical modelling of stochastic networks Dynamic scheduling of a multiclass fluid network. Stable priority disciplines for multiclass networks. A Course in Probability Theory. On positive Harris recurrence of multiclass queueing networks: a unified approach via fluid limit models. A fluid-limit model criterion for instability of multiclass queueing net- works Stability and convergence of moments for multiclass queueing networks via fluid models. Stability and Instability of Fluid Models for Re-Entrant Lines Piecewise linear test functions for stability of queueing networks. A multiclass network with non-linear Stability of multiclass Jackson-type networks Ordinary CLT and WLLN versions of L Necessary conditions for global stability of multiclass queueing networks. On the transient behavior of the processor sharing queue. Diffusion Approximations for Optimal Filtering of Jump Processes and for Queueing Networks Stability of feedforward fluid networks with L'evy inputs. Parallel and tandem fluid networks with dependent L'evy inputs. Stability and non-product form of stochastic fluid networks with L'evy inputs Stochastic storage networks: stationarity and the feedforward case. A tandem fluid network with L'evy input. Stability and structural properties of stochastic fluid networks. The last buffer first serve priority policy is stable for stochastic re-entrant lines Stability of queueing networks and scheduling polities. Dynamic instabilities and stabilization methods in distributed real-time scheduling of manufacturing systems Distributed scheduling based on due dates and buffer priorities. Strong approximations for time dependent queues. Transience of multiclass queueing networks via fluid limit models. The Policy Improvement Algorithm for MDPs. Applications of Queueing Theory Ergodicity of stochastic processes describing the operations of open queueing networks. First come first server can be unstable. Optimal draining of a re-entrant line Optimal draining of a re-entrant lines: Some solved examples The FCFS service discipline: stable network topologies Stochastic Modeling and the Theory of Queues On a heavy traffic limit theorem for the M/G/1 processor sharing queue. --TR --CTR Robert C. Hampshire , Mor Harchol-Balter , William A. Massey, Fluid and diffusion limits for transient sojourn times of processor sharing queues with time varying rates, Queueing Systems: Theory and Applications, v.53 n.1-2, p.19-30, June 2006
functional strong law of large numbers;processor-sharing discipline;fluid approximation;GI/G/1 queue
597998
Heavy traffic analysis of controlled multiplexing systems.
The paper develops the mathematics of the heavy traffic approach to the control and optimal control problem for multiplexing systems, where there are many mutually independent sources which feed into a single channel via a multiplexer (or of networks composed of such subsystems). Due to the widely varying bit rates over all sources, control over admission, bandwidth, etc., is needed to assure good performance. Optimal control and heavy traffic analysis has been shown to yield systems with greatly improved performance. Indeed, the heavy traffic approach covers many cases of great current interest, and provides a useful and practical approach to problems of analysis and control arising in modern high speed telecommunications. Past works on the heavy traffic approach to the multiplexing problem concentrated on the uncontrolled system or on the use of the heavy traffic limit control problem for applications, and did not provide details of the proofs. This is done in the current paper. The basic control problem for the physical system is hard, and the heavy traffic approach provides much simplification. Owing to the presence of the control, as well as to the fact that the cost function of main interest is ergodic, the problem cannot be fully treated with classical methods of heavy traffic analysis for queueing networks. A basic result is that the optimal average costs per unit time for the physical problem converge to the optimal cost per unit time for the limit stationary process as the number of sources and the time interval goes to infinity. This convergence is both in the mean and pathwise senses. Furthermore, a nice nearly optimal control for the limit system provides nearly optimal values for the physical system, under heavy traffic, in both a mean and pathwise sense.
Introduction The paper develops the mathematics of the heavy traffic approach to the control and optimal control problem for multiplexing systems. There are many mutually independent sources which feed into a single channel via a multiplexer or networks of such systems. Since the process of cell generation by each source is random, the total instantaneous rate might sometimes exceed the channel ca- pacity, unless the channel is wastefully large. Buffers of appropriate capacities are often used (and they will be in this paper) to help smooth the flow and reduce losses. But, unless possibly long delays and excessive buffer sizes are acceptable, the problem of cell loss due to buffer overflow remains. Some type of control is often used to balance the overflows, delays and the losses that the control itself might introduce. In general, the sources can be divided into statistically distinct classes; for example, data, voice and video, and these classes might be subdivided further, depending on the assumed models for the data (cell) generation. Figures 1.1 and 1.2 illustrate systems with one and two source classes, resp. Figure 1.3 illustrates a small feedforward network. ae- -: Independent Sources Multiplexer Buffer Figure 1.1. A simple multiplexer system. One user class. \Gamma' User Class 1 User Class 2 Buffer Figure 1.2. A simple multiplexer system. Two user classes. ae ae ae? -: ae ae ae ae ae? \Phi \Phi \Phi \Phi \Phi \Phi* User Class 1 User Class 2 Buffer 1 Buffer 2 User Class 3 Figure 1.3. A small network. Even for the uncontrolled model, the problem of computing steady state losses and delays is difficult. For the Markov modulated source with a "fluid" model for both the cell generation and the channel transmitter, a single source class, and an infinite buffer, the problem was resolved via use of clever transformations in Anick, Mitra and Sondhi [1]. For the same case, the fact that there are a large number of sources was exploited in Knessl and Morrison [7], who used a type of heavy traffic method and a matched asymptotic expansion to get approximations. Such methods do not seem to work with more complex problems, where there is control or where the buffer is finite. The difficulties only increase when there are many source classes. A direct heavy traffic approach was taken in Kushner and Martins [16], who showed how to get the correct limit for an uncontrolled problem but with an arbitrary number of source classes. Numerical data for such systems as well as for some control problems was presented in [18], which showed good agreement with the exact results for many instances where the traffic was not "heavy," say with a utilization of 75-85%. A large class of control problems was exhaustively discussed in Kushner, Jarvis and Yang [14]. This work used heavy traffic modeling of control problems, and numerical approximations to the heavy traffic limit. The considerable advantages of the method for analysis and design were clear. The basic control problem for the physical system is hard, and the heavy traffic approach provides much simplification. The control problem will be discussed in detail below. But, basically, it is a controlled heavy traffic model, where the average cost per unit time over an infinite time interval is of interest. One of the cost terms of interest is the mean value of the scaled overflow from the buffer, which is a "reflection term" in the limit. One would like to show that the optimally controlled costs for the physical problem converge to the optimally controlled cost for the limit problem, and that a nearly optimal control for the limit problem is also nearly optimal for the physical problem if the traffic is heavy. Owing to the presence of the control, as well as the ergodic cost function, the problem is hard and cannot be treated with "classical" methods of heavy traffic analysis. The interest in [11, 14] was in the exploration of the practical use of the heavy traffic limits and little attention was devoted to the proofs of convergence, although the basic techniques needed for the proofs existed in the "controlled" heavy traffic literature, particularly in the methods developed by the author and coworkers [13, 15, 17, 19, 20, 22]. Heavy traffic methods for queueing type problems have been of great interest since the early work of Iglehart and Whitt [5] and sophisticated results [23] are available for the uncontrolled queueing net-work problem where there is no state dependence. The work [20] introduced the "martingale" methods for dealing with both control and general state dependence for queueing networks. In this paper, we will describe the techniques needed for the controlled multiplexer problem and give the relevant proofs. The heavy traffic approach covers many cases of great current interest, and provides a useful and practical approach to problems of analysis and control arising in modern high speed telecommunications. In order to motivate the overall approach, we will now say a little about the numerical results of [14]. Many standard types of control mechanisms are covered. A canonical control mechanism is the marking of low priority cells at the source, and deleting them (either at the source or at the buffer entrance) if it seems likely that an overflow problem is developing. If the rules for deletion depend appropriately on the system state, then the system performance can be improved substantially [14]. Under broad and reasonable conditions, such cell deletions will occur only rarely, as was amply demonstrated by the data in [14]. Alternative control mechanisms which fit into our framework are the purchase (in a feedback way) of extra bandwidth, more efficient coding or the controlled use of an extra channel. The so-called "leaky bucket" controller is commonly used. There, cells are deleted at the sources according to a rule determined by the token and cell arrival streams and token buffer size. It was seen in [14] that this form also fits our framework, and that it is much inferior to the use of reasonable feedback controls. An important question concerns the tradeoff between losses due the deliberate discarding of cells by the controller and losses due to arrivals of cells to a full buffer. The latter losses are more important, and the control approach allows us to understand the possible tradeoffs, while considering delay as well. When there are many classes of sources, each of which can be controlled sepa- rately, the control problem is more subtle, since losses/class would normally be weighed differently, and there might be different constraints on the maximum mean losses [14]. Sometimes one wants an optimal or nearly optimal control, the value of an optimal cost, or the value of some performance measure under a control that is optimal for some other performance measure. But optimization per se was not necessarily the main interest in [14]. Perhaps of greater interest is the use of optimizing or optimal control methods for exploration. The value of this approach was amply demonstrated in [14], and many of the results were not at all a priori obvious. The large gains due to the use of feedback control were demonstrated. The dependence on the parameters of the problem was discussed, as was the sensitivity of the performance to variations or approximations in the control. It was shown that there is a near linearity of the (log of the) components of the optimal losses as a function of the buffer size, which can be exploited to get results where the probabilities of loss are extremely small. This was not obvious, since for each buffer size the cost and its components are the solution to a different optimization (hence nonlinear) problem. The structure of the control is often simple (e.g., linear switching curves). The dependence of the performance on the bounds on the maximum mean loss rates at the controls and other system data, as well as the effects of the "noisiness" and modeling errors were discussed. Codes for the numerical solution are publically available on the internet, and documented in [6]. We assume that each source is of the Markov modulated type of Anick, Mitra and Sondhi [1], although the limit equations are the same for other types of cell creation mechanisms, such as low order auto regressive schemes. The general methods apply to an arbitrary number of source classes, or even to certain networks [14, 16, 18]. But in order to focus on the essential mathematical ideas without excessive notational encumbrances, we will concentrate on the case where there is only one single source class. The basic state variables are the buffer content and the numbers of on sources. Under appropriate scaling and centering, as the number of sources N and channel bandwidth become large, the processes defined by the state variables can be approximated by a controlled reflected diffusion process, which represent the scaled and centered number of on sources and the scaled buffer content. The "limit" variables can be interpreted as "aggregated" states. The proofs use the fact that as the size of the system (N and bandwidth) grows, laws of large numbers and central limit theorems can be exploited. The "limit" or aggregate equations can be used to compute nearly optimal or good controls for the physical system, and to get good estimates of all of the important measures of performance. The relative simplicity of the heavy traffic limit helps us to understand the main parametric dependencies and yields both qualitative and quantitative information which is often very hard to get otherwise [14]. In Section 2, the physical problem is formulated for the case of a single user class. The methods and results are the same, irrespective of the number of user class, but we wish to minimize notational complexity. The input-output equations are written in a form that facilitates the derivation of the limit equations, and the heavy traffic limit is derived for a controlled problem. The analysis is more or less straightforward diffusion approximation analysis, but using the martingale problem methods. The basic heavy traffic condition is that the channel speed is slightly greater (of the order O( than the mean rate of cell generation for all sources, and will be quantified in Section 2. It is seen in [14] that this is sufficient for good performance. The form in which the control appears in the input-output equations was shown in [14] to cover a large number of important cases. Section 3 is concerned with the convergence of appropriate costs, defined on a finite time interval. It is shown that the limit optimal control problem can be used to get approximations for the physical control problem under heavy traffic. The "ergodic" or average cost per unit time problem (over an infinite time interval) is dealt with in Sections 4 and 5. Since the convergence theory is considerably harder than that for the problem over a finite interval, the development is split into two parts. Section 4 deals with the uncontrolled problem. This allows the introduction of the basic "occupation measure" method of proof in a simpler context. The idea is to show that the sequence of costs (as N !1 and the time period goes to infinity) converges to that for the stationary limit process, no matter how the parameters go to their limits. It turns out that both the mean values and (in probability) the pathwise values converge to the "ergodic" value. This is important since in any single application, we have just one sample path, so mean values are less important than pathwise values. The basic occupation measure technique that is used has broad applications for limit problems (either controlled or uncontrolled) where ergodic cost criteria are im- portant, as seen here and in [10, 17]. We try to develop the proof so that the main ideas are represented, but it is not overencumbered with technicalities. The ergodic control problem is treated in Section 5. The details of proof are quite similar to what was done for the uncontrolled problem, except for certain questions concerning the existence of "nice" almost optimal feedback controls. But the needed additional results are essentially consequences of results in [9, 12]. A basic result is that the optimal average costs per unit time converge to the optimal cost per unit time for the limit stationary process as and the time interval goes to infinity in any way at all. This convergence is both in mean and pathwise. Furthermore, a "nice" nearly optimal control for the limit system provides nearly optimal values for the physical system, under heavy traffic, in both a mean and pathwise sense. The fact that N and the time can go to infinity in any way at all is important, since the result would not be useful if, say, we required that either N or the time increase as the traffic intensity increased, in order to get a useful approximation. Section 6 contains some background material on weak convergence. Since [11, 14] dealt extensively with numerical data, such data is not discussed here. 2 The Input-Output Equations: One Class of Users There are N mutually independent sources which are statistically identical, each of the "Markov modulated" type of Anick, Mitra and Sondhi [1]. Thus, each source alternates between on intervals in which cells are created and off intervals during which no cells are created. The duration of each on (resp., off) period is exponentially distributed with mean value 1=- (resp., 1=-). When on, a source can create cells according to either a "fluid" or a Poisson process, with mean rate - ? 0, or any combination of the two. By "fluid," we mean that the cell sizes are identical and small, so that the number of cells created can be taken to be - times the total on time. The model is intended to capture the variable bit rate property of the source. The basic reference for the uncontrolled problem in heavy traffic is Kushner and Martins [16]. Some cells might be deleted by a controller which can depend on the system state information. After control, the remaining cells are queued in the flow smoothing buffer of a transmitter of finite size B N . An arrival to a full buffer is rejected. The numerical data in in Kushner, Jarvis and Yang [14] argue that N is the correct order for a flow smoothing buffer. This is also implied by the form of the heavy traffic limit. If the buffer size were o( N ), then the losses would be large and the heavy traffic limit would not see any buffer. For a system satisfying (2.3) with a buffer of order O( N ), the buffer is nearly always empty for large N; as is seen in the numerical work reported in [14]. The controller can be located either at the sources or at the buffer. The transmitter service process can be either fluid or non-fluid. By "fluid," we mean that the processing time is the same for each cell. Let c N denote the transmitter (i.e., channel) rate. The input-output equation. Let ff i;N (t) denote the number of cells deleted from the ith source by time t; and define: ff i;N (t): Let X N (t) denote (1= N )\Theta (the number of cells in the buffer at t). Let D N (t) denote (1= (number of cells transmitted by t, assuming that the buffer is never empty). Let U N (number of cells rejected by time t due to a full buffer) and A N (total number of cells created by the N sources by time t). Let L N (\Delta) denote (1= N times) the number of "fictitious" cells transmitted when the buffer is empty. Thus D N (t) \Gamma L N (t) is the scaled number of cells actually transmitted by time t. This way of writing the transmitted number is both traditional and convenient for getting the limit equations. Then the equation for the scaled buffer content is For the fluid transmitter case, we can suppose that D N The non-fluid transmitter case. For each N , let the sequence of (real and fictitious) service times. They will depend on N , since the transmitter's work is roughly proportional to N . They are assumed to be mutually independent, identically distributed and independent of the set of source processes. The definitions imply that c Assume that there is sup and that there is oe \Theta To get the (heavy traffic) stochastic differential equation approximation, we make the usual assumption that the transmitter works slightly faster than the stationary total mean arrival rate of messages from all sources, which is N-). In particular, suppose that there is constant - a This was shown to be adequate for good performance in [14]. The controller assumptions. It is argued in [14] that in typical applications good controllers can be represented in the following form. There are - u ? 0 and (\Delta) such that Z tu N (s)ds where ~ t, as N !1: (2:4b) Furthermore, for the general cases discussed in [14], it is also true that sup each t; (2:4c) and, more generally, sup which will be of use for treating the ergodic cost criterion. The symbol ) denotes weak convergence. See Section 6. The controller choices at each time depend only on the system data and prior controller choices up to time t, as do u N (t) and ~ ff N (t). Loosely speaking, u N (t) represents the scaled conditional (given the past data) mean rate of cell deletion at time t (or its "local average"). ~ ff N (\Delta) is the "control noise;" it represents the (scaled) variation of the actual number of cells being deleted about the conditional mean value. The upper bound - u is a quality of service constraint. It is a limit on the scaled mean rate of cell deletions. It is seen in [14] that (2.4b) is a consequence of the law of large numbers and the large value of N , and that there is no need for more control for good performance. Since we are concerned only with the mathematics of the convergence in this paper, the form (2.4) will be accepted, and the reader is referred to [14] for further discussion. By an admissible control for (2.1), we mean any measurable control rule which depends only on the available past information and satisfies (2.4). Simplification of the input-output equation. Let y i (t) be the indicator function of the event that source i is on at time t. Suppose that the source on-off processes are stationary. Define Y N By the stationarity and the "Markov mod- ulated" assumption, EY N Suppose that fZ N (0)g is tight. The controls are always assumed to be admissible. The martingales ~ A N (\Delta) and ~ in the next theorem represent the "local unpredictability" in the arrival and departure processes, resp. Let F N t denote the minimal oe\Gammaalgebra which measures t being the expectation conditioned on F N Theorem 2.1. The system equations can be written as Z tZ N (s)ds \Gammaff ae N (\Delta) converges weakly and in mean to the "zero" process and ~ A N (\Delta) and ~ 0 (\Delta) are martingales. The sequence A N (\Delta); ~ (2:7a) is tight. Write the limit of a weakly convergent subsequence as There is a measurable process u(\Delta) satisfying 0 - u(t) - u such that u(s)ds and L(\Delta) and U (\Delta) are the reflection terms. For the source fluid model, W 2 and W 3 for the transmitter output fluid model. Otherwise, the W i (\Delta) are mutually independent Wiener processes. The other processes are non-anticipative with respect to the Wiener processes. If there is no control and the initial conditions fX N (0)g converge weakly, then any subsequence has the same limit. The variance parameter of W 1 (\Delta) is oe 2 2-). For the non-fluid cases, the variance parameters of W 2 (\Delta) and W 3 (\Delta) are oe 2 Comment on oe 2 2 . For simplicity, we have supposed either "fluid" or "Poisson" sources. Intermediate cases are possible, where some are "fluid" and others "Poisson," or where each source alternates between the possibilities. Then just adjust oe 2 proportionally. Proof. Recall that by (2.4), we can write ff N process. For notational simplicity, it is usual to rescale such that this will be done henceforth. Many of the details for the uncontrolled case are in [16] but will be outlined for the sake of self containment. Since fX N (0)g is tight, any subsequence contains a further subsequence which converges weakly. To simplify notation, and without loss of generality, we simply suppose that the original sequence fX N (0)g converges weakly. Write a i (t) for the number of cells created by source i by time t. By the properties of Markov chains and the definition of the process y i (\Delta), we can write dy where ~ are orthogonal F N t \Gammamartingales. For the "fluid" input model, ~ a i since the source cell creation rate is then either unity or zero, depending on whether the source is on or off. Define the F N \Gammamartingale process ~ A N (\Delta) by ~ A N a ds Then, using the fact that EY N A N Z t[Y N ds Z tEY N ds Z tZ N ds Define the martingale process ~ D N (\Delta) by ~ Nt and define S N (\Delta) by S N (number of real and fictitious departures up to time t). We have 1= Then we can write Using the heavy traffic condition (2.3) and the fact that the difference between the time of the first departure at or after time t minus t, the last term on the right can be written as - at Combining the above representations yields where ~ Z N (\Delta) is an F N t \Gammamartingale, and Z tZ N ds \Gamma - at \Gammaff Standard "Markov chain" arguments yield The f~y i (\Delta); ~a i (\Delta)g are independent of D N (\Delta); S N (\Delta). Furthermore, it is not hard to verify that for each s ? 0 sup A N (t) and sup The tightness of the martingale sequences is a consequence of the criteria of Theorem 6.1. Condition (2.2b) and Chebychev's inequality imply that for any lim sup 0: Thus the discontinuities of ~ N (\Delta) on any finite interval go to zero as This implies that any weak sense limit process of f ~ D N (\Delta)g has continuous paths with probability one (see Section 6). Similar considerations (together with the fact that their jumps are O(1= N) imply that the sequence f ~ is tight and that the limit processes have continuous paths with probability one. Since S N (\Delta) converges weakly (and in mean for each t) to the process S(\Delta) with values ct j -t=(-); the sequence f ~ D N (S N (\Delta))g is also tight. The sequence fff N (\Delta)g is obviously tight by the conditions put on it in (2.4), and any sense limit process has continuous paths with probability one. The most direct way to show the tightness of the sequence of reflection terms (\Delta))g is to use the reflection map, and work in "pieces," as follows. define the random times oe N On the interval [oe N n+1 ); there is only a "lower" reflection. On that interval, appropriately defined H N (\Delta). Then we have the reflection map (for ae t-s-oe N \GammaH N (t) oe There is the analogous formula for the upper reflection term U N (\Delta) on the intervals n These formulas and the proved tightness property of the functions imply the tightness of fL N (\Delta); U N (\Delta)g provided that on each interval [0; T ], there are only a finite number of excursions: i.e., that lim lim inf oe N lim lim inf But (2.15) follows from the tightness of fH N (\Delta)g. Finally, since all of the other processes in (2.1) are tight, so is fX N (\Delta); Z N (\Delta)g, and all of the weak sense limits have continuous paths with probability one. Let us fix a weakly convergent subsequence, and index it by N for notational simplic- ity. Let \Phi(\Delta) in (2.7b) denote the weak sense limits of the selected subsequence, and let F t be the minimal oe\Gammaalgebra which measures f\Phi(s); s - tg. By the convergence, it is clear that (2.8) holds. Also, it is not hard to see that t. Furthermore, we can check that the weak convergence implies that L(\Delta) and U (\Delta) are reflection terms: In other words, they are non- negative, nonincreasing and can increase only when X(\Delta) takes values on the appropriate boundary. Since ~ process by hypothesis and 0 - u N (t) - u, it can be readily shown that ff(\Delta) is Lipschitz continuous with Lipschitz coefficient - u: Thus, there is a measurable process u(\Delta) satisfying 0 - u(t) - u such that u(s)ds. We need only show that the W i (\Delta) are the desired Wiener processes, and the non-anticipativity property. If ff(\Delta) is non-anticipative, then we can take u(\Delta) to be non-anticipative. In the calculation below, oe 2 the source is "fluid," and oe 2 the transmitter is "fluid." Define W N Z N (\Delta), W N A N (\Delta), W N 3 (\Delta)): For f(\Delta) satisfying the requirements of Theorem 6.3 (whatever the dimension), and t - 0; - ? 0, for small (possible modulo an "end term") f \Theta f Now use a truncated second order Taylor series expansion of the terms in the sum in (2.16), the martingale properties, (2.12) and (2.13), to get that f Z t+- ds goes to zero as N !1: Let \Phi N (\Delta) represent the set of processes in (2.7a). Now, letting h(\Delta); t; -; t i and k satisfy the conditions in Theorem 6.3, we have that [f Z t+- ds as along the convergent subsequence. Using this fact and the weak convergence yields that Z t+- ds 0: Now Theorem 6.3 implies that (W 1 (\Delta); W 2 (\Delta)) is an F t \GammaWiener process. An analogous argument using f in lieu of (2.16) and using (2.2) and the convergence properties of S N (\Delta) implies that W 3 (\Delta) is an F t \GammaWiener process. Since (W N 3 (\Delta) are independent, so are (W 1 (\Delta)); W 2 (\Delta)) and W 3 (\Delta). Hence W (\Delta) is an F t \GammaWiener process. If there is no control and the initial condition X(0) is fixed, then the subsequence is irrelevant by the uniqueness of the limit process. 3 The Control Problem on a Finite Time In- terval expectation, given the initial condition (x; z): Let k(\Delta) be a bounded and continuous function, c i ? 0 and, for T ? 0 and admissible controls (for the physical and limit systems, resp.), define the cost functions Z Tk(X N (s))ds Z Tu N (s)ds; (3:1a) Z Tu(s)ds; (3:2a) the infs are over the admissible controls for the various cases. Comment on the discounted cost. For fi ? 0, define the discounted costs Z 1e \Gammafis \Theta Z 1e \Gammafis [c 0 dU Then the next theorem continues to hold, with essentially the same proof. For small fi ? 0, the discounted cost is an alternative to the ergodic cost of Sections 4 and 5, and the proof is simpler, being essentially that of this section. The computed controls are close to those for the ergodic cost problem for small Theorem 3.1. For each x; z and T , Let q(\Delta) be a continuous real-value function which is continuous and non-increasing in x. Define the control u N as follows. It takes values 0 and - u, with u being the value if z \Gamma q(x) - 0 and 0 being the value otherwise. Then Optimality of and importance of controls such as u 0 (\Delta): The assertion concerning simply says that the control divides the (x; z)\Gammastate space into two regions, in which we either have no control or maximum control, and that the z \Gammaset on which control is exercised is non-decreasing as x increases and can increase only continuously. The optimal control for the limit ergodic cost problem takes this form, as it does for the discounted cost function. For the finite time cost problem, the shape is the same, but depends continuously on time. In fact, for the fluid case, where W 2 (\Delta) just a linear function of x. Otherwise, it is strictly concave and decreasing as x increases [14]. The convergence also holds if q(\Delta) has a finite number of discontinuities or if the control is of the threshold type, where there is a number x 0 such that control is exercised if and only if X N (t) - x 0 . The convergence (3.4) will obviously hold for more general controls than u 0 (\Delta). The theorem shows that, under heavy traffic, the costs for the physical system are nearly optimal when using an optimal or nearly optimal control for the limit system. The optimal switching surface for the multiclass case, where each class might have its own control, has a similar planar or piecewise planar boundary, and the analogous theorem holds. Proof. Given arbitrary ffl ? 0, let u N (\Delta) be an ffl\Gammaoptimal admissible control for the physical process. Select and work with a weakly convergent subsequence of (2.7a), with limit represented by (2.7b) and (2.8), with u(s)ds. Then, by the weak convergence proved in Theorem 2.1, (3.1a) converges in distribution to in (3.2a). Also, by the boundedness of the functions involved, the expectations of the last two terms in (3.1a) converge to the expectations of the analogous terms in (3.2a). Since the U N (T ) are not necessarily bounded uniformly in N for any T ? 0, in order to show that their expectations converge to that of the limit we need to prove that for each T ? 0 uniformly integrable. (3:5) Write (2.6) in the form where H N (0) 2 [0; B]: Then, by the definitions of the two reflection terms, it can be verified that where K N (t) equals the number of excursions of X N (\Delta) from 0 to B on the interval [0; t]; and L N (\Delta) satisfies an analogous expression. It can readily be verified using (2.4c), and the properties of the \Delta N A N (\Delta) and ~ Z N (\Delta), that for each sup s-T A proof nearly identical to that used for a related problem in [Section 4][22] shows that sup each integer k: (3:7b) Inequalities (3.6) and (3.7) imply (3.5). Since u N (\Delta) is an ffl\Gammaoptimal control for the physical system, Given (3.5), the weak convergence and Fatou's Lemma yield that (along the weakly convergent subsequence) lim inf imply that if N !1 along the selected weakly convergent subsequence then lim inf Since (3.10) holds for any weakly convergent subsequence, it holds simply if To prove the reverse inequality to (3.10), namely, lim sup fix arbitrary ffl ? 0 and use a "nice" ffl\Gammaoptimal control u ffl (\Delta) for the limit system which can also be "applied" to the physical system such that For the moment, suppose that there is such a control u ffl (\Delta) depending smoothly on the state and time (this will be true if W 1 (\Delta) +W 2 (\Delta) is not the zero process, and is probably true in general). Using the control u ffl (X N (\Delta); Z N (\Delta); \Delta) on the physical process and a weak convergence argument yields (3.12). The general case uses an appropriate "randomized" ffl\Gammaoptimal control law such that (3.12) holds. The construction of this control law is a special case of what was done in [13, Theorem 5.2, Chapter 10], and the details are omitted. 4 The Uncontrolled Ergodic Cost Problem In this section, we will be concerned with the average cost per unit time problem, when there is no control. It is notationally simpler to introduce the the basic techniques of proof for the uncontrolled case. The extension to the control problem, which uses essentially the same proof, is in the following section. The following result will be needed in Theorem 4.2. Keep in mind that W 2 (\Delta) +W 3 (\Delta) is the zero process only if the input (when the source is on) and transmitter processes are both "fluid." Theorem 4.1. If W 2 (\Delta) is not the zero process, then the uncontrolled process (X(\Delta); Z(\Delta)) is strong Feller, the transition function P (x; z; t; \Delta) is mutually absolutely continuous with respect to Lebesgue measure for each initial condition (x; z) and t ? 0, and there is a unique invariant measure which is mutually absolutely continuous with respect to Lebesgue measure. is the zero process, then there is also a unique invariant measure -(\Delta). -(\Delta) can have positive mass on the boundary In the interior, where (x; z) 2 (0; B) \Theta IR, it is mutually absolutely continuous with respect to Lebesgue measure. Proof. Let not be the zero process. Then the driving Wiener are mutually independent and non- degenerate. The strong Feller property, and the fact that the transition function \Delta) is absolutely continuous with respect to Lebesgue measure for each (x; z) is shown exactly as done for a related dynamical system in [4, Section 7]. In that paper all state variables were constrained to be positive and were not upper bounded, and a term such as Z(\Delta) did not appear in the X \Gammaequation. But the same argument works in an almost identical manner. The cited properties of the transition function imply that any invariant measure is mutually absolutely continuous with respect to Lebesgue measure on the state space, from which the uniqueness of the invariant measure follows. (\Delta) be the zero process. It is clear from the role of Z(\Delta) in the X \Gammaequation that P (x; z; t; \Delta) has positive mass on the boundaries. For the unconstrained problem, P (x; z; t; \Delta) has a density which is positive with respect to Lebesgue measure for each initial condition (the unconstrained process is "hypoelliptic"), and this property carries over to the reflected case in that the measure P (x; z; t; \Delta), when considered on (0; B) \Theta IR, is mutually absolutely continuous with respect to Lebesgue measure for each (x; z). These properties imply the uniqueness of the invariant measure. Stationary process. Consider a vector-valued non-anticipative process \Theta(\Delta) satisfying Z t~ u(s)ds where W (\Delta) is a Wiener process and ~ u(\Delta) is a non-anticipative control. The process is said to be stationary if the measure of the set (\Theta(t R does not depend on t. Use the obvious analog of the definition when some components of \Theta(\Delta) are "reflected." The cost function. Define the (uncontrolled case) cost functions Z Tk(X N (s))ds Z Tk(X(s))ds where k(\Delta) is bounded and continuous and c 0 ? 0: The proof of the following theorem is a little more complicated than necessary for the uncontrolled case. But the occupation measure method which is used also provides the proof for the controlled case, and is a powerful tool for convergence theorems when the cost functions are ergodic [17, 10]. By Theorem 4.2, the value fl 0 in (4.2) does not depend on the initial condition (x; z) and is the same as the cost Z 1k(X(s))ds for the stationary (X(\Delta); Z(\Delta)) process. Theorem 4.2. where fl 0 is the cost for the stationary limit process. The limit in (4.2) exists and does not depend on the initial condition. Furthermore, we have the pathwise convergenceT Z Tk(X N (s))ds in probability, as N !1 and T !1 in any (deterministic) way at all. Also, holds when the N is dropped. Comment The pathwise convergence is perhaps more important than the convergence of mean costs, since each realization in an application uses a single sample path. Proof. The proof uses a "functional occupation measure" argument, which also can be used for the control problem. The method will be outlined. Further details concerning the "weak convergence" issues are in [17] and [10, Chapter 5]. A simpler model problem. For the sake of expository and notational sim- plicity, the proof will be outlined for a one dimensions problem which has the same essential structure as our two dimensional problem. The simpler problem with which we will work will be defined next, and the assumptions stated. The convergence argument will work for any processes for which the analog of these assumptions hold, whatever the dimension. There need not be reflection terms, and the state space [0; B] to be used here for the one dimensional problem can be replaced by an unbounded set (which would be [0; B] \Theta IR in our original prob- lem). Analogous assumptions hold for the original system, and the proof holds for that case in a virtually unchanged way, except for the more complicated notation. We will consider the one dimensional problem defined by where X N (t) 2 [0; B] for all t, L N (\Delta) and U N (\Delta) are the reflection terms at the end points 0 and B, resp., and B N R tb(X N (s))ds for a bounded continuous function b(\Delta). Let F N t denote the smallest oe\Gammaalgebra which measures t being the expectation conditioned on F N t . Suppose that W N (\Delta) is an F N \Gammamartingale. Without loss of generality, we suppose that the processes are defined on the same sample space for all N so that we can use a generic sample space variable ! to index the paths for all N: Suppose that for each x such that X N (0) ) x, where where W (\Delta) is a Wiener process with covariance parameter oe 2 , X(t) 2 [0; B] for all t, L(\Delta) and U (\Delta) are the reflection terms, b(X(s))ds, and the limit processes are non-anticipative with respect to W (\Delta): Suppose that (4.7) has a unique weak sense solution for each initial condition x, and that it has a unique invariant measure. Assume, in addition, that U is uniformly integrable. (4:8a) Suppose that sup We will also use the following condition. For each real-valued function f(\Delta) on (\Gamma1; 1) which has compact support and which is continuous, together with its derivatives up to order three, and each real - 0, f ww (W N (s))ds in mean, uniformly in t - 0. Representation of the costs in terms of sample occupation measures. The path space for the processes in (4.6) is D 4 [0; 1), and we use for the canonical element of this space. We next write the pathwise cost on the left side of (4.5) in terms on an occupation measure. This representation is the key to the value of the approach. For any real-valued function f(\Delta) on [0; 1) and t - 0, define the shifted function f t the shifted and centered function \Delta t the processes With these definitions, we can write Z sb(X N Suppose that is tight and the weak sense limits satisfy (4.7) for some initial condition. Let M denote the space of measures on the Borel sets of D 4 [0; 1); with the topology used on M. In other words, mn (\Delta) ! m(\Delta) in M if and only if for each bounded and continuous real-valued function F (\Delta) on D 4 [0; 1), Z Z Define the occupation measures Q N;t (\Delta) and Q N T (\Delta) by Z TQ N;t (G)dt; where G is a Borel set in D 4 [0; 1): Note that Q N T (\Delta) is a measure-valued random i.e., it is random variable whose values are measures on the Borel sets of D 4 [0; 1). The role of these concepts will now be seen. The sample cost on the left side of (4.5) can be approximated in terms of (\Delta). We can writeT Z T\Theta [U Z T+1 Z 1U N (t)dt: Thus, by the uniform integrability condition (4.8a),T U N (T Z T\Theta where the mean value of the "small error" goes to zero as T !1 uniformly in N . Similarly, for s 2 [0; 1]; Z Z Tk(X N (t))dt \Gamma Z sk(X N (t))dt Z T+s where the small error goes to zero uniformly in ! as T !1: Thus, modulo an asymptotically negligible term, we can writeT Z Tk(X N (s))ds Z where To see (4.13), note that by the definitions Z Z T\Theta U dt; and use (4.12a). An analogous calculation is used for the other term in the cost. Note that K(\Delta), as a real-valued function on D 4 [0; 1), is not necessarily continuous. See the comments concerning continuous functions on D[0:1) in Section 6. But K(\Delta) is continuous at each point OE(\Delta) which is continuous. Hence it is continuous almost everywhere with respect to the measure induced by any limit quadruple satisfying the conditions on the processes in (4.7), since such process have continuous paths with probability one. It is seen from the representation (4.13) that the limits of the measure-valued random variables T (\Delta) determine the limits in (4.5), and so we now characterize the limits of Weak convergence of the sample occupation measures. Let Q N;! denote the sample values of the random variable Q denoting the associated expectation. Let Q N;t;! (\Delta) denote the sample values of Q N;t (\Delta). Recalling that Q N;t;! (\Delta) is the occupation measure induced by the processes in (4.9) at sample space point !, we see from the definition of Q N;! T (\Delta) as an integral divided by T , that Q N;! T (\Delta) is obtained from the Q N;t;! (\Delta); by a randomization procedure (randomizing over the time shift), where the probability that t 2 [a; b], 0 - a - b - T , is (b \Gamma a)=T: Thus, the process \Phi N induced by Q N;! T (\Delta) is just the sample process (4.9), but where the time shift t is chosen at random in [0; T ], as above. Let us examine the measure-valued random variables Q N more closely. It is shown in [17, remark below Theorem 5.4] and analogs of the proofs of Theorem 2.1 or 4.1 in [10] that the tightness of the set of processes f\Phi N;T (\Delta); N;Tg implies the tightness of the set fQ N T (\Delta); N;Tg of random measures. Let the measure-valued random variable Q(\Delta) denote a limit of a weakly convergent subsequence of fQ N to denote the sample values of Q(\Delta) on whatever probability space it is defined. Each sample value (\Delta) of Q(\Delta), being a probability measure on D 4 [0; 1), induces a random process \Phi ! 0 (\Delta)) with paths in D 4 [0; 1): Keep in mind that ! 0 denotes the sample value of the random measure, and that the sample value is a measure on D 4 [0; 1). Thus, we can index the random process which it induces by ! 0 as well. Thus, ! 0 does not denote a sample value of the random process, but the process itself. We now need to show that the process induced by any measure Q (\Delta) is (for almost all just the stationary process of the form in (4.7). Then the uniqueness of the measure of that stationary process (which is implied by the uniqueness of the invariant measure -(\Delta) and the weak sense uniqueness of the solution to (4.7) for each initial condition) will be used to complete the proof. The limit processes. The following observations will be needed. Let fY N (\Delta)g be sequence of processes which converges weakly to a process Y (\Delta) with paths in D 4 [0; 1): Suppose that on each finite interval, the maximum discontinuity of Y N (\Delta) goes to zero in probability as N !1: Then, as noted in Section 6, Y (\Delta) must have continuous paths with probability one. Conversely, weak convergence of fY N (\Delta)g to a continuous limit process implies that (on any finite interval) the maximum discontinuity of Y N (\Delta) goes to zero in probability as N !1. These observations, taken together with the "random" method of constructing each of the Q N;! T (\Delta) from the \Phi N t (\Delta), the assumed weak convergence (4.6), and the continuity of the limit processes, imply that (for almost all (\Delta) have continuous paths with (\Delta)\Gammaprobability one. Thus, without loss of generality, we can suppose that all the limit processes are continuous for all 0 . It will turn out that (\Delta) does not depend on ! 0 and that it is the measure of the stationary process (4.7). Until further notice, suppose that Q(\Delta) is a weak sense limit as and T !1: It will be seen below that the uniqueness of the invariant measure implies that the way that irrelevant. For C ? 0 and define the function where the subscript C refers to truncation at \SigmaC: Let F (\Delta) be a real-valued bounded and continuous (in the Skorohod topology) function on D 4 [0; 1): Then (by the fact that the weak topology is used on M, and with m(\Delta) being the canonical element of M) - R F (OE(\Delta))m(dOE(\Delta)) is a bounded and continuous function on M, and by the weak convergence F (Q N Z F (OE(\Delta))Q N Z Next, suppose that F (\Delta) is only continuous (\Delta)-almost everywhere for all ! 0 . Then ([2, Theorem 5.1]) the convergence (4.14) continues to hold. Thus (4.14) holds for FC (\Delta). This, the fact that the left side of (4.14) is zero for F and the arbitrariness of C, imply that (s))ds for each t with (\Delta)\Gammaprobability one, for almost all ! 0 . By the continuity of the limit processes, we can suppose that (4.15) holds for all t. The fact that (\Delta) and U ! 0 (\Delta) are reflection terms should be intuitively obvious; the few details of the proof are the same as those of Part 3 of the proof of [17, Theorem 6.3] and are omitted. The Wiener process property. We have to verify that W ! 0 (\Delta) is an F ! 0 \GammaWiener process, with variance parameter oe 2 , where F ! 0 t is the minimal oe\Gammaalgebra which measures We will use the martingale method of Theorem 6.3. Let f(\Delta), h(\Delta), t - 0; - the requirements of Theorem 6.3. We need to show that, for almost all ! 0 , \Theta f fww ds 0: By Theorem 6.3, this will imply both the non-anticipativity and the Wiener property. It will be shown that the expectation of the square of the left side of (4.16) is zero. The first step is to show that \Theta f fww dv But, by the definition of Q N;! T (\Delta), the measure with respect to which E N;! T is the expectation, the left side of (4.17) equalsT 2 Z Tds h \Theta f t+s fww dv Now, write the square of the integral in (4.18) as a double integral and use the condition (4.8c) to get that (4.18) goes to zero as this implies (4.17). Now define the function F (\Delta) on D 4 [0; 1) by and define - R F (OE(\Delta))m(dOE(\Delta)): As discussed below (4.14), we can suppose without loss of generality that F (\Delta) is continuous. Thus, by the weak convergence Q N we have the weak convergence - F (Q N and, F (Q N and the right side equals zero since the left side equals (4.17) which goes to zero. But this implies (4.16). Now, (4.16) and Theorem 6.3 yield the asserted Wiener and non-anticipativity properties. Stationarity of the limit processes \Phi ! 0 (\Delta) for almost all ! 0 . Finally, we need to show the stationarity of the limit processes \Phi ! 0 This stationarity (with the uniqueness of the stationary process) and the uniform integrability (4.8a) yields the assertion concerning the convergenceT in probability as any way at all, since the limit Q(\Delta) does not depend on the selected weakly convergent subsequence, and all of the samples of Q(\Delta) induce the stationary process of form (4.7). Let G be a Borel set in D 4 [0; 1): For c ? 0; define the "left shifted set" G c by G Gg. We have Z TI f\Phi N;t+c (\Delta)2Gg dt: Hence Z T+c I f\Phi N;t+c (\Delta)2Gg Z cI f\Phi N;t (\Delta)2Gg dt: Thus Q N;! for each !; c and G. Thus, we must have which implies that (for almost all the sample values of the limit measures induce stationary processes. An analogous (but much simpler, since there is no N ) argument works for the limits in (4.2), both with and without the expectation. 5 The Controlled Problem Define the cost functions for the limit system: Remarks. The theorems are divided into two cases. In the first, where W 3 (\Delta) is not the zero process, the system (2.8) is not degenerate and there are powerful methods in stochastic control for showing existence of smooth almost optimal controls, and other strong properties of the ergodic processes involved. Extensive numerical experience for the case where W 2 (\Delta) +W 3 (\Delta) is the zero process indicates that the same results are true. But the existence of a smooth ffl\Gammaoptimal feedback control for our problem has not been yet proved. The main technical difficulties stem from the fact that the noise and the control occur in different equations. Thus in this case, we assume that for each ffl ? 0, there is an ffl\Gammaoptimal feedback control, which is optimal with respect to all admissible controls, and under which the solution to (2.8) is weak sense unique for each initial condition. [There is a unique invariant measure under such controls.] This does not seem to be a strong condition. However, if even a small percentage of the sources are not fluid (i.e., they create cells according to a Poisson process for a small percentage of their on time, then we are in the nicer first (the non-degenerate) case. The numerical problem is very well behaved even in the degenerate case. See the discussion below the statement of Theorem 3.1 concerning the shape of the computed controls. In the "fluid" case, adding "artificial noise" to the X \Gammaequation makes for a more conservative control [14]; it acts over a larger region, and provides a lower bound to the performance. Theorem 5.1. Let W 2 (\Delta) +W 3 (\Delta) not be the zero process. Then - does not depend on (x; z): There is a state dependent feedback control which is optimal with respect to all non-anticipative controls. For each ffl ? 0, there is an ffl\Gammaoptimal control u(x; z) which is continuous, and under which the solution is weak sense unique for each initial condition, and there is a unique stationary measure. There is a unique stationary measure under a control of the form of u 0 (\Delta) in Theorem 3.1. Proof. The result is given in [9] for the unreflected problem, where the optimality is with respect to feedback controls. In the last section of [12], it is extended to optimality with respect to all non-anticipative controls. The problem with reflections is treated in a nearly identical manner, since the crucial ideas all involve only the strong Feller property and a Girsanov transformation method, and these remain valid with the reflections. The stability conditions needed in [9] all hold here by the boundedness of X(\Delta) and the stability of Z(\Delta): Theorem 5.2. Let W 2 (\Delta) +W 3 (\Delta) not be the zero process. Then, for any ffl ? 0 and admissible controls u N (\Delta), lim 0: (5:1) Let u ffl (\Delta) be ffl\Gammaoptimal feedback control for the ergodic cost problem for the limit process, which is either continuous or of the form of the u 0 (\Delta) in Theorem 3.1. Then lim 0: (5:2) The N and T can go to infinity in any way at all. Comment. The conclusions of the theorem are quite strong. It essentially says that, under heavy traffic, the pathwise average cost cannot be better than the optimal ergodic cost for the limit system, and the optimal cost can be nearly realized by the use of some nearly optimal control for the limit system. Proof. The details are very similar to those of Theorem 4.2 with the control terminology as in Theorem 3.1 used, and only some comments concerning the differences will be given. Let u N (\Delta) be admissible. In the terminology of Theorem 4.2, add another component \Delta t ff N (\Delta) to the vector of processes \Phi N;t (\Delta), add the component ff(\Delta) to the vector of processes \Phi(\Delta); and redefine Q N cordingly. The arguments of Theorem 4.2 yield the tightness of fQ N (\Delta)g. Let weakly convergent subsequence. There is a non- anticipative control u(\Delta) satisfying 0 - u(t) - u and such that the controlled limit equation (2.8) holds. As in Theorem 4.2, the limit process is stationary. Also C N (x; z; T; u N )=N will converge in probability to the stationary cost for the stationary limit process, as along the selected subse- quence. Since, for each ffl ? 0, there is a continuous ffl\Gammaoptimal (with respect to all admissible controls, hence with respect to u(\Delta)) feedback control for the limit system with stationary cost value - and the u N (\Delta) are arbitrary, the proof of Theorem 4.2 yields (5.1). Now apply u ffl (\Delta) to the physical process, and repeat the procedure of Theorem 4.2. This yields that C N converges in probability to fl(u ffl ); which yields (5.2). Theorem 5.3. Let W 2 (\Delta) be the zero process. Assume that for each there is a continuous feedback control u ffl (\Delta) for the limit process which is ffl\Gammaoptimal with respect to all admissible controls, and under which the solution to (2.8) is weak sense unique for each initial condition, or else that there is an ffl\Gammaoptimal control u ffl (\Delta) of the form of the u 0 (\Delta) in Theorem 3.1. Then the conclusions of Theorem 5.2 continue to hold. Proof. With the assumption concerning the existence of such an ffl\Gammaoptimal control, the proof is the same as that of Theorem 5.2 since there is a unique stationary process under u ffl (\Delta): 6 Comments on Weak Convergence A few of the basic definitions and tools from weak convergence theory that are needed in the paper will be given. 1g be a sequence of random variables with values in a complete and separable metric space S. We say that converges weakly to a random variable Y and write Yn ) Y , if for each continuous and bounded real-valued function F (\Delta) on S we have EF (Y n be real-valued, bounded, measurable, and continuous only almost everywhere with respect to the measure of Y . Then [2, Theorem 5.1] EF (Y n The sequence fYn is said to be tight if for each ffi ? 0 there is a compact set K ffi ae S such that PfYn 62 K ffi Tightness implies the existence of a weakly convergent subsequence [3, p104]. Let D r [0; 1) denote the space of R r \Gammavalued functions on the interval [0; 1) which are right continuous and have left hand limits (and are continuous at simply D[0; 1). The Skorohod topology [2, 3] is used, with which D[0; 1) can be considered to be a complete and separable metric space. We note that if a sequence fOE n (\Delta)g in D[0; 1) converges to a continuous function OE(\Delta) in this topology, then the convergence is uniform on each bounded time interval. Let OE(\Delta) denote the canonical point in D[0; 1), and the function F (\Delta) defined by F OE(t) is not necessarily continuous in the Skorohod topology. But it is continuous at each point OE(\Delta) which is continuous at t. The following criterion for tightness is very useful for our needs. Theorem 6.1. [8, Theorem 2.7b], [3, Theorem 8.6, Chapter 3]. Let fAn (\Delta)g be a sequence of processes which have paths in D[0; 1). Suppose that for each each t in a dense set in [0; 1); there is a compact set K ffi;t in IR such that and that for each positive T , lim lim sup sup -T sup where - is a stopping time. Then fAn (\Delta)g is tight in D[0; 1). Verifying That a Process Is a Martingale. A convenient criterion for showing that a process is a martingale is needed, and a useful approach is suggested by the definition of a martingale in terms of conditional expectations. Theorem 6.2. Let U (\Delta) be a random process with paths in D r [0; 1), and where U (t) is measurable on the oe\Gammaalgebra F V t determined by fV (s); s - tg for some given process V (\Delta) and let EjU (t)j ! 1 for each t. Suppose that for each real each integer k and each set of real numbers t i - t, and each bounded and continuous real-valued function h(\Delta), Then U (t) is an F V \Gammamartingale. The Wiener Process. Let the IR r \Gammavalued process W (\Delta) have continuous paths and satisfy W be a sequence of nondecreasing oe\Gammaalgebras such that W (t) is F t \Gammameasurable and let EF t [W with probability one for each t and each s - 0: Thus, W (\Delta) is an F t \Gammamartingale. Let there be a nonnegative definite matrix \Sigma such that for each t and each s - 0 Then W (\Delta) is a vector-valued Wiener process with covariance \Sigma, and it is also called an F t \Gamma Wiener process [21, Volume 1, Theorem 4.1]. If W (\Delta) is an \Gammamartingale and a Wiener process with respect to any nondecreasing sequence of oe\Gammaalgebras, then it is an F t \GammaWiener process. The criterion of Theorem 6.2 for verifying that a process is a martingale can be adapted to verify that it is a vector-valued F t \Gamma Wiener process for appropriate Suppose that W (\Delta) is a continuous vector-valued process with each t. Let V (\Delta) be a random process and let F V t be the smallest oe\Gammaalgebra which measures fV (s); W be arbitrary but satisfy the conditions put on these quantities in Theorem 6.2. Suppose that and that there is a nonnegative definite matrix \Sigma such that \Theta \Theta 0: (6:5) Then W (\Delta) is an F V process, with covariance parameter \Sigma. Proving that (6.4) holds in applications when W (\Delta) is the weak sense limit of a sequence of martingales fW n (\Delta)g is usually not too hard. But the proof of might require showing that fjW n (t)j 2 g is uniformly integrable for each t. This can be avoided by using the following equivalent characterization. Theorem 6.3. [24] Let f(\Delta) be an arbitrary continuous real-valued function on IR r which has compact support and whose mixed partial derivatives up to order three are continuous and bounded. Let V (\Delta) be a random process. Let the IR r \Gammavalued process W (\Delta) have continuous paths with probability one, and a nonnegative definite symmetric matrix. Suppose that for each real each integer k and each set of real numbers t i - t; and each bounded and continuous real-valued function h(\Delta), Z t+- Then W (\Delta) is an F V \GammaWiener process with covariance parameter \Sigma, where F V is the smallest oe\Gammaalgebra which measures fV (s); W (s); s - tg. --R Stochastic theory of a data handling system with multiple sources. Convergence of Probability Measures. Markov Processes: Characterization and Con- vergence Brownian models of open queueing networks with homogeneous customer populations. Multiple channel queues in heavy traffic. Codes for optimal stochastic control: documentation and users guide. Heavy traffic analysis of a data handling system with multiple sources. Approximation of Population Processes Optimality conditions for the average cost per unit time problem with a diffusion model. Weak Convergence Methods and Singularly Perturbed Stochastic Control and Filtering Problems Analysis of controlled multiplexing systems via numerical stochastic control techniques. Control of trunk line systems in heavy traffic. Numerical Methods for Stochastic Control Problems in Continuous Time. Controlled and optimally controlled multiplexing systems: A numerical exploration. Numerical methods for stochastic singular control problems. Heavy traffic analysis of a data transmission system with many independent sources. Limit theorems for pathwise average cost per unit time problems for queues in heavy traffic. Numerical methods for controlled and uncontrolled multiplexing and queueing systems. Heavy traffic analysis of a controlled multi class queueing network via weak convergence theory. Optimal and approximately optimal control policies for queues in heavy traffic. Statistics of Random Processes. Routing and singular control for queueing networks in heavy traffic. Open queueing networks in heavy traffic. Multidimensional Diffusion Processes. --TR
multiplexing systems;ergodic cost problem;controlled multiplexing;heavy traffic
598060
Moderate deviations for queues in critical loading.
We establish logarithmic asymptotics of moderate deviations for queue-length and waiting-time processes in single server queues and open queueing networks in critical loading. Our results complement earlier diffusion approximation results.
Introduction This paper complements the classical results on heavy-traffic approximation for queues in Kingman [7], Prohorov [12], Iglehart and Whitt [5], Borovkov [1], and Reiman [19] by studying some related large-deviation asymptotics. In a standard set-up, one considers a sequence of GI=GI=1 queues indexed by n with associated loads ae n ! 1 as n !1 so that and establishes convergence in distribution of suitably time-scaled and normalized queue-related processes to processes of diffusion type; say, the processes (n \Gamma1=2 W n (nt); t - denotes the unfinished work (or virtual waiting time) in the n th system at time t , converge in distribution in the Skorohod J 1 topology to a reflected Brownian motion with drift [5]. The limits when j are different: in the context of the unfinished work again, if then the n \Gamma1=2 W n (nt) converge to 0 in probability, and if p a proper limit have the processes . Our focus here is on large deviation asymptotics for the latter case: j specifically, we assume that, for some b n !1 with b n) , we have thatb n and study the logarithmic asymptotics of the large deviations of processes like (b \Gamma1 In Wentzell's classification of large deviations, Wentzell [23], this is the case of "moderate deviations" since the choice b specifies "normal deviations", and b large deviations". From an application viewpoint, we are concerned with the queue behaviour at times much greater than (1 \Gamma ae) \Gamma2 for ae close to 1 while the standard heavy-traffic results refer to time intervals of order (1 \Gamma ae) \Gamma2 . Accordingly, to distinguish from standard heavy traffic, we refer to the regime specified by condition (1.2) as near-heavy traffic. We now give an outline of the paper and a summary of the results. Section 2 contains technical preliminaries. In Section 3 we consider FIFO single server queues in near-heavy traffic. Section 4 extends the results to the case of FIFO open queueing networks with homogeneous customer population. The results mostly have the form of large deviation principles (LDPs) in the spaces of right-continuous functions with left limits equipped with one of Skorohod's topologies, Skorohod [21], for such processes as the processes of queue length, unfinished work, completed work, waiting times, the number of departures, and departure times. Occasionally, we give LDPs for one-dimensional projections. The rate functions that we obtain are quadratic in form and reminiscent of the distributions of the diffusion processes arising in the corresponding heavy-traffic limit theo- rems. Moreover, the ideas of the proofs are either borrowed from the proofs of the corresponding convergence results or could be used to give them alternative proofs. So, in a sense, the paper is another evidence of the analogy between large deviation theory and weak convergence theory, Puhalskii [13]-[16]. 2. Technical Preliminaries We shall work in the function space D(R d of right-continuous R d -valued functions on [0; 1) with left limits, endowed with the Skorohod [21] J 1 or M 1 topologies, or a modification of the M 1 topology denoted by M 0 1 , we refer to [8], [11], [24], [9], [17] for details. These spaces are metrizable as separable metric spaces and have Borel oe-fields coinciding with the oe-field generated by the coordinate projections. For we denote by x(t\Gamma) the left limit at t and by \Deltax(t) , the jump at As in Varadhan [22], we say that a function I(x) defined on a metric space S and taking values in [0; 1] is a rate function if the sets fx ag are compact for all a - 0, and a sequence probability measures on the Borel oe-field of S (or a sequence of random elements with values in S and distributions P n ) obeys a large deviation principle (LDP) for a normalizing sequence a n !1 with the rate function I if lim log for all closed F ae S, and lim log for all open G ae S. The standard choice of the normalizing sequence is a We mention that an LDP can always be reduced to this standard form by reparametrizing the family fP [22], however allowing a general normalizing sequence seems more convenient in applications. We refer to [20], [22] and [17] for additional background. We say that a sequence fX n ; n - 1g of random elements of a metric space (S; ae) converges super-exponentially in probability at rate a n to an element x 0 2 S if, for all ffl ? 0, lim and we write X n 1=an This mode of convergence plays a role in large deviations similar to the role convergence in probability plays in weak convergence. Properties of super-exponential convergence in probability that we invoke below can be found in Puhalskii and Whitt [17]. Here we just mention that if (2.3) holds for with one of the topologies J 1 , M 1 or M 0and x 0 is a continuous function starting at 0 , then it also holds for the locally uniform metric on D(R d ) , [17, Lemma 4.2(a)]. The following easy consequence of the contraction principle [22] comes in handy below. Lemma 2.1. Let X n , Y n and Z n be random variables with values in metric spaces SX , S Y and SZ , respectively, and let S j SX \Theta S Y \Theta SZ be endowed with product topology. Assume that the sequence f(X obeys an LDP in S for a normalizing sequence a n with rate function I X;Y;Z (x; y; z) which is finite only if Y is a bijection. Then the sequences with the respective rate functions I X;Z and I Y;Z given by the equalities I X;Z (x; I Y;Z (y; When dealing with an LDP for stationary waiting times, we will use the following version of Lemma 4.1 in Puhalskii [15]. Lemma 2.2. Let fP n ; n - 1g be a sequence of probability measures on R and I be a rate function on R . If the bounds (2.1) and (2.2) hold for the sets obeys an LDP with the rate function I . The proof follows by Lemma 4.1 in [15]. The next easy lemma is a consequence of the extended contraction principle [17] and continuity of the supremum map, Whitt [24, Theorems 6.2 and 6.3], the latter theorems carrying over to the 0topology (see the argument of the proof of Theorem 5.1 in [17] for more detail). Lemma 2.3. Let X with paths from D(R d ) . If the sequence obeys an LDP in D(R d ) for one of the topologies J 1 , M 1 or M 0 1 and normalizing sequence a n with rate function I X (x) , which equals infinity at elements of D(R d ) that are either discontinuous or not equal to 0 at 0 , then, for every " ? 0 and t ? 0 , lim 0-s-t Rate functions in the limit theorems below are generally defined in terms of solutions to Skorohod problems with skew reflection [4, 19, 3]. We now recall the relevant definitions. Let be a K \Theta K matrix with nonnegative entries and spectral radius less than unity. Denote by P T the transpose of P and let R P denote the map from D(R K ) into D(R K ) associating to each that 1. 2. y is componentwise nondecreasing with y k 3. z k (t) - 0 and The map R P is well defined and Lipshitz continuous for the locally uniform metric on D(R K ) , Harrison and Reiman [4], Reiman [19], Mandelbaum [10], Chen and Mandelbaum [2]. In the one-dimensional case the reflection map, which we then denote R , has the explicit The following characterization of skew reflection is in the spirit of Lemma 3.1 in [18] and Lemma 4.6 in [15], and is proved by the same argument. Lemma 2.4. Let z 2 D(R K ) be componentwise nonnegative and x 2 D(R K ) be componentwise absolutely continuous. Then z only if z is absolutely continuous, and there exists an absolutely continuous function y 2 D(R K ) with the properties and Thus - a.e. solves a linear complementarity problem [10, 2]. 3. Moderate Deviations for Single Server Queues in Near-Heavy Traffic We consider a sequence of FIFO single server queues indexed by n . We assume that the queues are initially empty. Let A n (t) denote the number of arrivals by t , S n (t); the number of customers served for the first t units of the server's busy time, D n (t) , the number of departures by t , Q n (t) , the queue length at t , W n (t) , the unfinished work at t , C n (t) , the completed work at t , H n (k) , the waiting time of the k th customer, and L n (k) , the departure time of the k th customer. Let also be the cumulative service time of the first k customers. Denoting by ffi the composition map, we have the following obvious equalities positive numbers. We define the associated normalized and time-scaled processes by (D We assume that - and the near-heavy traffic condition Note that (3.15) implies that - . The next theorem parallels the results of Iglehart and Whitt [5], on the one hand, and Theorems 3.1 and 4.1 in Puhalskii and Whitt [18], on the other hand. Let us denote Theorem 3.1. (a) Assume that obeys an LDP in D(R 2 ) for one of the topologies J 1 , M 1 or M 0and normalizing sequence b 2 n with rate function I A;S (a; s). Then f(Q obeys an LDP in D(R 3 ) for the same topology and normalizing sequence b 2 n with rate function I Q;D;C (q; d; c) = inf I (b) Assume that obeys an LDP in D(R 2 ) for one of the topologies J 1 , M 1 or 1 and normalizing sequence b 2 n with rate function I A;V (a; v). Then f(W obeys an LDP in D(R 2 ) for the same topology and normalizing sequence b 2 n with rate function I W;C (w; c) = inf I A;V (a; v) : (c) Assume that obeys an LDP in D(R 2 ) for one of the topologies J 1 or M 0and normalizing sequence b 2 n with rate function I A;S (a; s), which, in the case of the J 1 topology, is infinite when s is either discontinuous or not equal to 0 at 0 . Then f(Q obeys an LDP in D(R 4 ) for the same topology and normalizing sequence b 2 n with rate function I Q;D;W;C (q; d; w; c) = inf I (d) Assume that obeys an LDP in D(R 2 ) for one of the topologies J normalizing sequence b 2 n with rate function I A;S (a; s), which is infinite when either a or s is either discontinuous or not equal to 0 at 0 . Then the sequence f(Q 1g obeys an LDP in D(R 6 ) for the J 1 topology and normalizing sequence b 2 n with rate function I Q;D;W;C;H;L (q; d; w; c; h; I Q;D;W;C;H;L (q; d; w; c; h; Proof. We begin with a proof of (a). By (3.4), (3.5), (3.3), (3.11), (3.6) and (3.7), where Since Q n (t) is nonnegative and ds increases only when Q from (3.16) that the process (Q n (t); t - 0) is the Skorohod reflection of the process and, by (3.18), By the Lipshitz property of the reflection in the locally uniform metric, we have, for some K(t) ? 0 , The LDP for imply that lim lim 1=an sup with a . Hence, by (3.22) and (3.18), since p ds P 1=an so by (3.19) and Lemma 3.1 in [14], (for the locally uniform metric on D(R) ) C 0 1=an e, and an obvious extension of Lemma 4.3 in [17] implies by the LDP for that the sequence obeys an LDP with I A;S . The required now follows by (3.20), (3.17), (3.21), continuity of the reflection, the near-heavy traffic condition (3.15), and the contraction principle. The argument for parts (b) and (c) is similar. For (b), write by (3.2), (3.3), (3.6), (3.8), (3.10), and (3.12), where A 0 note that the LDP for fA implies by [17, Lemma 4.2(b)] that 1=an -e: (3.24) Part (c) follows by combining the preceding arguments if one notes that by (3.1) and Theorem 5.4 in [17] the assumptions imply that the sequence obeys an LDP in D(R 3 ) for one of the topologies J 1 or M 0 1 and normalizing sequence b 2 n with rate function I A;S;V (a; s; I A;S (a; s), when We now prove (d). Since the rate function I A;S (a; s) equals infinity at elements of D(R 2 ) that are either discontinuous or not equal to 0 at 0 , the extended contraction principle [17] implies that under the assumptions obeys an LDP in D(R 2 ) for the J 1 topology with the rate function I A;S (a; s). Let and U 0 By (3.24) and Lemma 4.2(c) in [17], 1=an e: (3.26) Noting also that L n we conclude by Lemma 4.3 and Theorem 5.4 in [17], and part (c) of the theorem we are proving that f(Q obeys an LDP in D(R 6 ) for the J 1 topology with rate function I 0 (q; d; w; c; h; when We now prove that 1=an which will conclude the proof by Lemma 4.1(c) in [17]. Since W n (U 0 we have that sup Since I A;S (a; s) equals infinity when either one of the arguments is either a discontinuous function or not equal to 0 at 0 , part (c) of the theorem implies that fW n ; n - 1g obeys an LDP in D(R) for the J 1 topology with rate function which equals infinity both at discontinuous functions from D(R) and functions not equal to 0 at 0 so that by Lemma 2.3, for t ? 0 , sup 0-s-t as n !1 . Putting together (3.26), (3.28) and (3.29) proves (3.27). The theorem is proved. Remark 3.1. Let I n (t) denote the cumulative server's idle time at t , i.e., I n 0)ds , and I n n) . Since obviously I n (see (3.18)), the theorem provides an LDP for fI n ; n - 1g as well. Remark 3.2. Parts (c) and (d) show that under the hypotheses "Little's law'' holds: if the rate function is finite, then sufficient statistic" in the sense of Lemma 2.1. We now consider the case of quadratic rate functions typical of LDPs for partial sums of triangular arrays of i.i.d. sequences (see Lemma 6.1 of [17] or [14, Example 7.2]) or partial sums of interarrival times in superpositions of renewal processes (see Theorem 7.2 of [17]). We adopt the convention e.g., the rate function I A (a) below, in the case if oe when Theorem 3.2. Let condition (3.15) hold. Assume that obeys an LDP in D(R 2 ) for the J 1 topology and normalizing sequence b 2 n with rate function I A;S (a; where I A (a) A Z 1- for absolutely continuous functions a with I S Z 1- for absolutely continuous functions s with otherwise. Then the following holds. (a) The sequence f(Q obeys an LDP in D(R 3 ) for the J 1 topology and normalizing sequence b 2 n with rate function I Q;D;C (q; d; c) = A dt A dt; when q, d and c are absolutely continuous with is nonpositive and nonincreasing, - a.e. on the set q(t) ? 0 , and I Q;D;C (q; d; otherwise. (b) The sequence f(Q n ; D n ); n - 1g obeys an LDP in D(R 2 ) for the J 1 topology and normalizing sequence b 2 n with rate function I Q;D (q; d) = A dt A dt; when q and d are absolutely continuous with nonnegative, and I Q;D (q; d) (c) The sequence f(Q obeys an LDP in D(R 2 ) for the J 1 topology and normalizing sequence b 2 n with rate function I Q;C (q; c) =2(oe 2 when q and c are absolutely continuous with nonnegative, c is nonpositive and nonincreasing, - a.e. on the set q(t) ? 0 , and I Q;C (q; (d) The sequence fQ n ; n - 1g obeys an LDP in D(R) for the J 1 topology and normalizing sequence n with rate function I when q is nonnegative and absolutely continuous with (e) The sequence fC n ; n - 1g obeys an LDP in D(R) for the J 1 topology and normalizing sequence n with rate function I C which is as follows. Let ess sup ft 0g. I C (c) =2(oe 2 Z 1(- when c is absolutely continuous, otherwise. If r - 0, then I C Z k(c)(- when c is absolutely continuous, Proof. An application of Theorem 3.1(a), Lemma 2.4 (or Lemma 3.1 in [18]) and Lemma 3.3 in [15] yields the rate function of part (a). The rate functions in (b)-(e) follow by the contraction principle. In particular, in part (e) it can be proved in analogy with the proof of Theorem 5.1(b) in [18] that inf q I Q;C (q; c) is attained at Remark 3.3. Let nt where U n (k) is defined by (3.25) and U n By (3.1) and an easy extension of Theorem 5.4 in [17] to the multidimensional case, the assumed LDP for only if the sequence obeys an LDP in D(R 2 ) for the J 1 topology and normalizing sequence b 2 n with rate function I I U (u) =2oe 2 U Z 1- for u absolutely continuous with I Z 1- for v absolutely continuous with A =- 3 and More specifically, for a GI=GI=1 queue, i.e., when A n and S n are renewal processes, let us denote by u n the generic interarrival time and by v n the generic service time. Then the LDP for Var and either one of the following conditions is met: log n=b n !1; This follows by Lemma 6.1 and Theorem 5.4 in [17]. Remark 3.4. It is interesting to compare I C with the rate function for the arrived work. Since under the conditions of the theorem obeys an LDP with rate function I easily follows that the processes ((V n ffi A n (nt) \Gamma nt)=(b n obey an LDP in D(R) for the J 1 topology and normalizing sequence b 2 n with rate function Z 1(- when x is absolutely continuous, the rate functions look similarly. Lemma 2.1 and part (d) of Theorem 3.1 allow us to obtain LDPs for the other processes. For instance, we have the next result. Corollary 3.1. Under the conditions of Theorem 3.2, the following holds. (a) The sequence fW n ; n - 1g obeys an LDP in D(R) for the J 1 topology and normalizing sequence b 2 n with rate function I W (w) =2(oe 2 when w is nonnegative and absolutely continuous with (b) The sequence fH n ; n - 1g obeys an LDP in D(R) for the J 1 topology and normalizing sequence b 2 n with rate function I H when h is nonnegative and absolutely continuous with Proof. For the proof, it suffices to observe that, by part (d) of Theorem 3.1 and Lemma 2.1, I W We can also project even more to get LDPs for one-dimensional distributions. To illustrate, we give two examples. Denote r Corollary 3.2. Let the conditions of Theorem 3.2 hold. Then (a) the sequence fH n (t); n - 1g for t - 0 obeys an LDP in R+ for normalizing sequence b 2 n with rate function I H(t) (b) the sequence fC n (t); n - 1g for t - 0 obeys an LDP in R \Gamma for normalizing sequence b 2 n with rate function I C(t) \Gammaz \Gamma2-rz r Remark 3.5. Note that in "the ergodic case" r ! 0 , the rate function for fC n (t); n - 1g is the same as for the arrived work f(V n ffi A n which follows by Remark 3.4. Remark 3.6. We do not know an explicit expression for I D and I L . We end the section by showing, analogously to diffusion approximation results, that the LDPs for the processes of waiting and departure times can be established directly without invoking LDPs for continuous-time processes, and that for the ergodic GI=GI=1 queue an LDP holds for stationary waiting times as well (cf. Prohorov [12]). Let us denote by u between the i th and th arrivals and by v n;i the service time of the i th customer in the n th system. The associated partial-sum processes U 0 are given by so that, as above, V n (k) is the cumulative service time of the first k customers. The obvious equations for waiting and departure times are Let ~ Recall that if the n th queue is a GI=GI=1 queue with - then the waiting times H n (k) converge in distribution as k ! 1 to a proper random variable (see, e.g., Borovkov [1]). We denote the latter by H 0 n and let H 0 n) . Theorem 3.3. Let (3.15) hold. (a) Assume that f( ~ obeys an LDP in D(R 2 ) for one of the topologies J 1 , M 1 or M 0and normalizing sequence b 2 n with rate function I U;V (u; v). obeys an LDP in D(R) for the same topology and normalizing sequence b 2 n with rate function I H I U;V (u; v) : If, in addition, I U;V (u; v) is infinite when v is either discontinuous or not equal to 0 at 0 , then obeys an LDP in D(R 2 ) for the same topology and normalizing sequence b 2 n with rate function I H;L (h; I A;V (a; v) : (b) Consider a sequence of GI=GI=1 queues for which the conditions of Remark 3.3 hold. Assume that r ! 0 . Then the sequence fH 0 obeys an LDP in R+ for the normalizing sequence n with rate function I H Proof. We begin with part (a). For the part related to H n , we use that by (2.4), (3.33), (3.35), (3.8), and (3.13) e For the second claim, we use that by (3.34), (3.35), (3.14), (3.13), and (3.8) the fact that by the hypotheses and Lemma 2.3 sup s-t v n;bnsc+1 =(b n n) P 1=an in [17]. We now prove part (b). The argument is borrowed from the corresponding proofs of diffusion approximation results [12]. Since H 0 n is distributed as sup k-0 (V n we have, for a Borel subset A of R+ , sup coincides in distribution with H n (bntc by Corollary 3.2(a) obeys an LDP with the rate function I H(t) (z) for which lim t!1 inf z2A I H(t) Lemma 2.2 implies that the required would follow by lim lim where, as above, a n . Denoting we have, since 1-k-2 l 1-k-2 l Limit (3.36) now follows by Lemma A.1 in the appendix and the near-heavy traffic condition bn . The theorem is proved. 4. Moderate Deviations for Queueing Networks in Near-Heavy Traffic We now extend some of the above results to the queueing-networks set-up. Our results here are in the spirit of Reiman [19]. We consider a sequence of networks indexed by n. The nth network has a homogeneous customer population and consists of K FIFO single server stations. The network is open in that customers arrive from outside and eventually leave. Let A n;k the cumulative number of customers who arrived at station k from outside the network during the interval [0; t], and let S n;k denote the cumulative number of customers who are served at station k for the first t units of busy time of that station. We call A where A the arrival process and service process respectively (note that some of the entries in A n may equal zero). We associate with the stations of the network the processes \Phi where \Phi denotes the cumulative number of customers among the first m customers who depart station k that go directly to station l. The process is referred to as the routing process. We consider the processes A n;k , S n;k and \Phi n;k as random elements of the respective Skorohod spaces D(R), D(R) and D(R K ); accordingly, A n , S n and \Phi n are regarded to be random elements of D(R K ), respectively. We next introduce normalized and time-scaled versions of the arrival process, service process and routing process. Let - n;k - 0; - n;k - 0; and p kl 2 [0; 1], A n;k nt nt nt where as above b n !1 and b Again the latter processes are considered as random elements of D(R K ), we denote - The first two vectors as well as other elements of R K are regarded to be column-vectors. In analogy with the hypotheses of Section 3, we assume that - positive, and that the near-heavy traffic condition holds: for some r 2 R K , in particular, denotes taking the transpose of either a matrix or a vector.) We also assume that the spectral radius of the matrix P is less than unity. Our main concern here is the queue-length process Q denoting the number of customers at station k at time t. Other related processes can be treated analogously to Section 3. The associated normalized and time-scaled process defined by We fix some notation. If x 2 D(R K ) has componentwise nondecreasing nonnegative paths, accordingly, if . For a vector 0). For a subset J of f1; we set F denotes the K -vector with entries from J equal to 1 and the rest of the entries equal to 0 ; J c denotes the complement of J . We also denote: R 0 is the interior of R+ , 1 is the K -vector with all the components equal to 1 , K is the set of all the subsets of f1; excluding the empty set. For vectors Theorem 4.1. Let Q n;k and the near-heavy traffic condition (4.2) hold. (a) Assume that the sequence obeys an LDP in D(R K \Theta R K \Theta R K \ThetaK ) for one of the J 1 , M 1 or M 0 1 topologies and normalizing sequence b 2 n with rate function I A;S;\Phi (a; s; OE). Then obeys an LDP in D(R K ) for the same topology and normalizing sequence b 2 with rate function I I A;S;\Phi (a; s; OE) : (b) Assume, in addition, that I A;S;\Phi has the following form: for I A;S;\Phi (a; s; I A k (a k I I \Phi k (OE k ); where I A k (a k ) =2oe 2 a;k Z 1- a k (t) 2 dt for a k absolutely continuous with a k I S k Z 1- for s k absolutely continuous with s k I \Phi k Z 1sup dt; for absolutely continuous with OE kl are symmetric nonnegative-definite K \Theta K matrices. Assume that the symmetric nonnegative-definite K \Theta K matrix \Gamma defined by is positive definite. Then obeys an LDP in D(R K ) for the J 1 topology and normalizing sequence b 2 with rate function I J2K2 dt; when q is absolutely continuous with (c) Assume that the processes A n;k are mutually independent for each n. Assume that the processes A n;k and S n;k are renewal processes and let u n;k denote the generic exogenous interarrival time and - n;k , the generic service time, for station k . Let the stations be indexed so that, for some K 0 and either one of the following conditions be met: log n=b n !1; If, in addition, the routing mechanism does not depend on n and is i.i.d. at each station with p kl being the probability of going directly from station k to station l, then the conditions of part (b) hold with u;k \Gammap kl p km Also I \Phi k (OE k ) =2 OE kl (t) dt +2 Z 1- for absolutely continuous with OE kl Remark 4.1. If the matrix \Gamma is degenerate, then the LDP in part (b) holds with the same rate function I Q provided in its definition expressions of the form 1x are understood as sup -2R k(- Remark 4.2. In the expression for I \Phi k in part c) we again keep to the convention that, e.g., if I \Phi k Z 1- for absolutely continuous with OE kl I \Phi k (OE k Proof of Theorem 4.1. The proof is a straightforward extension of the proof of Theorem 3.1 (cf., a similar argument in the proofs of corresponding weak convergence results in [19, 3]). In analogy with (3.4), (3.5) and (3.3), we have that for 1 - k - K where ds Introducing we then have by (4.1) and (4.4) that n;l (t) Z t1(Q n;k ds \Gamma Z t1(Q n;l ds which implies that and hence . The Lipshitz property of R P , the LDP for (4.2), and the fact that I \Gamma P T is nonsingular yield by the argument of the proof of (3.23), since - is componentwise positive, Z t1(Q n;k ds P 1=an where again a implying that 1=an e as Then by Lemma 4.2(b) in [17] after which Lemma 4.3 in [17] enables us to conclude that the sequence 1g obeys an LDP in D(R K \Theta R K \Theta R K \ThetaK ) with rate function I A;S;\Phi given by the equality I A;S;\Phi (a; s; OE OE). The claim of part (a) follows by (4.6) and the contraction principle. Part (b) is a consequence of part (a) and Lemma 2.4. In more detail, we have by part (a), Lemma 3.3 in [15] and Lemma 2.4 I (a;s;OE)2D(R K \ThetaR K \ThetaR K \ThetaK I A k (a k I I \Phi k (OE k ) Z 1inf (ff;fi;/;fl)2R K \ThetaR K \ThetaR K \ThetaK \ThetaR K a;k dt: By mean squares, the infimum in the integral over ff; fi and / , for fl fixed, equals ( - This completes the proof of (b) . The conditions of (c) imply the conditions of (b) by Lemma 6.1 in [17]. The expression for I \Phi k in part (c) follows by the fact that if then the matrix \Sigma \Phi;k is nondegenerate with \Phi;k and sup \Phi;k The theorem is proved. Remark 4.3. Note that the matrix \Gamma in part (c) coincides with the covariance matrix in Reiman's result [19]. Remark 4.4. The rate function in part (b) is not as explicit as in Theorem 3.2 in that on the we need to solve quadratic programming problems. It appears that generally this has to be done numerically. Remark 4.5. The contraction principle allows us to deduce that under the conditions of the theorem one-dimensional projections also obey LDPs. An open question is deriving explicitly the rate functions as in Corollary 3.2. It is not difficult to see that the optimal paths q must be piecewise linear. However, we can solve explicitly only the case and Scherbakov [6]). We now apply Theorem 4.1 to obtain LDPs for waiting and sojourn times (cf., Reiman [19]). denote the virtual waiting time at station k at time t . Define n) and let W . Next, for a vector denote the number of customers with the routing exogenously arrived by t , Y n;k (m) denote the sojourn time of the th exogenous customer with the routing n) , Corollary 4.1. (a). Assume that the sequence obeys an LDP in D(R K \Theta R K \Theta R K \ThetaK ) for one of the J 1 or M 0 1 topologies and normalizing sequence b 2 n with rate function I A;S;\Phi (a; s; OE), which, in the case of the J 1 topology, equals infinity unless s is continuous and equal to 0 at 0 . Then the sequence f(Q n ; W n obeys an LDP in D(R K \Theta R K ) for the same topology and normalizing sequence b 2 n with rate function I Q;W (q; -\Omega w , and I Q;W (q; In particular, the sequence fW n ; n - 1g obeys an LDP in D(R K ) with rate function I W (-\Omega w) . (b). Assume, in addition, that the rate function I A;S;\Phi (a; s; OE) equals infinity unless a; s and OE are both continuous and equal to 0 at 0 , and 1=an as Then the sequence f(W obeys an LDP in D(R K \Theta R) for the J 1 topology and normalizing sequence b 2 n with rate function I W;Y (w; and I W;Y (w; In particular, the sequence fY n;k 1g obeys an LDP in D(R) for the J 1 topology and normalizing sequence b 2 n with rate function I Y k I W (w) . Proof. The proof is much similar to that of Theorem 4.1. We only give a sketch. Let V n;k (m) , denote the cumulative service time of the first m customers served at station denote the total number of arrivals to station k by time Introducing V n;k we have, in analogy with (4.5), In analogy with (4.8) and in view of (4.3), Lemma 4.2(b) in [17] implies that 1=an -e: (4.10) Therefore, recalling (4.6), (4.8) and (4.7), we have that the sequence 1g obeys an LDP in D(R K \ThetaR K \ThetaR K \ThetaR K \ThetaK \ThetaR K \ThetaR K ) with rate function I A;S;V;\Phi;Q;W (a; s; v; OE; q; w) such that whenever it is finite the following equations hold By the contraction principle, the sequence fQ n ; W n obeys an LDP in D(R K \Theta R K ) with rate function I Q:W (q; w) that is infinity unless -\Omega w . An application of Lemma 2.1 ends the proof of (a). We now turn to (b) . Note first that the argument of the proof of part (a) implies that the sequences for the J 1 topology with rate functions which equal infinity both at discontinuous functions and functions not equal to 0 at 0 . Next, let us denote by U n;k (m) the arrival time of the m th exogenous customer with the routing vector k , by T n;k;i it arrives at the i th queue of its itinerary, by H n;k;i (m) , the time it awaits service in the i th station, and by v n;k;i (m) , the time it is served in the i th station. We obviously have and Inequalities (4.12) account for the fact that we make no assumptions about the mechanism of resolving conflicts between simultaneous arrivals. Next, it is easily seen thatb n t by the assumption A 0 1=an and Lemma 4.2(c) in [17], W n;k (bntc)=n P 1=an by the LDP for fW n ; n - 1g and Lemma 4.2(c) in [17], and sup s-t j\DeltaV n;k (s)j P 1=an by the fact that fV n ; n - 1g obeys an LDP with rate function that equals infinity both at discontinuous functions and functions not equal to 0 at 0 and by Lemma 2.3, it follows from (4.11), (4.12) and (4.13) that, for and sup 0: (4. . The LDP for fW (4.12) imply, by Lemmas 4.1(c) and 4.3 in [17] and Lemma 2.3, that f(H 1g obeys an LDP in D(R l \Theta R K ) with rate function I H k;1 ;:::;H k;l ;W (h when h e); and equal to infinity otherwise. The proof is completed by noting that l l and using (4.15), Lemma 4.1(c) in [17], and the contraction principle. The corollary is proved. Remark 4.6. If the routing mechansim is as described in part (c) of Theorem 4.1, then convergence (4.9) in part (b) holds with - k . This follows by Theorem 6.3 in [18] and Lemma 4.2(b) in [17]. Acknowledgement . I am grateful to Ward Whitt for fruitful discussions and suggesting Theorem 3.3(a) and to Marty Reiman for valuable comments on the content of the paper. A. Appendix We state and prove the lemma used in the proof of Theorem 3.3(b). Lemma A.1. Let f- n;i be a triangular array of row-wise i.i.d. r.v. with zero mean. Let b n !1 as n !1 , and ff ? 0 . exist (ii) If, for some there exist n 0 (b n Proof. The argument uses the ideas of the proof of Example 7.2 in [14]. Let the conditions of (i) hold. We first prove that there exist C 1 ? 0 and t 0 such that for t - t 0 By Doob's inequality (see, e.g., Liptser and Shiryaev [9, Theorem 1.9.1]), for - ? 0 , Ee 2- Ee 2- so Ee 2- Choosing in ff=2 , we get Now note that, since E- by the Chebyshev inequality, hence so, by the fact that large enough and t - t 0 , which together with (A.5) proves (A.3). Estimate (A.1) now follows by (A.3), the inequalities and Part (i) is proved. For part (ii), we write Noting that the conditions of part (ii) imply the conditions of part (i), we estimate the first term on the right with the help of (A.3). For the second, we use the inequality We first work with the second probability on the right. We have, for - ? 0 , by the Chebyshev inequality, A "' bntc Next, for c A nt Taking t=2 , it is not difficult to see by (A.9), (A.10) and the condition large enough, A - exp \GammaC 00 By a similar argument, this bound is seen to hold for Finally, the first term on the right of (A.8) is estimated as nt Ee flj- n;1 j fi e fl(b n Substituting the estimates into (A.7) finishes the proof of (ii). The lemma is proved. --R Stochastic processes in queueing theory (in Russian: Nauka systems Diffusion Approximations for Open Queueing Networks with Service Interruptions Reflected Brownian Motion on an Orthant Multiple Channel Queues in Heavy Traffic Boundary effects in large deviation problems On queues in heavy traffic Weak Convergence of Probability Measures and Random Functions in the Function Space D Theory of Martingales (Kluwer The Dynamic Complementarity Problem A Unified Approach Via Graphs to Skorohod's Topologies on the Function Space D Transient phenomena in queueing processes (in Russian) On Functional Principle of Large Deviations Large Deviations of Semimartingales Via Convergence of the Predictable Char- acteristics Large Deviation Analysis of the Single Server Queue Large Deviations of Semimartingales: a Maxingale Problem Approach. Functional Large Deviation Principles for First Passage Time Processes Functional Large Deviation Principles for Waiting and Departure Processes (submitted). Open Queueing Networks in Heavy Traffic Large Deviations for Performance Analysis (Chapman and Hall Limit Theorems for Stochastic Processes Large Deviations and Applications (SIAM Limit Theorems on Large Deviations for Markov Random Processes (Nauka Some Useful Functions for Functional Limit Theorems --TR --CTR Kurt Majewski, Sample path moderate deviations for the cumulative fluid produced by an increasing number of exponential on-off sources, Queueing Systems: Theory and Applications, v.56 n.1, p.9-26, May 2007
queues;large deviation principle;heavy traffic
598068
Window flow control in FIFO networks with cross traffic.
We focus on window flow control as used in packet-switched communication networks. The approach consists in studying the stability of a system where each node on the path followed by the packets of the controlled connection is modeled by a FIFO queue of infinite capacity which receives in addition some cross traffic represented by an exogenous flow. Under general stochastic assumptions, namely for stationary and ergodic input processes, we show the existence of a maximum throughput allowed by the flow control. Then we establish bounds on the value of this maximum throughput. These bounds, which do not coincide in general, are reached by time-space scalings of the exogenous flows. Therefore, the performance of the window flow control depends not only on the traffic intensity of the cross flows, but also on fine statistical characteristics such as the burstiness of these flows. These results are illustrated by several examples, including the case of a nonmonotone, nonconvex and fractal stability region.
Introduction Flow control mechanisms are used in packet-switched communication networks to prevent routers from congestion, by regulating the input traffic generated by the users. The most widely used mechanism is the window flow control, like that of TCP (Transmission Control Protocol) over the Internet [7]. This mechanism consists in limiting the number of packets in transit in the network to a given value called the window. The focus of this paper is not on the window dynamics of TCP, which was studied in [10, 14, 15] in cases where the connection consists of a single bottleneck link, but rather on the network dynamics. In particular, we assume that the window either stabilizes as in TCP Vegas [6] or varies very slowly compared to the time-scale of a packet, so that it can be considered as static, and we evaluate in this case the effect of cross traffic on the performance of the flow control, in terms of utilization of the network resources. The main difficulty which arises in the analysis of current communication networks is that the traffic may exhibit periodicity [8] and long-range dependence [16] which are not captured by traditional Markovian models [11, 13]. In addition, it turns out that in the particular case of window flow control, the throughput of the controlled connection depends in a crucial way on fine statistical characteristics of the cross flows, and not only on their traffic intensity. In [1], bounds on the performance of window flow control are obtained in cases where the interaction with cross traffic may be modeled by so-called service curves. Here we model the cross traffic at each node of the network by an exogenous flow with general statistical assumptions, namely by a stationary and ergodic marked point process. The reference model on which the analysis is based consists of a series of FIFO queues in tandem. More general network topologies including multicast connections and/or propagation delays are also considered along the same lines. The paper is organized as follows. The model, its dynamics and its basic monotonicity properties are described in Section 2. In Section 3, we present the stochastic framework of the analysis and investigate the stability region of the model, that is the conditions under which the system admits a finite stationary regime. In particular, we show that there exists a maximum arrival rate of the packets below which the system is stable, and we refer to this value as the maximum throughput of the connection. In Section 4, we establish bounds on the maximum throughput, and show that these bounds which do not coincide in general, are reached by time-space scalings of the exogenous flows. The results obtained are illustrated by several examples in Section 5, including the case of a non-monotone, non-convex and fractal stability region. Section 6 concludes the paper. RR n 3434 4 F. Baccelli, T. Bonald Model 2.1 Window flow control The connection involves two users, referred to as the source and the destination. The source sends data packets to the destination, which sends back an acknowledgment to the source each time it receives a packet. The window flow control consists in limiting the number of packets the source can consecutively send without waiting for any acknowledgment, to a given value K called the window. Incoming packets that exceed the capacity of the window are buffered at the source in the input queue until a new acknowledgment is received. In the reference model, the path followed by the packets and the acknowledgments of the controlled connection consists of N stations in tandem. The first stations represent the forward path followed by the packets sent from the source to the destination, and the last stations represent the reverse path followed by the acknowledgments sent back from the destination to the source. No difference will be made between the forward and the reverse path in the following, and we will simply refer to a packet of the controlled connection and its acknowledgment as a controlled customer. Note that the number of controlled customers in the network (excluding the input queue) is always limited by the window K . Each station receives in addition a flow of cross customers which leave the network after the completion of their service. At each station, all customers are served at unit rate by a single server under the global FIFO discipline. All queues are of infinite capacity. A B1 B2 BN Figure 1: Reference model The reference model with a window of packets is shown in Figure 1 (in all figures, controlled customers are in black and cross customers in white). More general models including multicast connections and/or propagation delays are also considered along the same lines (see Appendix B). INRIA Window Flow Control in FIFO Networks with Cross Traffic 5 2.2 Dynamics n be the arrival point process of the controlled customers, and B the arrival point process of the cross customers at station i, with the usual conventions 1 . We denote by ff i n and U i n the service time and the departure time of the n-th controlled customer at (from) station i, and by fi i n the service time and the departure time of the n-th cross customer at (from) station i. Denoting by U 0 n the departure time of the n-th controlled customer from the input queue (or equivalently its arrival time in the network), it follows from the window flow control mechanism that In addition, by the workload equation of a FIFO queue, we get for all uU and where we use the convention that, when a cross customer and a controlled customer arrive at a given station at the same time, the controlled customer is served first. We denote by n the departure point processes of the controlled customers from the input queue and from station i, respectively. 2.3 Monotonicity For all k l 2 Z, let A [k;l] be the [k; l]-restriction of A, that is the arrival point process defined by T 0 We denote by D [k;l] N the corresponding departure point processes. When k ! l, we also define The same notations are used for the corresponding departure point processes. The following monotonicity property is crucial for the rest of the analysis. RR n 3434 6 F. Baccelli, T. Bonald A be any other arrival point process of controlled customers, and let ~ be the corresponding departure point processes. We have for all k l 2 Z, A [k;l] OE ~ A [k;l] =) where we use the notation fT n g n OE f ~ to mean T n ~ Proof. In view of (1), we have so that It follows then from (2) that From (1), we get and the proof follows by induction. 2 Remark 1 This monotonicity property does not hold with respect to the cross traffic flows. Consider the case 2. Let the cross customers leave the network at times f1; 5g, and when the cross customers leave the network at times In the rest of the paper, we denote by X 0 (t) and X i (t) the number of controlled customers in the input queue and in station i at time t, respectively. We also denote by Y i (t) the number of cross customers in station i at time t. By convention, these processes are taken right-continuous with left-hand limits. Let Z i (t) be the cumulative number of controlled customers in all stations up to i at time t, that is At any time t, we have and for all k l 2 Z, denote by Z [k;l] (t) the value of Z(t) when the arrival point process of the controlled customers is the restricted point process A [k;l] . Lemma 1 admits the following key corollaries. INRIA Window Flow Control in FIFO Networks with Cross Traffic 7 Corollary 1 For all k l 2 Z, we have component-wise, Proof. The proof follows from the fact that A [k;l] OE A [k\Gamma1;l] and from Lemma 1. 2 From Corollary 1, we can then define a function fZ(t)g by For the following corollaries, we assume that there exists ? 0 such that lim Corollary 2 Let ~ n be another arrival point process such that the associated function f ~ Z(t)g is finite. Let ~ then the function fZ(t)g is also finite. Proof. For any t 2 R, let m be the index of the last controlled customer arrived before time t, namely there exists l m such that for all k l, A [k;l] OE ~ and it follows from Lemma 1 that Hence, so that the finiteness of f ~ Z(t)g implies that of fZ(t)g. 2 In the rest of the paper, we say that the system is saturated when the arrival point process of the controlled customers is RR n 3434 8 F. Baccelli, T. Bonald Corollary 3 Denote by U n the departure time of the n-th controlled customer from the input queue when the system is saturated. Let lim Proof. Denote by DN the departure point processes associated with A. It follows from the definition of A that for all k l 2 Z, A [k;l] OE A [k;l] ; so that from Lemma 1, In particular, lim sup denotes the sequence of points of D [1;+1) lim Z [1;+1) and the result follows from (4) and Corollary 1. 2 The following lemmas show that the departure point processes D are also monotone in the service times of the controlled customers and in the service times of the cross customers, as well as in the window K . As immediate corollaries, the function fZ(t)g is also monotone in the same quantities. DN be the departure point processes associated with the system where the service times of the controlled customers fff 1 are changed into the sequences f~ff 1 We have for all k l 2 Z, INRIA Window Flow Control in FIFO Networks with Cross Traffic 9 Proof. In view of (1), we have It follows then from (2) that and from (1), The result follows by induction. 2 DN be the departure point processes associated with the system where the service times of the cross customers are changed into the sequences f ~ Z(t)g denote the corresponding queue size function. We have, for all k l 2 Z, Similarly Proof. The proof is exactly the same as that of Lemma 2. 2 Lemma 4 Let ~ DN be the departure point processes associated with the system where the window is ~ K instead of K , and let f ~ Z(t)g be the associated queue size function. We have, for all k l 2 Z, In addition Proof. In view of (1), we have ~ It follows then from (2) that and from (1), ~ The result follows by induction 2 RR n 3434 F. Baccelli, T. Bonald 3 Stability and maximum throughput In this section, we first present the stochastic framework of the analysis. The reader is referred to Appendix A for the main definitions and for the properties of stationary and ergodic point processes to be used in the following. By means of a Loynes' scheme [12], we then use the monotonicity property established in Section 2 to construct a stationary regime for the queueing process Finally, we prove the existence of a maximum throughput allowed by the flow control, that is a maximum arrival rate of the controlled customers below which the system is stable. 3.1 Stochastic framework The arrival times and the service times of the controlled customers are defined on a probabilit equipped with an ergodic, measure-preserving flow f' A (t)g t2R . We assume that the point process A is simple, ' A (t)-compatible, and admits fff n as sequence of marks. We denote by its finite and non-null intensity, and by (A; ff) the corresponding stationary and ergodic marked point process. Let IP 0 A be the Palm probability associated with A. We assume that the mean service time of the controlled customers at station i, defined by ff A (ff i 0 ), is finite and non-null. We denote by i the service rate of the controlled customers at station i. The arrival times and the service times of the cross customers are defined on another probability equipped with an ergodic, measure-preserving flow We assume that the point processes are simple, ' B (t)-compatible, and admit respectively as sequences of marks. Thus the corresponding marked point processes are assumed to be jointly stationary and ergodic. When the finite intensity i of B i is non-null, we denote by IP 0 the associated Palm probability and assume that the mean service time of the cross customers at station i, defined by fi 0 ), is finite and non-null. The traffic intensity of the cross flow at station i is then defined by ae We assume that The controlled flow is assumed to be independent of the cross flows. In particular, the probability space considered in the following is the product defined by \Omega =\Omega A INRIA Window Flow Control in FIFO Networks with Cross Traffic 11 We define a flow f'(t)g t2R on this space by This flow is measure-preserving but not necessarily ergodic. In the following, we say that a stochastic process is stationary if it is compatible with the flow f'(t)g. 3.2 Construction of the minimum stationary regime Let fZ(t)g be the stochastic process defined by (5). By construction, this process is compatible with the flow f'(t)g. Lemma 5 The process fZ(t)g is component-wise a.s. finite or a.s. infinite. Proof. From (4), the '(t)-compatible process fZ(t)g is a.s. finite if and only if the random variable a.s. finite. From the monotonicity property of Lemma 1, we have is the number of points of A between 0 and t. Hence, defining for any fixed 2\Omega B the event we get ' A (t)F A ae FA for all t 0. It follows then from the ergodicity of (IP A ; ' A (t)) that IP A 1g. The mapping defines a random variable But by the same argument as above, so that It follows then from the ergodicity of (IP that is IP B -a.s. constant, and The result follows then from Fubini Theorem since Z\Omega A Z\Omega I fZ(!A ;! B )!1g IP A (d! A )IP B (d! B ); Z\Omega Z\Omega A I fZ(!A ;! B )!1g IP A (d! A ) Z\Omega 12 F. Baccelli, T. Bonald Corollary 4 Since the discrete flow f' n A g n associated with the point process A is ergodic on the Palm probability A ) (see Appendix A), the result of Lemma 5 also holds on the Palm probability respect to A, given by A A \Theta FB ) and IP Lemma 6 The process fZ(t)g is the minimum stationary regime of fZ(t)g. Proof. Assume that there exists a finite stationary regime f ~ Z(t)g of fZ(t)g, and denote by ~ DN the corresponding departure point processes. For any k 2 Z, we get from (1), so that from (2), and by induction, Therefore, and the proof follows from the fact that this inequality holds for all k 2 Z. 2 Lemma 7 There exists a finite stationary regime for the queueing process fQ(t)g if and only if the process fZ(t)g is a.s. finite. Proof. If there exists a finite stationary regime for the queueing process fQ(t)g, there exists also a finite stationary regime for fZ(t)g, and it follows from from Lemma 6 that fZ(t)g is a.s. finite. Conversely, assume that the process fZ(t)g is a.s. finite. We can then define a finite stationary queueing process fX (t)g for the controlled customers by X 0 and DN be the associated '(t)-compatible departure point processes. In view of (3), we can then construct the associated '(t)-compatible departure point processes of the cross customers fV 1 n g, and define a finite stationary queueing process fY(t)g by I fT i Window Flow Control in FIFO Networks with Cross Traffic 13 Remark 2 It follows from the '(t)-invariance of the probability measure IP that when the process fZ(t)g is a.s. infinite, the number of customers in the input queue tends in probability to infinity, that is component-wise, Z [1;+1) (t) IP 3.3 Maximum throughput In the following, we say that the system is stable if there exists a finite stationary regime for the queueing process fQ(t)g. From Lemma 7, the finiteness of fZ(t)g provides a necessary and sufficient condition for the stability of the system. Note that since the process fZ(t)g is f'(t)g-compatible, its finiteness under the probability measures IP and IP 0 are equivalent. In particular, the stability region of the system depends on the controlled flow only through its distribution under IP 0 . Theorem 1 below which is the central result of the paper, shows that the stability region is actually insensitive to the distribution of the interarrival times of the controlled customers, and depends on the point process A only through its intensity . Theorem 1 (Maximum throughput) There exists a constant , which only depends on the law of the cross flows under IP B and on the law of the service times of the controlled customers under IP 0 A , and such that the system is stable whenever ! and unstable In this sense, is the maximum throughput of the controlled flow. Proof. The proof is given in the Palm setting, that is on the probability defined Corollary 4. For any ? 0, denote by fZ (t)g the minimum stationary regime obtained when the arrival point process of the controlled customers is the periodic point process A We know from Corollary 4 that the process fZ (t)g is either a.s. finite or a.s. infinite. Define and set is empty. In view of Corollary 2, the process fZ (t)g is a.s. finite for all ? . If ! 1, then there exists ? such that ! 1. From Corollary 2, the finiteness of the process fZ (t)g implies that of fZ(t)g. On the other hand, if ? 1, then there exists such that ? 1. Assume that the process fZ(t)g is finite with strictly positive probability. Then from Corollary 2, the process fZ (t)g is also finite with strictly positive probability, so that it is finite with probability 1, and , a contradiction. 2 RR n 3434 14 F. Baccelli, T. Bonald Remark 3 In view of the proof of Theorem 1, the result still holds if the controlled flow is not independent of the cross flows under IP, provided that the service times of the controlled customers are independent of the cross flows under IP 0 . Remark 4 When the measure-preserving flow f' B (t)g is not ergodic with respect to IP B , Theorem 1 still applies, except that the maximum throughput is no more a constant but that is the system is stable on the event (!B )g and unstable on the event f ? (!B )g. This case is illustrated by an example in Section 5. In the rest of the section, we assume that the service times of the controlled customers are deterministic. We show that in this case, the maximum throughput of the controlled flow is equal to the departure rate of the controlled customers from the input queue when the system is saturated, i.e. when the arrival point process of the controlled customers is given by A. Thus the stability condition of the system is given by the so-called saturation rule, although the system does not enter the monotone-separable framework of [5]. Theorem 2 (Saturation rule) Assume that the service times of the controlled customers are deterministic and denote by U n the departure time of the n-th controlled customer from the input queue when the system is saturated. We have lim a.s. where is the maximum throughput defined in Theorem 1. Proof. Since the service times of the controlled customers are deterministic, fU n g n1 is a functional of the cross traffic only, so that the reference probability space is actually Denote by D(t) the number of points of fU n g n1 between 0 and t. Using the fact that U it follows from the monotonicity property of Lemma 2 that From Kingman's subadditive ergodic theorem [9], there exists a constant such that lim and we know from Corollary 3 that . INRIA Window Flow Control in FIFO Networks with Cross Traffic 15 Now using the same notations as in the proof of Theorem 1, let be any fixed constant such that ! \Gamma1 . In view of the definition of , the process fZ (t)g associated with A is a.s. infinite. Define I fX ((n+1))=0g ; 8t 0; where [x] denotes the integer value of x and X (t) is the number of controlled customers in the input queue at time t when the arrival point process is fng n0 . In view of Remark 2, we have \Gamma! so that lim 0: Denote by A (t) the number of points of A between 0 and t and define another arrival point process by A where ff 1 is the (non-null) service time of the controlled customers at station 1. By con- struction, the input queue is then never empty at any time t 0, so that A (t) D(t): Therefore, using the fact that lim A (t)) A (t) we get \Gamma1 . Since this inequality holds for any ! \Gamma1 , we obtain . 2 Corollary 5 Assume that service times of the controlled customers are deterministic. If there exists a stationary regime for the saturated system, that is a ' B (t)-compatible arrival process of the controlled customers ~ defined on the probability space such that the departure time of the n-th controlled customer is equal to ~ then the intensity of ~ A is equal to . RR n 3434 F. Baccelli, T. Bonald Proof. Denote by ~ the intensity of ~ A. By the definition of A, we have A OE ~ A, so that by Lemma 1, the corresponding departure point processes from the input queue satisfy D. But since the arrival time ~ T n of the n-th controlled customer corresponds to the departure time of the (n \Gamma K)-th controlled customer, it follows from (1) that ~ A. Using Theorem 2, we obtain ~ . Now define for all n 2 Z, ~ Y (\Gamma1;n] Y (\Gamma1;n] (t)g is the queueing process of the cross customers obtained when the arrival point process ~ A is restricted to (\Gamma1; n]. Since there exists a.s. m 0 such that ~ n be the point process defined by " otherwise, and denote by " U n g n the corresponding departure point process from the input queue. By construction, we know from Theorem 2 that lim From the monotonicity property of Lemma 1, we get ~ A and ~ D, so that ~ . 2 4 Bounds on the maximum throughput In this section, we establish an upper bound and a lower bound on the maximum throughput of the controlled flow, as defined in Section 3. Then we show that these bounds which coincide only when there is a single bottleneck in the network, are tight in the sense that both are reached by time-space scaling of the cross flows. 4.1 Upper bound The upper bound is obtained by comparing the model with systems where the controlled customers leave each station earlier. We first use the monotonicity of the departure times of the controlled customers in the service times of the cross customers, then the monotonicity of these departure times in the window K . INRIA Window Flow Control in FIFO Networks with Cross Traffic 17 System without cross flows The system without cross flows, obtained by reducing the service times of the cross customers to zero, can be represented by a Petri network, as shown in Figure 2. This Petri network is an event graph, the dynamics of which can be represented by linear equations in the (max,+)-algebra (see [4]). Since this system depends on the marked point process ff) only, which is compatible with the ergodic shift f' A (t)g on the probability space necessary condition for the stability of this (max,+)-linear system is that (K); where (K) denotes the inverse of the associated Lyapunov exponent. Figure 2: System without cross flows Remark 5 By definition, (K) is given by the departure rate of the customers when the input of the system is saturated [2]. In the case of deterministic service times of the controlled customers, we get From Lemma 3, a necessary condition for the stability of the original system is given by System without flow control The system without flow control, obtained by letting the window K tend to infinity, is shown in Figure 3. A necessary condition for the stability of this system is given by the usual traffic conditions, namely RR n 3434 F. Baccelli, T. Bonald A Figure 3: System without flow control From Lemma 4, this provides a necessary condition for the stability of the original system, so that min Remark 6 The value of this upper bound can be viewed as the so-called available band-width of the controlled connection. It is then natural to define the utilization of the network resources as the ratio =, where 4.2 Lower bound In the following, we denote by the stationary workload process of the system in the absence of controlled customers, and define Note that, since the input processes of the cross flows are not necessarily mutually indepen- dent, we can have which corresponds to cases where the system is never empty. The lower bound is obtained by comparing the system with that obtained when the cross customers have a global preemptive priority (GPP) over controlled customers. That is, whenever a cross customer arrives in any station of the network, the services of all controlled customers present in the network are preempted, and can only restart when there are no more cross customers in the network. System under the GPP service discipline It is easy to check that Lemma 1, Corollary 1 and Lemmas 5-6 hold under this service discipline, so that we can define the corresponding minimum stationary regime f ~ Z(t)g . Lemma 8 We have Z(t) ~ INRIA Window Flow Control in FIFO Networks with Cross Traffic 19 Proof. Denote by ~ n g, the departure point processes of the controlled customers under the GPP service discipline. As under this service discipline, a controlled customer can be served at station i only if all cross customers and all controlled customers arrived before itself in station i have been served, we get U m: u ~ U U U Hence if for some p 2 Z, we have ~ U n , for all n p, we obtain U m: u ~ U m: U U and it follows from (2) that ~ n , for all n p. Now let k l 2 Z be fixed. From (1), so that from the above property, and by induction, The result follows from the definition of the processes fZ(t)g and f ~ Z(t)g. 2 Lemma 9 Assume that fl ! 1. If ! (K)(1 \Gamma fl), the system under the GPP service discipline is stable, that is there exists a finite stationary regime for the associated queueing process f ~ Q(t)g. Proof. Since under the GPP service discipline, the cross customers have preemptive priority over the controlled customers, there exists a unique '(t)-compatible process f ~ Y(t)g for the number of cross customers in each station, and it is enough to show the finiteness of the process f ~ Z(t)g. RR n 3434 20 F. Baccelli, T. Bonald Denote by fA(t)g the counting process associated with A such that ~ A be the point process associated with the counting process f ~ A(t)g, defined by where ae Z uI fW(0)=0g ds oe Note that this point process is not necessarily simple. The stochastic process defined by (5) for the system without cross flows, and with the arrival point process ~ A is given by f ~ Z('(t))g. Applying the saturation rule of [5], a sufficient condition for this process to be finite is that the intensity of ~ A is smaller than the departure rate of the customers in the associated saturated system, namely (K). But since fl ! 1, we have a:s: \Gamma! and noting that Z '(t)I fW(0)=0g if follows from the ergodicity of f' B (t)g that a:s: In particular, ~ a:s: Thus if ! (K)(1 \Gamma fl), the process f ~ Z(t)g is a.s. finite. 2 From Lemmas 8 and 9, a sufficient condition for the stability of the original system (under the FIFO service discipline), is that ! (K)(1 \Gamma fl). Therefore, INRIA Window Flow Control in FIFO Networks with Cross Traffic 21 4.3 Tightness of the bounds From (6)-(7) and (8), the constants and respectively provide an upper and a lower bound on the maximum throughput of the controlled connection. It is not difficult to see that these bounds coincide if and only if ae i ? 0 for at most one i, say j, and In particular, so that the station j is the bottleneck of the connection, in the following strong sense: . In the absence of cross customers, the maximum throughput of the connection is given by the service rate j at station j. In particular, increasing the window K has no effect on this maximum throughput; . No station except station j receives a cross flow. In this case, the maximum throughput of the controlled connection is equal to the available bandwidth as defined in Remark 6, that is Remark 7 The single station case case where the bounds always co- incide. This is not surprising since the model can then be seen as a single G/G/1 queue with two types of customers, the controlled customers and the cross customers, and a conservative service discipline which depends on the type of customers present in the queue. Such a system is known to be stable when ae ! 1 and unstable when ae ? 1, where is the total traffic intensity of both flows. In the general case, the bounds do not coincide. In fact, we will show that in the case of deterministic service times of the controlled customers, the upper bound on the maximum throughput is reached when the cross flows are scaled in time and space by a factor which tends to zero, so as to get fluid flows. Then we show that the lower bound is reached when this scaling factor tends to infinity, so as to get bursty flows. For any c ? 0, we denote by fW(c; t)g the stationary workload process of the system without controlled customers, and where the cross flows are scaled by a factor c, namely the arrivals on station i take place at times fcT i and the corresponding service times are fcfi i . Note that the scaled cross flows are compatible with the measure-preserving, ergodic flow f' B (c; c g, and that c RR n 3434 22 F. Baccelli, T. Bonald System with asymptotically fluid cross flows When the scaling factor c tends to zero, a direct application of the pointwise ergodic theorem shows that the cross traffic workload arriving to station i in the interval (0; t], namely I f0!cT i c I f0!T i tends a.s. to tae i , so that the cross flows tend to be fluid. Theorem 3 below states that, provided that the service times of the controlled customers are deterministic, the maximum throughput of the controlled connection will then tend to the upper bound max . For sake of completeness, but also to facilitate the reading of the proof of Theorem 3, we first study the limiting case where the cross flows are fluid. The dynamics of the system is then given by (1) and m: U The monotonicity properties of 2.3 still hold. Using this, we show the existence of a maximum throughput as in Theorem 1, and also that this maximum throughput is smaller than max , as in 4.1. If the service times of the controlled customers are deterministic, the maximum throughput of the controlled connection with fluid cross flows is equal to max . Proof. First note that in view of (9) and Remark 5, and denote by ~ A the arrival point process with points fng n . In view of Corollary 2, it is sufficient to show that the (deterministic) process f ~ Z(t)g associated with ~ A is finite to conclude the proof. We denote by ~ DN the departure point processes associated with ~ A, and by oe i the cumulative service time of the controlled customers up to station i, namely INRIA Window Flow Control in FIFO Networks with Cross Traffic 23 In view of (2 0 ), using the fact that we have for any k 2 Z, But since ~ it follows from (1) that ~ By induction, we get for all k l 2 Z, Thus using (4), Z [k;l] Z [k;l] Z [k;l] The result follows from the fact that these inequalities hold for all k l 2 Z. 2 Remark 8 When the service times of the controlled customers are not deterministic, the maximum throughput of the controlled connection in the presence of fluid cross flows is not equal to max in general. Now we consider the original system with (discrete) cross flows scaled in time and space by a factor c, and study the behavior of the corresponding maximum throughput (c) when c tends to zero. Theorem 3 If the service times of the controlled customers are deterministic, the maximum throughput of the controlled connection tends to its maximum value max when the cross flows are scaled in time and space by a factor which tends to zero, that is lim Proof. The proof is given on the probability fixed constants such that max ? 1 and "oe N ! . For any c ? 0, define the event f Z oe oe I fW i (c;t)=0g dt ff RR n 3434 F. Baccelli, T. Bonald are the cumulative service times of the controlled customers as defined above. Let ~ A be the point process defined by the associated counting process ~ I F (c) ffi '(n): We denote by f ~ Z(t)g the associated process defined by (5) and by ~ DN the corresponding departure point processes. By the same inductive argument as that used in Lemma 10, we get for all k l 2 Z, By choosing " small enough, so that the system without cross flows, with arrival point process ~ A and deterministic service times "), is stable, and the corresponding departure point processes are given by ~ "). The number of customers in this system is bounded by K at any time t, so that Z [k;l] This inequality holds for all k l 2 Z, which implies the finiteness of the process f ~ Z(t)g. In addition, since the discrete flow f'(n)g n is measure-preserving, there exists an random variable ~ (c) such that ~ a:s: \Gamma! ~ (c) when t ! \Sigma1; and the expectation of ~ (c) which is the same under IP and under IP 0 , is given by From Corollary 2, we have ~ (c) (c) a.s. and in particular, INRIA Window Flow Control in FIFO Networks with Cross Traffic 25 But since c Z c( \Gamma"oe by fixing " enough such that it follows from the ergodicity of the flow f' B (t)g that lim Therefore, lim inf (c) The result follows from the fact that these inequalities hold for all such that max ? 1. 2 System with asymptotically bursty cross flows When the scaling factor c tends to infinity, the cross flows become more bursty, and we will show that in this case, the maximum throughput of the controlled connection tends to the lower bound min . We first consider the limiting system. On the event fW(0) 6= 0g, using the fact that a.s. no cross customer arrives in the system at time 0, we have for some i, c so that the maximum throughput is equal to 0. On the complementary event using the fact that a.s. no cross customer leaves the system at time 0, we have for all i c so that the maximum throughput is that of the (max,+)-linear system of 4.1, that is (K). So the limiting system is intrinsically non-ergodic, with expected maximum throughput To prove Theorem 4 below, we need the following technical result. RR n 3434 26 F. Baccelli, T. Bonald Lemma 11 For any b ? 0, let b (K) be the inverse of the Lyapunov exponent associated with the system without cross flows, where the service times of the controlled customers are changed into the ' n A -compatible sequences fff 1 I fff N n bg g n . We have lim Proof. By monotonicity, we have Denote respectively by U n and U b n the departure time of the n-th controlled customer from the input queue, when the systems (without cross flows) with original service times and with service times changed into fff 1 I fff N n bg g are saturated. Since we have in view of Remark 5, b (K) A (ff i The result follows then from the fact that, by dominated convergence, A (ff i I fff i?bg 0:Theorem 4 The maximum throughput of the controlled connection tends to its minimum value min when the cross flows are scaled in time and space by a factor which tends to infinity, that is lim Proof. Denote by S i n respectively the beginning and the end of service of the n-th cross customer at station i in the original system without controlled customers. When the cross flows are scaled in time and space by the factor c, the beginning and the end of service of the n-th cross customer at station i occur at times cS i n and cV i For a fixed b ? 0, consider the system where the input queue is saturated (i.e. the arrival point process of the controlled customers is A), the service times of the controlled customers INRIA Window Flow Control in FIFO Networks with Cross Traffic 27 are given by fff 1 I fff N n bg g n , the arrival times of the cross customers are given by fcT 1 service times are recursively defined by ae where ~ n denotes the beginning of service of the n-th cross customer at station i in this system, namely if ~ g, denote the corresponding departure point processes of the controlled customers, ~ m1: u ~ U ~ Denote by ~ n the departure time of the n-th cross customer from station i in this system. For all n 0, we have ~ n , and for all n 1, ~ so that for all n 2 Z, ~ Therefore, ~ n for all n 2 Z, and from Corollary 3, using the monotonicity properties of Lemmas 2 and 3, we get (c) ~ ~ In addition, since the number of controlled customers in this system is always bounded by K , we get for all ~ In particular, no controlled customer is served at station i in any interval (possibly empty) of the form RR n 3434 28 F. Baccelli, T. Bonald Now consider the same system but without cross flows, and where the services of all controlled customers are preempted at any time t such that Denoting by ~ D the departure point process of the controlled customers from the input queue in this system, we have ~ . The number of points of ~ between 0 and t is given by where D(t) is the number of controlled customers which leave the input queue for the same system but without preemption, and /(t) is the cumulative time during which the controlled customers are not preempted between time 0 and t. Noting that the process fV(t)g defined on the probability I fcS i is compatible with the flow f' B (t)g, we get a:s: Defining b (K) as in Lemma 11, we obtain ~ a:s: Therefore, (c) ~ (c) b (K) and since I fS we obtain by dominated convergence, min lim sup (c) b (K) The result follows from Lemma 11 by letting b tend to infinity. 2 INRIA Window Flow Control in FIFO Networks with Cross Traffic 29 5 Examples In all examples studied below, the number of stations is and the window is The service times are deterministic, unless specified all equal to 1, i.e. ff 1 Z. The arrival process of the cross customers at station 1 is periodic, with period 1. More precisely, we denote space defined as 1 is the interval (0; ], F 1 is the trace of the Borel oe-field on \Omega 1 and IP 1 is the uniform measure . The point process defined by Note that B 1 is ' 1 (t)-compatible, where f' 1 (t)g is the measure-preserving and ergodic flow defined on this space by In the following, we consider different point processes B 2 , and we use the saturation rule of Theorem 2 to derive the maximum throughput of the controlled flow. Note that this maximum throughput does not depend on the arrival process of the controlled customers (see Theorem 1). In particular, we do not specify the point process A, which can be any stationary and ergodic point process in view of Remark 3. 5.1 Non-monotonic, non-convex and fractal stability region In this example, B 2 is the null point process. We consider the saturated system, that is the system where the arrival point process of the controlled customers is A, and evaluate the departure rate of the controlled customers, which coincide with the maximum throughput . We distinguish between three cases, depending on the value of the integer value [ ] of . Case We will show that station 1 is never empty in this case, so that the departure rate of the controlled customers is simply given by Assume that station 1 is empty at some time t ? 0. The controlled customer which is in station 2, began its service at station 1 after time no later than time 1. Hence, the cross customer arrived in station 1 between time t \Gamma and time t, cannot have been served before this controlled customer: This cross customer is in station 1 at time t, a contradiction. RR n 3434 F. Baccelli, T. Bonald Case [ even Figure 4: Case [ As illustrated in Figure 4, the saturated system reaches a periodic steady state of period . Since [ ]=2 controlled customers leave the system each period of time , we get Case [ Figure 5: Case [ INRIA Window Flow Control in FIFO Networks with Cross Traffic 31 Let p be the smallest integer q such that [q ] is even. We have As illustrated in Figure 5, the saturated system reaches a periodic steady state of period p . Since [p ]=2 controlled customers leave the system each period of time p , we get Stability region The stability region obtained, as well as the bounds on the maximum throughput, given in view of (9) by min =2 are shown in Figure 6. Note that the maximum throughput is not monotone in the intensity 1 of the cross flow. In particular, an increase of the intensity 1 of the cross flow, may result in an increase of the maximum throughput of the controlled connection. Consider for instance the case where the arrival point process of the controlled customers is of intensity 0:45. The system which is unstable when stable when This unexpected behavior is a consequence of the non-monotonicity of the system with respect to the cross traffic (see Remark 1). In addition, the maximum throughput as a function of 1 is neither convex nor con- tinuous. The upper bound is reached when2 whereas the lower bound is "almost" reached, when Finally, the restriction of stability region to the region R such that which is invariant by the similarity of center (0; 1=2) and ratio restricted to R, is fractal. Remark 9 Due to the convention that when a controlled customer and a cross customer arrive at a given station at the same time, the controlled customer is served first (see 2.2), the maximum throughput as a function of 1 is left-continuous with right-hand limits. With the converse convention, this function would have been right-continuous with left-hand limits. RR n 3434 Figure Stability region INRIA Window Flow Control in FIFO Networks with Cross Traffic 33 In the two following examples, the service times of the cross customers are taken equal to =2, i.e. fi 1 and is supposed to be larger than 2. 5.2 Non-mutually independent cross flows be the periodic point process defined by The point processes B 1 and B 2 are ' 1 (t)-compatible on the probability but not mutually independent. Figure 7: Non-mutually independent cross flows As illustrated in Figure 7, the saturated system reaches a periodic steady state, where one controlled customer leaves the system each period of time , so that In particular, this maximum throughput tends to zero when tends to infinity, although the traffic intensities of the cross flows remain constant, equal to ae This result is not surprising in view of Theorem 4, since in the absence of controlled customers, the system is never empty, so that lower bound is equal to RR n 3434 34 F. Baccelli, T. Bonald 5.3 Non-jointly ergodic cross flows which a flow f' 2 (t)g similar to f' 1 (t)g is defined. Let B 2 be the point process defined on the probability in the same way as B 1 is defined Note that the point processes B 1 and B 2 are mutually independent on the product defined by but not jointly ergodic on this space since the joint flow (t)g is not ergodic. In this case, the maximum throughput is no more a constant but a random variable (see Remark 4). Figure 8: Cross flows "in phase" We consider cases where As illustrated by Figures 8 and 9 in the case the saturated system reaches a periodic regime of period . The number l of controlled customers which leave the system each period of time depends on the sample path 2\Omega , and can take any value in INRIA Window Flow Control in FIFO Networks with Cross Traffic 35 Figure 9: Cross flows "out of phase" the finite set Lg. More precisely, defining \Delta! as the unique element of the interval we get Therefore, there is a spectrum of L possible values for the maximum throughput of the controlled flow, depending on the relative phases of the cross flows. Noting that the probability of the event is zero, we have a.s. and 2l RR n 3434 36 F. Baccelli, T. Bonald Remark 11 In this non-ergodic case, min which is equal to provides a lower bound on the expected maximum throughput. In particular, Theorem 4 takes here the form lim 6 Conclusion The performance of the window flow control in terms of maximum throughput of the controlled connection depends in a crucial way on the characteristics of the cross flows. A first surprising result is that this maximum throughput is neither monotone nor convex in the traffic of the cross flows. In particular, the performance of the flow control can improve when the intensity of the cross flows increases, or when these cross flows become more ae Figure 10: Effect of randomization INRIA Window Flow Control in FIFO Networks with Cross Traffic 37 To illustrate this latter fact, consider the model of 5.1, where the periodic cross flow is replaced by a renewal point process with interarrival times uniformly distributed on the shows how the maximum throughput as a function of the traffic intensity of the cross flow "smoothed" when, starting from the periodic case the randomization factor e takes the values 0:05, 0:1 and 1. These results were obtained by simulation of the associated saturated system, by a QNAP program available in [17].0.250.750 0.25 0.5 0.75 1 Upper Bound Lower Bound ae Figure 11: Impact of the burstiness of the cross flows Another interesting result is that the maximum throughput of the controlled connection is very sensitive to the burstiness of the cross flows. Consider for instance the case where the cross flows are independent Poisson processes with deterministic service times equal to ae. If the service times of the controlled customers are deterministic and equal to 1, and the window is the upper bound and the lower bound on the maximum throughput of the controlled flow are respectively given by RR n 3434 38 F. Baccelli, T. Bonald We have shown (see Theorems 3 and 4) that tends to these bounds when b tends to zero and to infinity, respectively. This is illustrated by the simulation results of Figures 11 and 12, where the maximum throughput and the utilization are represented as functions of the traffic intensity of the cross flows ae, for different values of b (see [17] for the corresponding QNAP program). Thus when the cross flows consist of a fluid stream of small packets (generated by Telnet connections for instance), the utilization of the network resources by the controlled connection, given in view of Remark 6, by is very close to its maximum value U when the cross flows consist of a bursty stream of large packets (generated by batch arrivals of packets due to scene changes in a video sequence for instance), the utilization of the network resources is close to its minimum value min U min ae U Figure 12: Utilization of the network resources INRIA Window Flow Control in FIFO Networks with Cross Traffic 39 In particular, the effect of bursty cross flows on the performance of the controlled connection grows with the number of nodes N on the round-trip path followed by the packets of the controlled connection. It is worth noting that these essential features of the window flow control are not captured by models with a single bottleneck, for which the utilization of the network resources is always equal to 1, and the maximum throughput of the controlled connection is simply given by the available bandwidth on the (single) shared link. Acknowledgements . The authors would like to thank S. Foss for fruitful discussions on the present paper, and in particular for having suggested Remark 4. Appendix A gives the main definitions on stationary and ergodic point processes used in this paper. For a more complete presentation on the subject, we refer the reader to [3]. Appendix extends the results obtained in this paper to more general models, including the presence of propagation delays or the case of a multicast connection for instance. A Stationary and ergodic point processes IP) be a probability space, on which a flow f'(t)g t2R is defined: (i) (t; !) ! '(t)! is measurable with respect to B(R)\Omega F and F , (ii) '(t) is bijective for all t 2 R, be a point process defined on the probability the usual convention T 0 We assume that A is simple, that is IP(T Z. For any sample path ! 2\Omega , we denote by A(!; C) the number of points of A belonging to the Borel set C . We say that A is compatible with the flow f'(t)g, if When the flow f'(t)g is measure-preserving, that is IP IP for all t 2 R, the point process A is stationary. The intensity of A is then defined by RR n 3434 If is finite and non-null, we can define the Palm probability associated with A by I F ffi '(t) A(dt) Note that IP 0 (T then a discrete measure-preserving flow f' n g n2Z on the Palm probability We say that a sequence of random variables fff n g n2Z on the probability is a sequence of marks for A, if Any sequence of marks of A (e.g. the interarrival times fT is stationary on the Palm probability since it is compatible with the discrete flow f' n g. The flow f'(t)g is ergodic if for all F 2 F , In this case, we know from Birkhoff Ergodic Theorem that for any random variable X defined on the probability The ergodicity of f'(t)g with respect to IP implies the ergodicity of the discrete flow f' n g with respect to IP 0 (the converse is also true), so thatN Hence, for any f' t g-compatible process fX(t)g, that is the expectation of X(0) under the Palm probability IP 0 is the empirical average of fX(t)g at events, or event average, whereas the expectation of X(0) under IP is the usual time average of this process. INRIA Window Flow Control in FIFO Networks with Cross Traffic 41 B Extensions to more general models Our structural results do not depend on the topology of the network provided that in the absence of cross flows, the system is a single-input FIFO event graph [4]. In particular, these results apply in the presence of deterministic propagation delays d the stations, or in the case of a multicast connection where the data packets are duplicated at some routers on the forward paths from the source to the destinations, and the acknowledgments aggregated at some other routers on the reverse paths from the destinations to the source. The corresponding models and the underlying event graphs are shown in Figures 13 and 14. d2 d N B1 B2 BN A d1 dN d2 Figure 13: Model with propagation delays RR n 3434 42 F. Baccelli, T. Bonald BN BN \Gamma2 A BN Figure 14: Multicast connection INRIA Window Flow Control in FIFO Networks with Cross Traffic 43 --R Performance bounds for guaranteed and adaptive services Ergodic theory of stochastic Petri networks Elements of Queueing Theory Synchronization and Lin- earity On the saturation rule for the stability of queues Vegas: End to end congestion avoidance on a global Internet Internetworking with TCP-IP (Volume <Volume>I</Volume>) : principles On traffic phase effects in packet-switched gateways Subadditive ergodic theory Performance analysis of window-based flow control using TCP/IP: The effect of high bandwidth-delay products and random loss Optimal flow control of a class of queueing networks in equilibrium The stability of queues with non independent inter-arrival and service times Asymptotically optimal design of congestion control for high speed data networks Window size behavior in TCP/IP with constant loss probability Some observations on the dynamics of a congestion control algorithm http://www. --TR --CTR Franois Baccelli , Dohy Hong, TCP is max-plus linear and what it tells us on its throughput, ACM SIGCOMM Computer Communication Review, v.30 n.4, p.219-230, October 2000 Franois Baccelli , Dohy Hong, Interaction of TCP flows as billiards, IEEE/ACM Transactions on Networking (TON), v.13 n.4, p.841-853, August 2005 Vinod Sharma , Punyaslok Purkayastha, Stability and Analysis of TCP Connections with RED Control and Exogenous Traffic, Queueing Systems: Theory and Applications, v.48 n.3-4, p.193-235, November-December 2004
multiclass networks;stationary ergodic point processes;window flow control;+-linear system;stability;TCP
598082
Subexponential loss rates in a GI/GI/1 queue with applications.
Consider a single server queue with i.i.d. arrival and service processes, \{A,\ A_n,n\geq 0\} and \{C,\ C_n,n\geq 0\}, respectively, and a finite buffer B. The queue content process \{Q^B_n,\ n\geq 0\} is recursively defined as Q^B_{n+1}=\min((Q^B_n+A_{n+1}-C_{n+1})^+,B), q^+=\max(0,q). When \mathbb{E}(A-C)<0, and A has a subexponential distribution, we show that the stationary expected loss rate for this queue \mathbb{E}(Q^B_n+A_{n+1}-C_{n+1}-B)^+ has the following explicit asymptotic characterization: \mathbb{E}(Q^B_n+A_{n+1}-C_{n+1}-B)^+\sim \mathbb{E}(A-B)^+ \quad \hbox{as} \ B\rightarrow \infty, independently of the server process C_n. For a fluid queue with capacity c, M/G/\infty arrival process A_t, characterized by intermediately regularly varying on periods \tau^{\mathrm{on}}, which arrive with Poisson rate \Lambda, the average loss rate \lambda_{\mathrm{loss}}^B satisfies {\lambda_{\mathrm{loss}}^B}\sim \Lambda \mathbb{E}(\tau^{\mathrm{on}}\eta-B)^+ \quad \hbox{as}\ B\rightarrow \infty, where \eta=r+\rho-c, r) is the rate at which the fluid is arriving during an on period. Accuracy of the above asymptotic relations is verified with extensive numerical and simulation experiments. These explicit formulas have potential application in designing communication networks that will carry traffic with long-tailed characteristics, e.g., Internet data services.
Introduction An increasing body of literature on statistical data analysis has demonstrated the presence of long-tailed/subexponential characteristics in communication network traffic streams. Early discoveries on the long-tailed nature of Ethernet traffic was reported in [32]. Long-tailed characteristics of the scene length distribution of MPEG video streams were explored in [25, 29]. The implications of transporting Internet data applications over the traditional Public Switched Telephone Network were investigated in [22]. These empirical findings have encouraged theoretical developments in the modeling and analysis of long-tailed (heavy-tailed) phenomena. In this area there have been two basic approaches: self-similar processes and fluid renewal models with long-tailed renewal distri- butions. The investigation of queueing systems with self-similar long-range dependent arrival processes can be found in [16, 18, 33, 36, 39, 42]. In this paper we focus on fluid renewal models. Basic tools for the analysis of these types of models with a single long-tailed arrival stream are the classical results on subexponential asymptotic behavior of the waiting time distribution in a GI/GI/1 queue [13, 37, 43] (e.g., these results were used in [2, 24]). Asymptotic expansion refinements of these results can be found in [1, 15, 44]. Generalizations to queueing processes, or equivalently random walks, with dependent increments were investigated in [4, 5, 27]. Queueing models with multiple long-tailed arrival streams are of particular interest for engineering communication networks. Unfortunately, the analysis of these models is much more difficult due to the complex dependency structure in the aggregate arrival process [24]. An intermediate case of multiplexing a single long-tailed stream with exponential streams was investigated in [8, 28, 41]. For the case of multiplexing more than two long-tailed arrival processes general bounds were obtained in [10, 35]. In [8] a limiting process obtained by multiplexing an infinite number of On-Off sources with regularly varying on periods was explored. This limiting arrival process, so called M/G/1 process [38], appears to be quite promising for the analysis. In [28] an explicit asymptotic formula for the behavior of the infinite buffer queue length distribution with M/G/1 arrivals was derived. In the same paper it was shown with simulation experiments that the derived asymptotic formula yields a good approximation for multiplexing finitely many long-tailed On-Off sources. An asymptotic expression for the expected value of the first passage time in a fluid queue with M/G/1 arrivals was derived in [23]. A recent survey of results on fluid queues with long-tailed arrival processes can be found in [9]. All of the previously mentioned results in the literature on stationary queueing analysis assume an infinite buffer queue. This assumption is applicable to queueing systems that are designed with very large buffers such that the losses are essentially zero. The queue length distribution can be used in this situation as an indication of the delay experienced in the system. However, in engineering network switches it is very common to design them as loss systems. The main performance measures for these systems are loss probabilities and loss rates. Obtaining asymptotic approximations for these performance measures under the assumption of subexponential arrival sequences is the primary motivation for the investigation of this paper. The main contributions of the paper, presented in Theorems 4 and 5, are explicit asymptotic characterizations of the loss rates in finite buffer queues with subexponential arrival sequences. Theorem 5, in combination with the results from [28, 40], yields a straightforward asymptotic formula for the loss rate in a fluid queue with long-tailed M/G/1 arrival processes (see Theorem 7). Accuracy of the theoretical asymptotic results is demonstrated with many numerical and simulation experiments. We believe that the exactness and explicit nature of the derived approximate expressions will make them useful tools in designing efficient and reliable network switches. The rest of the paper is organized as follows. First, in Section 2, we present a preliminary discussion of subexponential distributions and infinite buffer queueing analysis. Section 3 investigates a discrete time finite buffer queue. The main results are summarized in Theorems 4 and 5. The fluid aspect of the problem is explored in Section 4, Theorems 6 and 7. Numerical and simulation examples that illustrate the efficacy of our approximations are contained in Section 5. The paper is concluded in Section 6. To simplify the reading process, the majority of the proofs are given in Section 7. Subexponential Distributions and GI/GI/1 Queueing Analysis This section presents a preliminary discussion of long-tailed/subexponential distributions and the asymptotic analysis of an infinite buffer queue under the assumption of subexponentiality. We say that a nonnegative random variable A (or its distribution function (d.f.)) is long-tailed lim A (or its d.f.) is said to be subexponential lim where A n ; n - 1, is a sequence of independent copies of A. The following subclass of subexponential random variables was introduced in [30]. If A has a finite mean, then A (or its d.f.) is said to be in S if lim This class of subexponential distribution is closed under the tail integration, i.e., if A e is the remaining life time random variable of A with its d.f. defined as P[A e - implies A e 2 S . A general relationship between the previous three classes of long-tailed random variables is S ae S ae L. For a brief introduction to long-tailed and subexponential distributions the reader is referred to the Appendix of this special issue of Queueing Systems. A recent survey on subexponential distributions can be found in [21]. Well known examples of subexponential distributions incorporate regularly varying distributions (in particular Pareto), some Weibull and Log-normal distributions. Subexponential random variables have played a role in queueing theory since the classical results of Cohen [13] and Pakes [37] on the asymptotic behavior of the waiting time process in a GI/GI/1 queue. Here, we give a formal definition of a GI/GI/1 queue waiting time process. be two independent sequences of nonnegative i.i.d. random variables. Then for any initial condition Q 0 the queueing process fQ uniquely defined by the following (Lindley's) recursion There are two customary interpretations of this recursion. First, if one assumes that A n are customers' service requirements and C are their inter-arrival times, then Q n represents the waiting time process in a GI/GI/1 queue. Second, if one refers to (4) as being an infinite buffer discrete time queue with A n representing the amount of work that arrives at time n and C n the amount of work that is served at time n, then Q n represents the queue length process for this queue. We will refer to Q the infinite buffer queueing process and to A n and C n as the arrival and service processes, respectively. According to the classical result of Loynes [34], under the stability condition EA the recursion in (4) admits a unique stationary solution, and for any initial condition converges to the stationary distribution P[Q - x]. For the rest of this paper, unless otherwise indicated, we will assume that all queueing systems under consideration are in their stationary regimes. Often, it is easier to conduct numerical computations with lattice valued random variables than with continuous ones. In this context one may be interested in computing queue occupancy probabilities. The following result gives an approximation of these probabilities under the subexponential assumption on the arrival sequence. Note that the result does not follow directly from Pakes' result [37], since the asymptotic behavior of P[Q ? i] does not imply the asymptotics of Throughout the paper, for any two real functions f(x) and g(x), we use the standard notation f(x) - g(x) as x !1 to denote lim x!1 or equivalently Theorem 1 If A; C, are integer valued, A 2 S , P[C - the queue occupancy probabilities satisfy Proof: Given in Section 7.1. If one is only interested in the tail of P[Q ? x], then under more general assumptions Pakes [37] has derived the following result. Theorem 2 (Pakes) If A e 2 S and EA ! EC, then the tail of the queue length-distribution satisfies 3 Finite Buffer Queue In this section we present our results on a discrete time finite buffer queue. The results are stated in Theorems 3, 4 and 5. as in the previous section, be two independent sequences of nonnegative i.i.d. random variables. The evolution of a finite buffer queue is defined with the following recursion where B is the buffer size. It is clear that Q B n is a discrete time Markov process with state space [0; B]. By excluding a trivial situation of C n j A n , i.e., by assuming that Chapter III.4 of [14] it was shown that this Markov process has a unique stationary distribution, and that for all initial conditions Q B n converges to that stationary distribution. Unless otherwise indicated we will assume that the recursion (5) is in its stationary regime. Similarly as in (4), Q B n -s can be interpreted as the uniformly bounded customer waiting times in a GI/GI/1 queue (see Chapter III.4 of [14]). In the proofs of Lemmas 1 and 2 and Theorem 3 we will restrict our attention to A n and C n being lattice valued. Without loss of generality we can assume that A n and C n are integer valued. Next, denote the corresponding probabilities with a In addition, assume that C n has a bounded support P[C n - be the probability generating functions (p.g.f.) for A n , C n and X n , respectively. By exploiting the recursion in (5), it is easy to show that the stationary queue occupancy p.g.f. q B is equal to where In order to prove our main results we need the following two technical lemmas. Let represents the infinite buffer case). there exists a positive constant K 1 , such that for all B - 0 Remark: Note that this lemma does not require subexponentiality of A. Proof: Let us first prove the case c = 1. Observe that q B the following set of B independent equations i is uniquely defined by the preceding set of equations. Similarly, q 1 exactly the same set of equations and therefore - B This proves the case c = 1. The case c ? 1 is much more involved and is presented in Section 7.2. 3 In order to make the preceding lemma useful we need the following bound on the buffer overflow probability. (Recall that P[A e - R x Proof: Given in Section 7.3. 3 Theorem 3 If A e 2 S, EA ! EC, and P[C - as B !1. Remark: Observe that in the case P[C - implies the following identity Thus, the theorem follows directly from Theorem 2, i.e., Lemma 2 is not needed. A similar identity exists when C is exponentially distributed (see equation (3.6) in [46]). 3 Proof: By combining Lemmas 1 and 2 we compute which is equivalent to Application of Theorem 2 shows that P[A e ? B] is asymptotically proportional to P[Q 1 ? B], which, when replaced in (9), yields the lower bound The upper bound can be proved in exactly the same manner. We omit the details. This proves the first two equalities of the theorem. The third equality follows from This finishes the proof of the theorem. 3 Now we are ready to present our first main result. Theorem 4 If A e 2 S and EA ! EC, then the stationary loss rate E(Q B satisfies Remarks: (i) In this theorem we do not assume that A and C are lattice valued. (ii) From the theorem we can derive the probability that the work is lost p(B) in conjunction with (10) can be expressed in the following compact (iii) This theorem is a significant improvement of a theorem from the original version of the paper [26] which was proved under the assumption of A being regularly varying P[A ? l(x)=x ff with index ff ? 2. 3 Proof: Assume first that A n and C n are integer valued and that P[C n - From Lemma 1 it follows that for any fixed i Next, by using the flow conservation law in the queue steady state regime (loss rate=arrival rate-departure rate) we compute c c c which in conjunction with (11) yields Combining the expression above with a similar expression for we arrive at which together with Theorem 3 and completes the proof of the theorem for the case A n and C n being integer valued and C n being bounded. In general, we can easily obtain a lower bound for the last asymptotic relation we have used A e 2 L (see Lemma 5.2 in the Appendix of this special issue). If A n and C n are integer valued and C n is unbounded we can always choose a truncated service variable C c being sufficiently large such that . Let Q B;c n be the queueing process that corresponds to the arrival process A n and a modified service process C c n . It is clear that Q B;c n is stochastically larger than Q n , and that the corresponding loss rates satisfy Now, (12) and (13) imply the conclusion of the theorem for A and C being integer, or in general lattice valued. When A and C are non lattice, we can approximate them with lattice valued random variables A 0 and C 0 in the following way. First, for any \Delta ? 0 such that EC \Gamma EA+ we define the d.f.s for A 0 and C 0 as From these definitions it easily follows that for all x - 0 which implies that A stochastically larger than and Z 1 Next, let fA 0 be two independent i.i.d. sequences whose d.f.s are equal to the d.f.s of A 0 and C 0 , respectively, and consider a queue with buffer B which corresponds to sequences A 0 . From the preceding discussion, the losses in this newly constructed queue are larger than the losses in the original queue and are asymptotically proportional to E(A 0 1. Hence, this yields an upper bound which in combination with the lower bound in (12) completes the proof. 3 The following recursion, similar to the one in (5), will be useful in analyzing fluid queues in the following section Under the same non-triviality condition as in the discussion of recursion (5), in Chapter III.5 of [14] it was shown that the Markov process W B n has a unique stationary distribution, and that for any initial condition W B n converges to that stationary distribution. Again, we assume that (14) operates in its stationary regime. Historically, recursion (14) has been studied in the context of finite dams (see Chapter III.5 in [14]). The next theorem shows that the loss rates for both queues (5) and (14) are asymptotically equivalent. Theorem 5 If A e 2 S and EA ! EC, then Remark: This theorem generalizes a result from [46] which is true for A being regularly varying, and also for the case of C being exponential and A subexponential. Proof: The proof of the lower bound is immediate In order to prove the upper bound, by using a simple inductive argument, one can show that for the same initial condition W B n is bounded by Q . Hence, in stationarity Next, assume that C n is bounded, i.e., P[C n - which, by Theorem 4, implies where the last asymptotic relation follows from E(A A e being long-tailed. For the case when C n is not bounded we can always choose a truncated service variable similarly as in the proof of Theorem 4, with c being sufficiently large such that . Let W B;c n be the queueing process that corresponds to the arrival process A n and modified service process C c n . It is clear that W B;c n is stochastically larger than W B and that the corresponding loss rates satisfy Thus, (15) and (19) conclude the proof of the theorem. 3 4 Finite Buffer Fluid Queue This section contains our results on fluid queues with finite buffers and long-tailed arrivals. In Theorem 6 we characterize the asymptotic behavior of the loss rate of a fluid queue with a single On-Off arrival process. An explicit asymptotic formula for the loss rate of a fluid queue with M/G/1 arrival sequences is presented in Theorem 7. This result is of special interest for designing communication network switches because the M/G/1 arrival process represents a good aggregate model for multiplexing a large number of On-Off sources (see [28]). The physical interpretation of a fluid queue is that at any moment of time, t, fluid is arriving to the system at rate a t and is leaving the system at rate c t . We term a t and c t to be the arrival and service processes, respectively. The evolution of the amount of fluid in the queue, q B t , is represented by or (q B or (q B and dq B In the following two sections we will study two important special cases of fluid queues. Our analysis is based on observing the process q B t at the beginning of the arrival process activity periods. A recent investigation of the stationary behavior of q B and its relationship to the process observed at the beginning of the activity periods can be found in [46]. 4.1 Single On-Off Arrival Process Consider a fluid queue with capacity c and an On-Off arrival process with On arrival rate r ? c. Lengths of On and Off periods are assumed to be independent i.i.d. sequences f- on ; - on sequence of random times representing the beginning of On periods in the arrival On-Off process; . Now, a formal construction of the On-Off arrival process is a for some n - 0, and a By observing the queue process q B t at the beginning of On periods, the queue length evolves according to Note that, by taking A n and C n , the preceding recursion reduces to the recursion in (14). We assume that (21) operates in stationarity. Our primary object of study is the long time average loss rate for this fluid queue defined as loss where L(0; t) =famount of fluid lost in (0; t)g. Next, we show that this limit exists and is equal to Let L n be a sequence of random variables representing the losses in the renewal intervals [T respectively. If N then The strong law of large numbers for renewal processes (e.g., see Theorem 5, p. 151, [45]) yields lim almost surely: (25) Similarly, (25) and Birkhoff's strong law of large numbers (see Theorem 2.1, p. 465, [17]) imply lim almost surely: (26) Consequently, by dividing (24) with t, letting t !1 and using (25) and (26) we derive (23). Finally, (23) and Theorem 5 yield the following asymptotic characterization of - B loss . Let - on e be the residual life time random variable of - on with its distribution equal to P[- on R xP[- on ? u]du=E- on . Theorem 6 If r ? c, (r \Gamma c)E- on ! cE- off and - on 4.2 Long-Tailed M/G/1 Arrival Process In this section we consider a fluid queue with capacity c and M/G/1 arrival process. An M/G/1 process, a 1 t , is defined by a Poisson point process with rate whose points, T n , indicate the beginning of On periods. Each On period, after its activation at time T n , brings fluid at rate r to the queue for a random independent period of time - on . (For a more formal definition of an M/G/1 process see [28]). Next, consider an indicator On-Off process 1(a 1 If I on n and I off n denote the lengths of the nth On and Off periods, respectively, then it can be computed (see [28]) that EI off n =EI on (e \LambdaE- on In addition, let D c R Tn+I on (a 1 increment during the nth activity period and assume that c - r. Now, the queue length V B n which is observed at the beginning of the nth activity period of the arrival process a 1 evolves according to the following recursion This recursion also has the same form as (14). Similarly, we use (22) to define the loss rate loss for this fluid queue. Again, by the same arguments as in (24)-(26) we compute EI off Now, we need to determine the asymptotic behavior of P[D c is known for - on being intermediately regularly varying (- on 2 IR); a nonnegative random variable - on is in IR if lim lim inf P[- on ? jx] P[- on ? x] In the sequel we will use the facts that - on 2 IR; E- on ! 1 implies - on and that t , Theorem 1 in [40] (see also Theorem 6 in [28]) yields P [- on j ? x] as x !1; (31) Finally, the combination of (28), (30), (31) and Theorem 5 yields the following theorem. Theorem 7 Let and - on 2 IR, then 5 Numerical and Simulation Results This section demonstrates, with numerical and simulation experiments, the accuracy and analytical tractability of our approximation results. The following two numerical examples buffer size i -5 buffer size i -5 Figure 1: Illustration for Example 1. will illustrate Lemmas 1, 2 and Theorem 4. For the case of M/G/1 arrivals, due to the complexity of the model, we were unable to obtain a numerical solution. Thus, in exemplifying Theorem 7 we resort to simulation in the following subsection. Observe that if P[A - i] - c=i ff as then the combination of Lemmas 1 and 2 imply that for any ffl ? 0 there exists B 0 such that for all is the same as in Lemma 1. The above estimate suggests that, except for i close to B, q 1 i is a good approximation of q B . Hence, Theorem 1 and (32) yield an approximation ~ which is expected to be good for all i far enough from 0 and B. This is demonstrated in the following example. Example 1 Consider a discrete time finite buffer queue with constant service process C n j 3, and arrival distribution 1:0947. For the maximum buffer size 100 the queue occupancy probabilities are plotted with a solid line on the left-hand side of Figure 1. Based on (32) and Theorem 1 we easily compute the suggested approximation ~ This approximation is plotted with dashed lines on the same figure. We can see that, with the exception of buffer sizes close to zero and 100, the approximation is very good. In fact, the relative error j~q B was smaller than 1% for the buffer sizes i 2 [58; 93]. Bound (32) further states that the portion of the buffer where the approximation is good increases as the maximum buffer size B increases. In addition, the length of the buffer around the boundaries where the approximation is not good stays approximately constant. To illustrate this we repeat the same experiment with the maximum buffer size 300. Now, the relative error between the actual and approximate probabilities was smaller than 1% for the buffer sizes i 2 [60; 291]. The next example demonstrates the accuracy of Theorem 4. O O O O O O O buffer size B Log(10,loss rate) 100 200 300 400 500 600 700 approximation Figure 2: Illustration for Example 2. Example and an arrival distribution 0:5553. Here, we numerically compute the expected loss rate for the maximum buffer sizes 7. The results are presented with "o" symbols in Figure 2. Note that for we needed to solve a system of 700 linear equations. In contrast, Theorem 4 readily suggests an asymptotic approximation ~ . The approximation is presented on the same figure with "+" symbols. An excellent match is apparent from the figure. In fact, relative error j ~ loss loss loss is plotted in Figure 3, from which we can see that even for the smallest buffer size the relative error was less than 4%. 5.1 Fluid Queue with M/G/1 Arrival Processes In this section we provide several simulation experiments to illustrate Theorem 7. For simulation purposes we assume that the time is slotted with the length of a single slot being equal to one. The number of On periods that arrive per unit of time (slot) has a Poisson distribution with parameter . The distribution of On periods is taken to be Pareto parameterized as P[- on - From this it immediately follows that ~ loss \LambdaE (- on P[- on j ? u]du - we run two simulation experiments. O O O O O O O buffer size B relative error 100 200 300 400 500 600 7000.020.04 Figure 3: Illustration for Example 2. Example 3 Choose which results in E- on = 2:41642 and ae = 0:845747. We simulate the losses for the maximum buffer sizes 25. The results are presented with a solid line in Figure 4. In order to obtain reasonable accuracy in the experiment it was necessary to run the simulation for 2 \Theta 10 9 units of time, which resulted in several days of computer processor time. Needless to say, the approximation ~ loss - 0:921=B 1:5 can be computed almost instantly from equation (33). The approximation ~ - B loss is plotted in the same figure with dashed lines. From this figure we can see that already for the buffer size B - 140 the approximation becomes almost identical to the simulated results. Example 4 We repeat the same experiment as the preceding one with ff changed to which yields E- on = 2:24304 and ae = 0:785065. The approximate loss rate computes to ~ loss - 0:508=B 2 . An almost perfect match between the approximation and simulation results is demonstrated in Figure 5. In this case the approximation becomes accurate even for smaller buffer sizes (B - 80). 6 Conclusion In this paper we have considered several queueing systems with finite buffers and long-tailed arrivals. For these queueing systems we have derived explicit asymptotic formulas for approximating loss rates. The accuracy of the suggested approximate formulas is demonstrated on various numerical and simulation experiments. Overall, we expect that these approximate expressions, both for reasons of their explicit nature and accuracy, will be useful tools in designing modern communications switches that will be able to efficiently carry non-traditional long-tailed ("bursty") traffic. buffer size B Log(10,loss rate) 50 100 150 200 250 -5 simulation approximation Figure 4: Illustration for Example 3. Acknowledgments The author is grateful to Bert Zwart for pointing out an error in the original draft of the paper and sharing the preprint of his work. We are also thankful to an anonymous reviewer for valuable suggestions. buffer size B Log(10,loss rate) 50 100 150 200 -5 simulation approximation Figure 5: Illustration for Example 4. 7 Proofs In this section we provide the proofs of Theorem 1 and Lemmas 1 and 2. Without loss of generality we assume that the set of integers that supports the distribution of X is aperiodic and that P[X additional assumptions, Theorem 5.2, p. 214 in [3] shows that exactly one simple root at on the unit circle inside the unit circle 1g. This fact will be repeatedly used in the following proofs. 7.1 Proof of Theorem 1 First, we define subexponential probabilities (see p. 429 in [6]). Let p \Lambda2 \Lambdan two-fold and n-fold convolution of p i , respectively. non-negative sequence fp called long-tailed if for any integer k, lim If, in addition, fp is a probability sequence ( lim we say that It is easy to check that for an integer valued random variable A for which A 2 S , the probability sequence belongs to S d . By using a well known connection between the queue length distribution and the supremum of the corresponding random walk with increments X , the p.g.f. q(z) of can be represented as (see Chapter XII of [20] or Chapter VII of [3]) is the generating function of a strictly ascending ladder height random variable for which Equation (34) can be written in its equivalent form where g \Lambda0 is a unit mass at zero. In the subexponential framework, the asymptotic behavior of the random sum in (35) is characterized as follows. lim Remark: An equivalent result for random sums of continuous subexponential densities can be found in [31]. Proof: Follows from Lemma 5 in [11], Lemma 2 in [19], and the Dominated Convergence Theorem. 3 At this point, it is clear that in order to establish the asymptotic connection between the arrival distribution and the queue length distribution we need to investigate the asymptotic behavior of g +i . This is presented in the following lemma. Lemma 4 If P[A ? i] is long-tailed, P[C - Proof: Standard derivation in queueing theory which exploits Lindley's recursion shows that the p.g.f. q(z) of Q n satisfies recall has a simple root at on the unit circle inside the unit circle (jzj ! 1). Since q(z) is an analytic function in the unit circle, these roots must be zeros of the numerator in (36), i.e., for some constant h. Next, using (37) in evaluating the right hand side of (36) (by l'Hospital's rule) and equating it to Further, by equating (34) and (36) we obtain Now, examine the coefficients of the analytic function The coefficients x 1 i of the analytic expansion of x 1 are positive and c from which, by the assumption that P[A ? i] is long-tailed, it easily follows that Next, we investigate the coefficients x 2 i of the analytic expansion of where z 1 is already defined to be one of the roots from the unit circle. By expanding 1=(z \Gamma z 1 ) into an analytic series in the strip we arrive at z which, after comparing the coefficients on the left and right-hand side, yields Here, for any constant K 2 where in the last inequality we have used the monotonicity of x 1 2. Inequality (41) in combination with (40) readily implies lim Similarly, by repeating this procedure for the remaining c \Gamma 2 roots, we derive the asymptotic behavior of the coefficients of x Note that for j - 2, a similar bound as in (41) can be obtained using jx j and the monotonicity of x 1 Thus, we derive as i !1: (42) By combining (42) with (38) and equating the coefficients on the left and right-hand side in we obtain the conclusion of the lemma. 3 Finally, the proof of Theorem 1 follows from Lemmas 3 and 4. 3 7.2 Proof of Lemma 1 The case c ? 1 is quite involved due to the more complicated boundary conditions. Define is an analytic function for jzj - 1, it follows that the numerator and denominator of (6) have exactly the same zeros. Recall from Claim 1 that z c \Gamma z c has a simple zero at zeros inside the unit circle (z i 6= 0). Assume that l; l - of the zeros from within the unit circle are distinct with multiplicities satisfy the following set of c \Gamma 1 equations where s B(n) with s 1(n) . By subtracting (43) from (44) we obtain that (- 1 a solution to Next, let \Delta- and R be two column vectors with corresponding elements and R B(n) (z k )=q B and Z be matrices with rows equal to and ' d (z c respectively. Then, (45) can be expressed in the following compact form Here, observe that by using the basic properties of determinants, for the case when all of the roots are distinct Y z Y When some of the roots have multiplicities bigger than one (i.e., l ! c \Gamma 1), the determinant of Z can be computed by taking the corresponding derivatives in (47) and then equating the appropriate roots. This elementary computation, the details of which have been omitted, yields l Y Y Therefore, X and Z are nonsingular matrices and from (46) we derive Furthermore, R B (z k ), as defined in (7), and its derivatives satisfy Also, the stochastic dominance P[Q 1 Therefore, by replacing (49) and (50) in (48) we arrive at Next, from (6), q B (z) can be rewritten as q 1= Note that the first B+1 coefficients in the analytic expansion of the expression on the left side of the equation in (52) are equal to - B Thus, an estimate of the coefficients in the analytic expansion of the expression on the right-hand side of (52) will yield a bound on j- B k j. This estimate will be obtained in the remainder of the proof. First, observe that R B (z) has a zero of multiplicity c at z = 0 and s 1 (z) is a polynomial of degree c with no zeros at z = 0. Consequently, R B (z)=s 1 (z) is analytic in some neighborhood of z = 0 and it has a zero of order at least B + c at z = 0. Therefore, its analytic expansion R(z)=s 1 z i at equal to zero, i.e., Similarly, \Deltas B (z)=s 1 (z) is analytic in some neighborhood of z = 0 with its analytic expansion denoted as . Now, we intend to bound the coefficients b 2i (51) it easily follows that \Deltas B (z) O Next, notice that \Deltas B of D kn . Using this, we arrive at \Deltas B (z) l \Deltas B(z) and it can be expanded at into an analytic series \Deltas B(z) By replacing the z kX in (56) and then equating the coefficients next to z both sides of (56) we compute By combining equations (49) and (58) we conclude that for i - c Thus, (54), (55) and (59) yield Finally, from (52), (53) and (60) we compute This finishes the proof of the lemma. 3 7.3 Proof of Lemma 2 The idea for proving this lemma is to stochastically bound the finite buffer queue length random variable Q n with an infinite buffer queue having truncated arrivals. More precisely, let us define a sequence of truncated random variables Let Q B;B n be a queueing process characterized with a finite buffer B and truncated arrival process A B n . Then, by assuming that Q B;B 0 , and by using induction in n it follows that Q B;B Furthermore, if we denote by Q 1;B queueing process of an infinite buffer queue with truncated arrival sequence A B again by induction in n, it follows that Thus, Therefore, by passing n !1 in (63), we conclude that in stationarity Hence, the proof of Lemma 2 will follow if we show that the stationary distribution of Q 1;B satisfies Now, in order to prove (64) we first need to derive preliminary Lemmas 5 and 7. Similarly as in equation (36), the p.g.f. q 1;B (z) of Q 1;B . The above expression can be written in its equivalent form (the same as in (34)) (1) z i is the p.g.f. of a strictly ascending ladder height random variable. Lemma 5 If EA ! EC and P[C - there exists a universal constant such that for all B - 0, Proof: Again, Claim 1 shows that z c \Gamma z c x B has a simple zero at strictly inside the unit circle. These zeros are also the zeros of the polynomial in the numerator of (65) which we denote as note that x B since the d.f. of A B converges to the d.f. of A as B ! 1, Theorem 1, p. 219 of [7] implies that for any fixed k are the queue stationary probabilities that correspond to the (non-truncated) arrival sequence A n . Therefore 1. Hence, the zeros of N B (z) from within the unit circle converge to the corresponding of N(z) which are also inside the unit circle. If large enough such that for all all of the zeros z i are in the ffl neighborhood of one of the zeros z This implies that sup B-B 0 since all of the zeros for are strictly within the unit circle, we conclude that there exists a constant 1, such that sup Next, observe that by equating (66) with (65) we compute where and the constant Hence, we can obtain g B (z) by canceling the zeros in the numerator and denominator of (70). First, let us examine the coefficients of the polynomial x The coefficients of this polynomial x B;1 are positive and satisfy c Next, we investigate the coefficients of x x B;1 (z) already defined to be one of the roots from inside the unit circle. By expanding into an analytic series in the strip we arrive at z which, after comparing the coefficients on the left and right-hand side yields x B;2 This equality readily implies Finally, the monotonicity of P[A - i] yields Consequently, by repeating this procedure for the remaining c \Gamma 2 roots we derive jx B;c Finally, by combining the preceding bound and (70) we derive Furthermore, by (71) and (68) lim and therefor 1=h which when replaced in (72) completes the proof of Lemma 5. 3 At this point, in order to prove Lemma 7, we will need the following estimate on the distribution of a sum with uniformly bounded summands. be a sequence of nonnegative i.i.d. random variables and let then for any fixed n; c ! 1 1-i-n Proof: Observe that P[S n - B] can be decomposed as follows 1-i-n From the definition of subexponential distributions it follows that Next, note that Also, Finally, by replacing (74), (75), and (76) in (73) we obtain which concludes the proof of the lemma. 3 At this point, let fX 1g be a family of integer valued positive i.i.d. random variables with probabilities i]. For each B, X B has a finite support P[X B - fixed constant c. 1. If for all B, g B and A e 2 S then (i) for any fixed n (ii) for any ffl ? 0 there exist a finite constant K ffl such that for all B and n - 1 be sequence of nonnegative, integer valued random variables with probability mass function P[X easily follows 1-i-n where the last asymptotic relation follows from Lemma 6. This completes the proof of (i). To prove (ii) let us construct a sequence fY k ; k - 1g of integer valued i.i.d. random variables in the following way. First, choose an integer n 0 such that Then, assign to each Y k the following distribution ae 1 for Clearly, Y k is stochastically larger then X B k for all B, i.e., and Y k 2 S. Thus, where the last inequality follows from Lemma 2.10 of the Appendix of this special issue of Queueing Systems. This concludes the proof of Lemma 7. 3 Finally, we are ready to provide the proof of Lemma 2. Recall that the proof will follow if we show that (64) holds. First, observe that g B monotonically increases to g 1 is the workload of an infinite buffer queue with (non-truncated) arrival sequence A n . Hence, for any ffi 2 such that 1, we can choose B 0 such that for all Next, let us choose a d.f. for random variables in Lemma 7 to be P[X B it follows that for all where K 3 is the same as in Lemma 5. Thus, the condition of Lemma 7 is satisfied. Then, from equation (66), similarly as in (35), P[Q 1;B ? B] can be represented as (1))X (1) Hence, by (77), for all sufficiently large B Thus, by applying Lemma 7 (with ffl ? 0 such that (1+ ffl)(g 1 and the Dominated Convergence Theorem to the sum in (79) we derive which concludes the proof of the Lemma 2. 3 --R On the sojourn time of sessions at an ATM buffer with long-range dependent input traffic Applied Probability and Queues. Large claims approximations for risk processes in a Markovian environment. Tail probabilities for non-standard risk and queueing processes with subexponential jumps Regular Variation. Asymptotic Methods in Queueing Theory. Regular variation in a multi-source fluid queue Fluid queues with long-tailed activity period distributions Functions of probability measures. Intermediate regular and - variation Some results on regular variation for distributions in queueing and fluctuation theory. The Single Server Queue. On the M/G/1 queue with heavy-tailed service time distributions On the supremum from Gaussian processes over infinite horizon. Stochastic Processes. Large deviations and overflow probabilities for the general single-server queue with applications A limit theorem for the tails of discrete infinitely divisable laws with applications to fluctuation theory. An Introduction to Probability Theory and its Application Subexponential distributions. Overview of Internet traffic issues on the PSTN. Patterns of buffer overflow in a class of queues with long memory in the input stream. Heavy tails and long range dependence in on/off processes and associated fluid models. Source models for VBR broadcast-video traffic Subexponential asymptotics of a Markov-modulated random walk with queueing applications Asymptotic results for multiplexing subexponential on-off processes The effect of multiple time scales and subexponentiality of MPEG video streams on queueing behavior. Subexponential distributions and integrated tails. Subexponential distributions and characterizations of related classes. On the self-similar nature of Ethernet traffic "fractal" The stability of a queue with non-independent inter-arrival and service times Asymptotic behavior of a multiplexer fed by a long-range dependent process A storage model with self-similar input On the tails of waiting-time distribution Tail probabilitites for M/G/1 input processes (I): preliminary asymptotices. Performance decay in a single server queueing model with long range dependence. Activity periods of an infinite server queue and performance of certain heavy tailed fluid queues. Asymptotics of palm-stationary buffer content distribution in fluid flow queues Heavy traffic analysis for a multiplexer driven by M/GI/1 input processes. Asymptotic behavior of Wiener-Hopf factors of a random walk Asymptotic expansion for waiting time probabilities in an M/G/1 queue with long-tailed service time Teicher H. A fluid queue with a finite buffer and subexponential input. --TR --CTR Shahram Teymori , Weihua Zhuang, Queue analysis and multiplexing of heavy-tailed traffic in wireless packet data networks, Mobile Networks and Applications, v.12 n.1, p.31-41, January 2007 Sem Borst , Bert Zwart, Fluid Queues with Heavy-Tailed M/G/ Input, Mathematics of Operations Research, v.30 n.4, p.852-879, November 2005 Ward Whitt, Heavy-Traffic Limits for Loss Proportions in Single-Server Queues, Queueing Systems: Theory and Applications, v.46 n.3-4, p.507-536, March-April 2004 Weixin Shang , Liming Liu , Quan-Lin Li, Tail asymptotics for the queue length in an M/G/1 retrial queue, Queueing Systems: Theory and Applications, v.52 n.3, p.193-198, March 2006 A. Surez-Gonzlez , J. C. Lpez-Ardao , C. Lpez-Garca , M. Fernndez-Veiga , R. Rodrguez-Rubio , M. E. Sousa-Vieira, A new heavy-tailed discrete distribution for LRD M/G/ sample generation, Performance Evaluation, v.47 n.2, p.197-219, February 2002 Predrag Jelenkovi , Petar Momilovi, Finite buffer queue with generalized processor sharing and heavy-tailed input processes, Computer Networks: The International Journal of Computer and Telecommunications Networking, v.40 n.3, p.433-443, 22 October 2002
long-range dependency;finite buffer queue;M/G/infty process;long-tailed traffic models;fluid flow queue;network multiplexer;subexponential distributions
598167
Stability of Fluid Networks with Proportional Routing.
In this paper we investigate the stability of a class of two-station multiclass fluid networks with proportional routing. We obtain explicit necessary and sufficient conditions for the global stability of such networks. By virtue of a stability theorem of Dai [14] , these results also give sufficient conditions for the stability of a class of related multiclass queueing networks. Our study extends the results of Dai and VandeVate [19] , who provided a similar analysis for fluid models without proportional routing, which arise from queueing networks with deterministic routing. The models we investigate include fluid models which arise from a large class of two-station queueing networks with probabilistic routing. The stability conditions derived turn out to have an appealing intuitive interpretation in terms of virtual stations and push-starts which were introduced in earlier work on multiclass networks.
Introduction In the last decade, there has been an explosion of research and interest in multiclass queueing networks and their uid counterparts. Multiclass queueing networks are stochastic processing networks which are often more suitable than traditional queueing systems for modeling highly complex manufacturing, communication, and computer systems. In a multiclass network, customers at a station may be non-homogeneous, both in terms of their service requirements and their routing behavior after completing service at a station. Such multi-class networks provide then a more general framework then the classical models of Jackson [23] and Kelly [25]. Unfortunately, achieving a rened probabilistic analysis of multiclass networks is generally an intractable problem. Instead, recent research has focused on determining when such systems are stable. Roughly speaking, a system is stable if it has enough resources to handle incoming work, while operating under a set of scheduling policies. Unfortunately, many examples given earlier in the literature (see [27], [29], [31], [5], [32]) have demonstrated that simply analyzing the stability of multiclass networks can be a non-trivial matter. The study of stability of multiclass networks received a tremendous boost, however, when the early work of Rybko and Stolyar [31] and later work by Dai [13, 14], Meyn [30], and Stolyar [33] showed that an approximation known as the uid model could serve as a very powerful tool in determining the stability of stochastic networks. As a consequence of this newly developed theory, there has been a urry of results for both uid and stochastic models. Of particular interest among researchers have been the stability properties of networks under priority disciplines (Dai and Weiss [20], Chen and Zhang [12], Dumas [21]) and the rst- come-rst-served discipline (Chen and Zhang [11], Bramson [6]). Great strides have also been made in investigating the stability of networks under more complex dispatch policies (Kumar and Kumar [28], Kumar [26], Bramson [7]) and for networks with additional enhancements such as setup times and batch processing (Jennings [24], Dai and Li [17]). In this paper, we are interested in analyzing the global stability region, which is the set of arrival and service rates under which a given network is stable under any non-idling dispatch policy. In this direction researchers have been fairly successful in obtaining some general results [18,3,22], although a paper by Dai, Hasenbein, and VandeVate [16] provides some indication of the limitations of current approaches. Perhaps the most sweeping advance in understanding the global stability properties of multiclass networks was provided in a paper by Dai and VandeVate [19]. This papers provided exact (i.e. necessary and su-cient) stability conditions for all two-station uid networks with non-branching (de- routing. Such systems are sometimes called multitype networks. In particular, the stability conditions are given explicitly in terms of the service and arrival rates of the network. More importantly, they were able to provide an intuitive explanation of these conditions via the phenomena of push-starts and virtual stations. A major consequence of their results is that for the class of networks they study it turns out that the global stability region is determined by the stability properties under a comparatively simple, nite set of policies known as static buer priority disciplines. In establishing these conditions for two-station uid networks, they also were able to provide, in some cases, exact stability conditions for the corresponding queueing networks. At about the same time, Bertsimas, Gamarnik, and Tsitsiklis [3] independently developed an LP which could sharply determine the stability region of all two-station multiclass uid networks, including networks with proportional (probabilistic) routing. The results of Bertsimas, et. al. are valid for a larger class of networks, but do not provide as much insight, since the stability region is not expressed as an explicit function of the rates in the network in [3]. The results in this paper attempt to narrow the gap between the results of Bertsimas et. al. and Dai and VandeVate's work on two-station uid networks. Specically, we derive necessary and su-cient conditions for global stability of a large class of uid networks with proportional routing. These conditions are given explicitly in terms of the eective arrival and service rates of the network. Once again, these conditions can be explained intuitively in terms of push-starts and virtual stations. As in Dai and VandeVate's study, this also establishes the importance of the static buer priority policies for the larger class of networks we investigate. In particular, our results imply that the global stability of such systems is determined by the stability under the set of static buer priority policies. The uid networks we study arise from uid approximations of multiclass queueing networks with probabilistic routing. Thus, the conditions we derive, in some cases, yield necessary and su-cient conditions for the global stability of the associated stochastic networks. One nal point to note is that Bertsimas, Gamarnik, and Tsitsiklis [4] have recently demonstrated that fundamental performance parameters of Markovian multiclass networks are intimately related to the phenomena of virtual stations and push-starts. In particular, they show that certain upper bounds on the tail probabilities and expected value of the queue-length process can be derived from the piecewise linear Lyapunov functions used in Dai and VandeVate [19]. It is conceivable that their work can be extended to the class of networks considered in this paper. We now give a rough outline of the paper. Section 2 provides the framework for the models we will be studying. In Section 3 we dene a number of submodels which will be important in our analysis. We introduce some notation specic to two-station uid networks in Section 5. Sections 6 through 9 are devoted to proving the su-ency part of our main theorem. The necessity is proven in Section 10, completing the proof of our main result. Finally, in Section 11 we discuss some examples and directions for further research. 2. Fluid Networks In this section we introduce the notion of a multiclass uid network. A uid network is a continuous deterministic dynamical model that is an analog to a discrete multiclass queueing network. In the uid network the notion of discrete customers is replaced by the notion of uids or customer mass. Sometimes we will discuss the queueing network associated with a particular uid model. By this, we mean a queueing network with same number of stations and classes, and with the same mean service, arrival, and routing parameters. A more precise description of uid models and associated queueing networks can be found in Dai [13]. All of the formal results in our paper are for uid networks, which we now dene more precisely. The uid networks in this paper consist of two processing stations, A and B, and K classes of uids that are processed at the two stations. Fluid of class k arrives from the outside at rate k 0. Also, class k uid requires processing at station (k) and can be processed at the maximum rate of 0 < k < 1 if station devotes all of its eort to processing class k uid. Note that in general multiple classes may be served at the same station. We will call m the service time for a class k is the time it takes to process one unit of uid. After class k uid is processed at a station it is routed to another station or stations according to the routing matrix P . If p then all of the class k uid is routed to class '. In the case where 0 < p k' < 1, we have proportional routing in our network, i.e. a proportion p k' of class k uid is routed to class '. This proportional routing is analogous to probabilistic routing in an associated stochastic network. Any uid that is not routed to another class leaves the network. Hence, we have that a proportion 1 class k uid directly exits the network. Our study will be restricted to open uid networks, i.e. we assume that the routing matrix P has spectral radius less than one. One consequence of this assumption is that the matrix (Id P 0 ) is invertible and where Id is the identity matrix. In an associated queueing network, such a restriction implies that all customers will eventually leave the network. Let us denote the amount of class k uid in the network at time t by Q k (t) and let T k (t) denote the amount of time server (k) devotes to class k uid in the interval [0; t]. The allocation process T () will depend heavily on the dispatch policy employed in the network. With these denitions we are ready to write down the dynamical equations for our uid network. The vectors Q(), T (), and are all assumed to be column vectors, as are all subsequent vectors in this paper. Furthermore, all vector equations are assumed to hold componentwise. is nondecreasing for 1 k K (2.3) nondecreasing for each station i (2.4) diag() is the diagonal matrix of the service rates and A pair of vector-valued functions (Q(); T ()) which satisfy (2.1){(2.4) is called a uid solution. It can be shown (see [20]) that as functions of time, Q() and T () are both Lipschitz continuous and hence absolutely continuous. Therefore each uid solution (Q(); T ()) has derivatives almost everywhere with respect to time under the Lebesgue measure. We call a time point t 2 [0; 1) regular if (Q(); T ()) is dierentiable at t. A non-idling policy is one in which station i must work at full speed whenever there is a positive uid level at station i. We can express this constraint on the allowable allocation processes by where A non-idling uid solution (Q(); T ()) is one which satises (2.1){(2.5). We now describe the class of static buer priority (SBP) disciplines for uid networks. A SBP discipline is specied by a permutation of the classes in the network. Classes listed rst in the permutation have higher priority than those listed later. Hence, under , the classes at a station are assigned a xed ranking, and the server cannot devote any eort to processing class k uid unless the uid level is zero for all classes with a higher ranking. If class k has a higher priority than class ', under , then we write (k) < ('). For the uid network, it is easier to describe a static buer priority policy with the following additional denitions: A uid network operating under a static buer priority policy must obey: So, a non-idling uid solution (Q(); T ()) for a uid network operating under SBP discipline satises (2.1){(2.5) and (2.10). 2.1. Stability We now wish to discuss some notions of stability of a uid network. In order to do so, we need to dene the concepts of eective arrival rates and tra-c intensity. For each class k, the eective arrival rate k indicates the long-term arrival rate of uid to class k, due to both internal and external contributions, that we would expect if the system is in a steady state. We expect such an arrival rate to satisfy the following vector tra-c equation: Due to our assumption on P , equation (2.11) always has a unique solution. We thus dene the vector of eective arrival rates as: Next, for We will refer to i as the nominal workload or tra-c intensity for server i. We now dene some notions related to the stability of a uid network. Denition 2.1 A uid network is globally stable if there exists a nite time - > 0 such that for each non-idling solution (Q(); T ()) with all t -. Denition 2.2 A uid network under a static buer priority discipline is stable if there exists a time - > 0 such that for each uid solution (Q(); T ()) satisfying and (2.10) with It is well-known (see, for example, Chen [9]) that no uid solution is stable unless the tra-c intensity or work arriving per unit time for each station is less than 1, i.e. The conditions in (2.12) are often called the usual tra-c conditions. We see that these conditions are necessary for global stability of the uid network. Our primary interest in this paper is to derive necessary and su-cient conditions for global stability for a class of two-station uid networks. A primary motivation for studying the stability of multiclass uid networks is the main theorem of Dai [13]. Roughly speaking, Dai's Theorem states that if the uid model is globally stable, then any associated queueing network will also be globally stable, modulo some technical conditions on the distributions. Hence the global stability conditions given in this paper are also su-cient for global stability of the associated queueing models. Whether they are also necessary for global stability of queueing networks is an open question, which we discuss further in the last section. 3. Submodels We will nd it useful in subsequent sections to deal with a number of special cases or submodels, of a general multiclass uid network (MFN), which was described in Section 2. These submodels are primarily dierentiated by the type of routing scheme or routing matrix allowed. The rst denition is adapted from Chen and Yao [10], which studies networks with an acyclic transfer mechanism. Figure 1. An acyclic transfer mechanism network Denition 3.1 Let i.e. I(k) is the set of classes from which k is reachable. A multiclass uid network is said to be an acyclic transfer mechanism network (ACTN) i k 62 I(k) for all Essentially, uid in an ACTN cannot pass through any given buer more than once. A network that is an ACTN is depicted in Figure 1. Denition 3.2 A multiclass uid network is a strictly branching network (SBN) if It is an ACTN. For every class k there exists at most one class ', such that p 'k > 0. For every class k; k > 0 i there are no classes ', such that p 'k > 0. Figure 2. A strictly branching network A SBN, is then a uid network in which each class incurs arrivals (either internally or externally) from only one source. A simple example of a strictly branching network is pictured in Figure 2. Note that the network in Figure 1 is not a SBN. The class of SBN's will be the main focus of study in this paper. Later on, we will see that for the purposes of global stability analysis, the class of ACTN's and SBN's are equivalent. Denition 3.3 A multiclass uid network is a multi-type network (MTN) if It is a strictly branching network. p 'k is 0 or 1 for every 1 '; k K. A uid MTN can be associated with a multiclass queueing network which employs deterministic routing, i.e. there are a number of products types, each of which follows a deterministic route through the network. Hence, a uid MTN does not employ proportional routing. A simple MTN is portrayed in Figure 3. An MTN with only one type of uid is often referred to as a reentrant line. At times, we will need to consider the split network equivalent or SNE of a strictly branching network. The SNE is a multitype network in which there is a type for every possible route in the original network. The service rate for each class in the SNE is the same as in the original network, however, the arrival rates are set to the eective arrival rate of the exit class of each possible route in the original network. The SNE of the network in Figure 2 is pictured in Figure Figure 3. A multi-type network 3. Note that the original proportional route is split into two non-proportional (deterministic) routes. Furthermore, we set m in the SNE. The term \equivalent" may be misleading. It is tempting to think that the global stability conditions for the SNE are the same as the original network, but this is not the case. The relation between the SNE and the original network is discussed further in Section 10. 4. The Minimum Flow Problem We reproduce a review of the Minimum Flow problem from Dai and Van- deVate [19], since it will play an important role in proving our su-ciency result. See Ahuja et al. [1] for further background on network ow problems. Consider a directed network (N; E) with node set N and edge set E. We distinguish two vertices s, the source, and t, the sink. Given (possibly innite) lower bounds we wish to nd a minimum ow from the source s to the sink t subject to ow conservation constraints and edge capacity constraints. Thus, the minimum ow problem is: subject to x sj for each node i 2 N n fs; tg (4.2) x tj each edge (i; Suppose (x; v) satises (4.1){(4.4). We refer to the vector x as a feasible ow and the value v as the value of the ow x. A minimum ow is a feasible ow with smallest value among all feasible ows. An s; t-cut in the network (N; E) is a partition of N into two sets S and T with s 2 S and t 2 T . The capacity of the cut (S; T ), denoted c(S; T ), is: (i;j)2E:i2S;j2T (i;j)2E:i2T;j2S Note that our denition of capacity interchanges the roles of upper and lower bounds in the usual denition as applied to the maximum ow problem. This denition is appropriate for the minimum ow problem and is sometimes referred to as the oor of a cut. A maximum s; t-cut is one with largest capacity among all s; t-cuts. Theorem 4.1 is a classic result of network ows and can be found in Ahuja et. al. [1, Exercise 6.18, pp. 202]. Theorem 4.1. The value of a minimum ow equals the capacity of a maximum s; t-cut. 5. Strictly Branching Two-station Networks In this section we narrow our focus to the class of two-station uid SBNs. This class of models will be the primary focus of study for the remainder of the paper. Recall that we have arbitrarily labeled one station A and the other station B in our uid network. With the routing restriction on a SBN, we can think of the network as serving a set of I dierent uid types. After a uid type is processed at a station, it is then proportionally routed to any number of other classes for service. Since the routing structure does not allow a uid to revisit a class, we can label each type with a nite set of class labels. For notational ease, we append a type label and speak of class (i; uids. Accordingly, we also add a type label to the k and i k . Finally, we dene i.e. A i is the set of classes of type i, served at station A. The routing in a SBN induces a special structure on the classes in the net- work. Within a type i if class (i; must be visited before class (i; j), then we will write (i; or in some contexts, simply k j. So, we see that the routing induces a partial order on the classes in the network and that satises the usual partial order relations. Specically, note that within a uid type, two arbitrary classes need not possess the trichotomy property (k j or k j or unlike the case in a multitype network. Also, by our denition, the minimal element within a type is the only one that has a nonzero exogenous arrival rate. It will be useful to group sets of classes at a station into possible excursions, which are blocks of consecutive visits to a station. Since we allow proportional routing, possible excursions may overlap one another. We use the \possible" since it is perhaps useful to envision excursions in queueing paradigm, where the number of consecutive visits a customer makes to a station may be random due to probabilistic routing. In the remainder of the paper, we will use the terms excursion and possible excursion interchangeably. In Figure 4, there are two possible excursions at station A, one consisting of class 1 only and one consisting of classes 7, 8, and 9. At station B there are also two possible excursions, one consists of classes 2 and 3, which occurs if the uid (customer) leaves station B after its service at class 3. The other possibility is an excursion which includes classes 2 through 6, which occurs if the customer remains at station B after its service at class 3. In particular, we note that the classes 4, 5, and 6 alone do not comprise a possible excursion. We will let E denote the set of all possible excursions and E i the set of all possible excursions for type i uid, where i 2 I. For each i, we will further partition A and E i B , which are the set of type i possible excursions at stations A and B, respectively. In Figure 4 there is only one type of uid, so A consists of all the excursions at station A, which encompass classes 1, 7, 8, and 9. Figure 4. A strictly branching example Next, the e th excursion of type i classes will be denoted by [i; e] and the classes in excursion [i; e] will be denoted by E[i; e]. Note that, unlike the case in an MTN, there is no unique way to number the excursions. We will assume that the excursions are numbered in an arbitrary, but xed manner, given a specic network topology. Furthermore, any possible excursion which contains a class k with k > 0 is known as a rst excursion. In Figure 4 the only rst excursion is the excursion consisting of class 1. Next note that each set E[i; e] can be further divided into the last class in the excursion '[i; e] and the rest of the classes f [i; e], called rst classes. When we deal with a set of excursions, we will use curly braces to indicate this. For example, the set of possible excursions that directly follow excursion [i; e] will be denoted by fi; e g. Also, we let denote the set of classes which are in and which are not last classes in any possible excursion. We need to introduce some denitions related to excursions in order to state our results succinctly: Denition 5.1 A set X of excursions such that for each type then is said to be separating. A separating set X is called A-strictly separating if it contains no rst excursions at station A. We dene B-strictly separating sets similarly. Note that the set of excursions at station A is B-strictly separating and the set of excursions at station B is A-strictly separating. We call these two sets trivial separating sets. Denition 5.2 Each separating set S of excursions induces a collection V (S) which is described by the following: is the set of rst classes which follow excursion [i; e] and occur at a dierent station than [i; e], is the set of rst classes which follow excursion [i; e] and occur at the same station as [i; e]. When S is strictly separating we refer to V (S) as a virtual station. Denition 5.3 We use the notation E to denote a collection of excursions which have the property that for any two classes (i; which are in E and which are not contained in the same excursion, we have (i; We refer to such a set of excursions E as an antichain. Next, we let F (E) denote the collection: We let F (E) denote the collection: We also adopt the notation, that for each subset of classes X: (i;k)2X We are now prepared to state the main theorem of the paper, which is the Theorem 5.1. A two-station uid SBN is globally stable i A < 1, B < 1 and for each antichain E and each separating set S, we have A (E)) A (E)) We will refer to these conditions as virtual workload conditions. If such a virtual condition is violated for set of classes, we call this set of classes a virtual bottleneck. 6. The Lyapunov Function Clearly, it is di-cult to investigate directly the behavior of all admissible uid solutions to (2.1){(2.5) in order to analyze the global stability of the networks under study. Instead, we introduce the concept of a Lyapunov function to aid in the analysis. Suppose we can nd a function G() of the uid level vector Q(t) such that non-idling uid solutions Q(t) and all t > -, where - is a xed time greater than zero. Such a function G() is called a Lyapunov function for the uid model. It is clear from the denition of stability that a uid network is globally stable if a Lyapunov function exists for the network. In this section, we introduce the class of piecewise linear Lyapunov functions that we will use to prove the su-ciency of the conditions in Theorem 5.1. This Lyapunov function is a natural extension of the function used by Dai and VandeVate [19] and we will follow their methodology closely, making appropriate alterations where needed. First, we let Z i k (t) denote the amount of uid that is in the network at time t and will receive class (i; service eventually: where D i k (t) is the amount of class (i; uid that has been serviced in the interval [0; t]. For a general multiclass uid network, as dened in (2.1){(2.4), we would Q(t). For an SBN it is always possible to label the classes such that (Id P 0 ) 1 is lower triangular, allowing us to write Z(t) in the more explicit form above. In fact, crucial steps in the proof of Theorem 5.1 rely on this special structure, which is why we restrict our study to the class of SBNs. Now, for a given x > 0 we dene: where i2I GB i2I If we set x i k for each class (i; k), then we can interpret GA (m; t) as the total workload for station A in the system at time t. Thus, in general GA (x; t) is the total weighted workload in the system at time t for station A. We would like to check for which values of x i k the G(x; t) as dened above will be a Lyapunov function. Theorem 6.1, originally proven in Dai and Weiss [20], simplies this analysis. Theorem 6.1. Suppose there exist an x > 0 and > 0 such that G() satises the following: i2I i2I @t whenever i2I @t whenever i2I where the derivative conditions hold only at regular points t, then G(x; t) is a We will refer to (6.3){(6.6) as the Dai-Weiss conditions. 7. A Linear Programming Formulation Now, modifying the development in Dai and VandeVate [19] we can transform the problem of nding weights x for which G() will satisfy the Dai-Weiss conditions into checking the feasibility of a linear programming problem. We start by transforming the conditions (6.3) and (6.4) into inequalities involving the parameters x. First, we note that when i2I GA reduces to: i2I i2I and GB becomes: i2I i2I for each i 2 I and Multiplying through by i j we obtain: again for each i 2 I and . Since we only consider non-negative x, it is su-cient to require (7.2) hold only for I and each possible excursion [i; e] at station B. Similarly, enforcing (6.4) yields: I and for each possible excursion [i; e] at station A. Note that above we used the fact that each possible excursion can be identied by a unique last class. We next transform the Dai{Weiss derivative conditions (6.5) and (6.6) into inequalities involving x. When i2I the non-idling conditions require: i2I _ We also have, _ i2I _ i2I _ i2I i2I _ GA (x; t) for each D(t) satisfying (7.3) i: i2I for each i 2 I and j 2 A i , since the second summand in (7.6) is a non-negative convex linear combination of the terms on the right-hand side of the equation above. Similarly, (6.6) will be satised i i2I for each i 2 I and We now combine the four sets of inequalities derived above to yield the following maximize (7.7) subject to: A (7.9)@ X i2I i2I The LP above is easier to work with if we set i k to obtain the transformed linear program (TLP): maximize (7.13) subject to: I and (7.14) excursion I and (7.15) excursion i2I i2I We note that if a strictly branching network has yield loss only (i.e. for all only one class (i; j)) then the above TLP has the same form as the Dai-VandeVate LP and thus Theorem 5.1 follows immediately from their results. The terminology \yield loss" comes from the queueing context. A queueing network with yield loss only is one in which customers essentially follow a deterministic route, except that there may be some positive probability that a customer will exit the network after the completion of any stage of work (due to a manufacturing defect, for example). The next proposition follows as an immediate generalization of Proposition 4.1 in Dai and VandeVate [19]: Proposition 7.1. If the TLP given by (7.13){(7.18) has unbounded objective values, then each solution (x; ) with > 0 provides weights x > 0 such that G(x; t) is a Lyapunov function for the uid network. 8. A Network Flows Formulation With the TLP in the previous section, we have reduced the stability analysis of our uid network to the problem of checking the nature of the solutions to a linear program. In fact, we can further simplify the analysis by making some useful observations which allow us to transform the TLP into a parametric net- work ow problem. Since the analysis again closely follows the Dai-VandeVate framework, we only provide an outline for some of the steps. As in the Dai-VandeVate analysis, we observe that the constraints of the dene a cone. Thus, if there is one positive solution, then there is a solution which satises: i2I i2I As in the Dai-VandeVate framework, we can treat as a parameter and then express (7.16) and (7.17) as follows: Next, we add slacks e ) and write (7.14){(7.15) as: I and (8.5) excursion I and (8.6) excursion A . For each possible excursion [i; e] at Station B, we take its corresponding equation of the form of (8.5) and add to it all equations of the type (8.6) that correspond to successor excursions in fi; e A g and subtract all equations of the type (8.5) that correspond to successor excursions in fi; e g. Consistent with our earlier notation, we let A g denote the set of possible excursions at Station A which directly follow excursion [i; e]. We dene similarly. We next multiply by -1 to obtain: A A Similarly, we obtain A e A for excursions [i; e] at station A. These transformations give us the following network ow problem: maximize (8.7) subject to: A g e A g for A A A for i2I i2I The network ow problem above can be characterized as follows. It has: A node for each possible excursion [i; e] corresponding to (8.8) and (8.9). A node for station A and station B corresponding to (8.10) and (8.11). A node called the root corresponding to the redundant constraint s iX obtained by adding (8.8){(8.11) and multiplying by -1. The edges in the network are the following: 1. An edge from the node for station A to the node for possible excursion [i; e] at station A. This corresponds to the variable y '[i;e] and has lower bound '[i;e] . 2. An edge from the node for possible excursion [i; e] at station B to the node for station B. This corresponds to the variable y '[i;e] and has lower bound '[i;e] . 3. An edge from the node for station A to the node for possible excursion [i; e] at station B for each class (i; A g. These edges correspond to the variables y i k for the classes in A g. The edge for class (i; k) has lower bound i k . 4. An edge into the node for station B from the node for possible excursion [i; e] at station B for each class (i; B g. These edges correspond to the variables y i k for the classes in g. The edge for class (i; lower bound i k . 5. An edge from the node for possible excursion [i; e] at station A to the node for station B for each class (i; B g. These edges correspond to the variables y i k for the classes in g. The edge for class (i; k) has lower bound i k . 6. An edge into the node for possible excursion [i; e] at station A from the node for station A for each class (i; A g. These edges correspond to the variables y i k for the classes in A g. The edge for class (i; k) has lower bound i k . 7. An edge from the node for station A to the root for each class (i; served at station A. These edges correspond to the variables y i k for the classes in f[1; i] served at station A. The edge for class (i; k) has lower bound i k . 8. An edge from the root to the node for station B for each class (i; served at station B. These edges correspond to the variables y i k for the classes in f[1; i] served at station B. The edge for class (i; k) has lower bound i k . 9. An edge from the node for excursion [1; i] at station A to the root. This edge corresponds to the variable s i 1 and has lower bound 0. 10. An edge from the root to the node for excursion [1; i] at station B. This edge corresponds to the variable s i 1 and has lower bound 0. 11. An edge from the node for each possible excursion [i; e] at station A to the node for the preceding excursion (which is unique) at station B (if [i; e These edges correspond to the variables s i e and have lower bounds 0. 12. An edge from the node for each possible excursion [i; e] at station A to the node for the preceding excursion (which is unique) at station A (if [i; e A i ). These edges correspond to the variables s i e and have lower bounds 0. 13. An edge to the node for each possible excursion [i; e] at station B from the node for the preceding excursion (which is unique) at station A (if [i; e A i ). These edges correspond to the variables s i e and have lower bounds 0. 14. An edge to the node for each possible excursion [i; e] at station B from the node for the preceding excursion (which is unique) at station B (if [i; e These edges correspond to the variables s i e and have lower bounds 0. 15. An edge from the node for station A to the node for station B. This edge corresponds to the variable and has lower bound 0. The remainder of this section parallels the development in Dai and Vande- Vate [19]. Hence, we merely introduce the notation needed for our more general class of networks and outline the arguments. For a more complete development, the reader should refer to the aforementioned work. As in Dai{VandeVate, we convert our problem into a Minimum Flow Prob- lem. We retain some other Dai{VandeVate conventions. Given an A; B-cut (L; R), we let LA denote the excursions in L that are served at Station A and LB denote those served at Station B. Similarly, we let RA denote the excursions in R served at Station A and RB denote those at Station B. We refer to an A; B-cut with the root in L as an L-cut. An A; B-cut with the root in R is a R-cut. Note that since the upper bound on each edge is innite, an R) in this network has nite capacity if and only if no edge extends from a node in R to a node in L, i.e., if and only if (L; R) satises: 1. If [i; e] 2 LA , then possible excursions A g are in LA , 2. If [i; e] 2 RB , then possible excursions are in RB , 3. If [i; e] 2 LB , then possible excursions A g are in LA , 4. If [i; e] 2 RA , then possible excursions are in RB , 5. If (L; R) is an R-cut, then [i; 1] \ 6. If (L; R) is an L-cut, then [i; 1] \ Otherwise, the capacity of the cut is 1. Therefore, we now have the following lemma, which is framed in terms of separating sets. Lemma 8.1. An L-cut (L; R) has nite capacity only if LB [RA is an A-strictly separating set. Similarly, an R-cut (L; R) has nite capacity only if LB [ RA is a B-strictly separating set. We can proceed as in Dai and VandeVate to obtain the theorem below, which expresses the stability of the network in terms of the \cut conditions." Theorem 8.2. A two-station SBN with service times m and eective arrival rates satisfying the nominal workload conditions is globally stable if for each non-trivial A-strictly separating set S 0 and non-trivial B-strictly separating set S, We call the conditions in (8.15) the cut conditions. 9. Su-ency of the Virtual Workload Conditions In this section we prove the following lemma that, in conjunction with Theorem 8.2, proves the su-ciency part of Theorem 5.1. Lemma 9.1. Consider a two-station SBN with given eective arrival rates and service times. If the arrival rates and service times satisfy the virtual workload conditions as given in (5.1), then they also satisfy the cut conditions (8.15). Proof. Each cut condition is dened by a pair of non-trivial separating sets, S and S 0 . We show that the cut conditions induced by the pair (S; S 0 ) is implied by a pair of virtual workload conditions. We rst need to chose an antichain E , which is induced by the pair (S; S 0 ). For each type i, we choose a set E i that will usually contain several elements, due to the branching nature of our networks. In the multitype case, E i contains only one element for each i 2 I. We now specify how the set E i is chosen. For each type, consider the SNE. Any class that is in S or S 0 in the original network remains in these sets in the SNE. For each type i in the original SBN, we now have a number of sub-types in the corresponding SNE, one for each possible route in the original network. Let (i; j) be a sub-type of type i from the original SBN and let J i be the number sub-types of type i. For each (i; j), we chose an index j according to the following modied Dai-VandeVate rules. We let ^ be the largest index r such that 1. 2. 3. [i; r] 62 S 0 . For each (i; j), we chose another index e i similarly, letting e i j be the largest index r such that 4. 5. 6. Now, for each (i; j), we set r i g. We then let Note that the r i 's need not be distinct. We set We note that the set E is an antichain and has the following properties: c) d) These properties allow us to go through analogous algebra to Dai and Van- deVate to obtain the cut condition from the virtual workload conditions. The antichain E and the separating set S 0 induce the virtual workload condition: A (E)) A (E)) Similarly, E and the separating set S induce the virtual workload condition: A (E)) We show that (9.1) and (9.2) imply the cut condition for the pair (S From (9.1) we have that A (E)) A (E)) and from (9.2) we have that A (E)) m(VA (S) n F A (E)) A (E)) Thus, A (E)) m(VA (S) n F A (E)) A (E)) Now, (a) implies A (E)) m(VA (S)): Next we note that we have the following 1. directly from (d) 2. directly from (e) 3. ;, from 1. Recalling the denition of V (S), the above imply that Thus, we have Once again from (a) we have Using a similar argument as before, we have that (b) and (c) imply, Thus, (9.3) implies that which is exactly the cut condition for the pair S 0 and S. 10. Necessity The su-ciency of the conditions in Theorem 5.1 was proved in the last several sections. We now turn our attention to proving the necessity via the next few lemmas. The necessity essentially follows from Dai and VandeVate's arguments with minor adjustments. The rst lemma we need is Lemma 7.1 from Dai and VandeVate [19]: Lemma 10.1. Let C be a set of classes such that Each non-idling uid solution (Q(); T ()) satisfying (i;k)2C _ for each regular point t is unstable. Proof. The proof for the class of networks we consider is analogous to that given in Dai and VandeVate. The set C in Lemma 10.1 represents classes that form a virtual station. Under an appropriate static buer priority policy, only one of the classes in C may be served at any time in any queueing network which corresponds to the uid model (i.e. a network which has the same topology and mean arrival and service rates). Next, we adapt another lemma from Dai and VandeVate [19] to networks with proportional routing. This lemma enables us to consider the eect of \push- starting" some set classes that occur early in the route of a uid type. We consider a collection of excursions E that partitions the classes into those of F (E) and the remainder that we denote as R(E). Let ~ A (E)) for (i; ~ for (i; Consider the induced uid model on the classes of R(E): k () is nondecreasing; (i; (i;k)2R A (E) k (t) is nondecreasing; (10.6) k (t) is nondecreasing; (10.7) (i;k)2R A (E) _ (i;k)2R A (E) _ where, ~ k for (i; R(E). For each type i 2 I, we let ~ and T i to model the arrivals to the induced uid network. Note that in the induced network the eective arrival rates to the remaining classes are the same as in the original network. Lemma 10.2. If the uid model (10.4){(10.9) is unstable, then the uid model for the full uid network is unstable. Proof. The proof of this lemma is again analogous to the proof of Lemma 7.2 in Dai and VandeVate [19]. Proof. [Necessity Proof of Theorem 5.1] With Lemma 10.2 in hand, it is su-cient to show that if the virtual station V (S) corresponding to some strictly separating set S satises then there is an unstable uid solution. The set of classes V (S) is a virtual station in any corresponding queueing network and so there exists a static buer priority policy under which no two classes in V (S) can be served simultaneously. A description of virtual stations and a generalization known as pseudostations, plus details on the construction of such a static buer priority policy can be found in Hasenbein [22]. [Pseudostations have also been referred to in the literature as K-virtual stations [4] and were investigated independently by Bertsimas [2]]. Thus, if we examine uid limits (Q(); T ()) of the type dened in Dai [14], we see that they are uid solutions which satisfy (10.1). By Lemma 10.1, the uid network is not globally stable. This completes our necessity proof and the proof of Theorem 5.1. 11. Examples and Conclusions We rst give an example of the application of Theorem 5.1. The uid network depicted in Figure 2 is in the class of strictly branching networks and hence we may apply Theorem 5.1 to obtain the following corollary. Corollary 11.1. Consider the uid network of Figure 2 with parameters and (m The uid model is globally stable if and only if the following four conditions hold: The rst two conditions are the usual tra-c conditions. The third conditions is a virtual workload condition induced by the virtual station consisting of classes 2, 4 and 6. The fourth condition is a \push-start" condition induced by the antichain 2g and the virtual station f4; 6g. Next, we note that Theorem 5.1 is stated only for networks which are SBNs. We now brie y outline arguments indicating that the theorem actually holds for any ACTN. We rst claim that any ACTN can be equivalently relabeled as an SBN by adding a nite number of class labels. For example, if more than one class feeds a particular buer, we simply divide the incoming uid into dierent buers, depending on the buer in which the uid was last processed. Figure 5 gives an example of an ACTN relabeled as a SBN. Add class labels to obtain a strictly branching network Figure 5. An ACTN relabeled as an SBN. Once the network has been relabeled, we note that we can identify any uid solution (Q(); T ()) in the original network, with a corresponding unique uid solution ( ~ T ()) in the new network and vice versa. The main point to note here is that in the original ACTN, the set of non-idling policies include those which determine processing priority at a buer based on the processing history of the uids in that buer. Thus any allocation policy implemented in the SBN can also be implemented in the ACTN. In terms of global stability, the ACTN and corresponding SBN are equivalent. Hence, Theorem 5.1 provides necessary and su-cient conditions for global stability of any ACTN, after performing the appropriate transformation to an SBN. We have derived necessary and su-cient stability conditions for two-station uid networks, provided that these networks were restricted to the class of acyclic transfer mechanism networks, essentially a class of networks that does not allow revisits to a class. In fact, our results could actually be extended further to any uid network which allows only a nite number revisits to a class, since such a network could be equivalently relabeled as an ACTN. Practically speaking, this should be a perfectly satisfactory class of networks to model real-life situations (since jobs rarely make an innite number of revisits in the factory). However, this still leaves one with a theoretical yearning to extend the theory to the full class of two-station uid open multiclass networks. Unfortunately, the methods used to demonstrate the su-ciency of the conditions in Theorem 5.1 cannot be directly extended to a larger class of networks. Our ability to transform the TLP of Section 7 into a network ow problem relies on the fact that in any SBN, the classes can be labeled such that the routing matrix P is upper triangular. For example, consider the network shown in Figure 6. If network is an ACTN and we can obtain the stability region via the methods outlined in this paper. However, if q 2 (0; 1), then the network shown is not in the class of ACTN's and in fact we can derive an LP as in Section 5, but it can be shown that this LP cannot be transformed into a network ow problem. One possible way to overcome this di-culty is to model a more general network as a SBN with an innite number of classes. In this case, we can again write down a similar LP and transform it into a network ow problem with an innite number of nodes. Of course, the problem then lies in showing that the capacity of this network is determined by only a nite number of cut conditions. While this route seems promising, it appears di-cult to carry out. If this analysis were successful, it would essentially complete our understanding of the global stability properties of two-station uid networks and fully complement the results of Bertsimas, et. al. [3]. A further point to be noted is that our results are valid only for uid net- works. For the corresponding class of queueing networks, our knowledge is still lacking. The results of Dai and VandeVate [18] and Hasenbein [22] imply that our conditions are in fact necessary and su-cient for two-station queueing net- Figure 6. A non-ACTN uid network works whose uid model is an ACTN if the stability conditions involve virtual stations only (no \push-start conditions"). Unfortunately, recent examples given by Bramson [8] and Dai, Hasenbein, and VandeVate [15] indicate that stability conditions for the uid model may not always coincide with those in the queueing model. In this respect, the full connection between the stability of the stochastic and uid models still needs to be explored. Acknowledgments : The author would like to thank, Jim Dai and John VandeVate, for support and input while performing this research. A portion of this paper was written while John Hasenbein was visiting the Centro de Inves- tigacion en Matematicas (CIMAT) in Guanajuato, Mexico. He would like to thank CIMAT and the National Science Foundation, who jointly provided an International Research Fellowship (NSF Grant INT-9971484), which made this visit possible. --R Network ows: theory Lecture notes on stability of multiclass queueing networks. Stability conditions for multiclass uid queueing networks. Performance of multiclass Markovian queueing networks via piecewise linear Lyapunov functions. Instability of FIFO queueing networks. Convergence to equilibria for uid models of FIFO queueing networks. Convergence to equilibria for uid models of head-of-the-line proportional processor sharing queueing networks A stable queueing network with unstable uid model. Fluid approximations and stability of multiclass queueing networks I: Work-conserving disciplines Stable priority disciplines for multiclass networks. Stability of multiclass queueing networks under FIFO service discipline. Stability of multiclass queueing networks under priority service disciplines. On positive Harris recurrence of multiclass queueing networks: A uni Stability gap between uid and queueing networks. Stability of a three-station uid network Stabilizing batch processing networks. Global stability of two-station queueing networks The stability of two-station multitype uid networks Stability and instability of uid models for re-entrant lines A multiclass network with non-linear Necessary conditions for global stability of multiclass queueing networks. Networks of waiting lines. Generalized Round-Robin Service Disciplines in Stochastic Networks with Setup: Stability Analysis and Diusion Approximation Networks of queues with customers of di Dynamic instabilities and stabilization methods in distributed real-time scheduling of manufacturing systems Fluctuation smoothing policies are stable for stochastic reentrant lines. Distributed scheduling based on due dates and bu Transience of multiclass queueing networks via uid limit models. Ergodicity of stochastic processes describing the operation of open queueing networks. 'First come, rst served' can be unstable! On the stability of multiclass queueing networks: a relaxed su-cient condition via limiting uid processes --TR
acyclic routing;push start;multiclass queueing network;fluid model;virtual station;stability
598174
Existence Condition for the Diffusion Approximations of Multiclass Priority Queueing Networks.
In this paper, we extend the work of Chen and Zhang [12] and establish a new sufficient condition for the existence of the (conventional) diffusion approximation for multiclass queueing networks under priority service disciplines. This sufficient condition relates to the weak stability of the fluid networks and the stability of the high priority classes of the fluid networks that correspond to the queueing networks under consideration. Using this sufficient condition, we prove the existence of the diffusion approximation for the last-buffer-first-served reentrant lines. We also study a three-station network example, and observe that the diffusion approximation may not exist, even if the proposed limiting semimartingale reflected Brownian motion (SRBM) exists.
Introduction We consider a general multiclass queueing network under a preemptive resume priority service discipline. The network consists of J single server (service) stations, each with an infinite buffer (waiting room). There are K ( J) classes of jobs, indexed by K. While each station may serve more than one class of jobs, each class is served at a specific station. After receiving the service, the job is routed to another station or leaves the system following a Markovian routing. The external arrival processes and the service processes are renewal processes. Each class is assigned a priority. When there is more than one class of jobs at a station, the server at the station serves the job with the highest priority; within a class, jobs are served in the order of arrival. The server of each station is kept busy as long as there are jobs at that station. Let Q k (t) indicate the number of class k jobs in the network at time t, The diffusion approximation addresses the weak convergence of the scaled K-dimensional queue length process " under a heavy traffic condition, where (Roughly speaking, the heavy traffic condition is that the traffic intensity at each station equals one.) Since it is known that the above diffusion approximation may not always exist (see Chen and Zhang (1998)), sufficient conditions are sought for the existence of the diffusion approximation. It turns out that these conditions are related to the behavior of a corresponding fluid network. The fluid network corresponds to the queueing network, consisting of J stations, with K classes of (discrete) jobs replaced by K classes of (continuous) fluids. Let indicate the class k fluid level at time t, H be a partition of the set of all classes (or more precisely indices of classes), with L being the set of all classes with the lowest priority at each station. One of the key conditions in our sufficient condition is that there exists a finite time 0 such that for any Q(t) with a unit initial fluid level (i.e., jj In short, the fluid level of higher priority classes reaches zero in a finite time and then remains in zero; this condition shall be referred to as the SHP -condition, short for the stability of higher priority classes. On the other hand, under the heavy traffic condition, if the weak convergence, Q as n !1; holds with a continuous limit " Q, then it is necessary that " QL is a semimartingale reflected Brownian motion (SRBM) (see Theorem 6 of Chen and Zhang (1999b)). A necessary condition for the SRBM to be well-defined is that a corresponding J \Theta J reflection matrix ~ RL to be completely-S. (We note that matrix ~ RL depends only on the priority discipline and the first-order parameters of the queueing network, whose precise definition shall be given later. A square matrix A is said to be an S-matrix if there exists a vector x 0 such that Ax ? 0, and it is said to be completely-S if all of its principal submatrices are S-matrices.) The sufficient condition we establish for the existence of the diffusion approximation is that the matrix ~ RL is completely-S and the SHP -condition holds. This sufficient condition improves the sufficient condition given by Chen and Zhang (1999b), which instead of the SHP -condition, requires the existence of a linear Lyapunov function for the fluid levels of higher priority classes. Using the sufficient condition described in this paper, we can establish the existence of the diffusion approximation for reentrant lines under a last-buffer-first-served (LBFS) discipline, and obtain an almost necessary and sufficient condition (except for some boundary cases) for a three-station network introduced by Dai, et al. (1999). For this latter network, we observe that the diffusion approximation may not exist, even if the "proposed" limiting SRBM exists (i.e., the corresponding reflection matrix is completely-S). At the time of this paper's preparation, it was brought to our attention that Bramson (1998) also establishes a sufficient condition for the general heavy traffic limit theorem for the priority queueing network. The sufficient condition replaces our SHP -condition by using a uniform asymptotic stability condition; specifically, there exists a real function H(t) 0 with as t !1, such that, for all fluid level processes Q with a unit initial fluid level. We shall show that these two sufficient conditions are equivalent. On the other hand, the SHP -condition in our sufficient condition could be verified via a Lyapunov function approach, which leads to more explicit conditions with the verification of the feasibility of a set of linear inequalities. (We also learned that Zhang (1999) provided a relaxation of the uniform asymptotic stability condition with the condition that Q(1) as t !1 for all fluid level process Q.) The diffusion approximation for queueing networks has long been an important area of research in queueing theory. It is the functional central limit theorem for queueing networks; and in queueing networks, it plays the same important role as the classical central limit theorem plays in the study of a sequence of i.i.d. random variables. It provides an important tool in approximating the performance measures of queueing networks. There has been a large volume of literature on the diffusion approximation. Readers are referred to Whitt (1974), Lemoine (1978), Glynn (1990) and Chen and Mandelbaum (1994) for surveys on earlier work, which is mostly on single class queueing networks. Almost all of the earlier work rely on the oblique reflection mapping (or its special case, the one-dimensional reflection mapping), introduced by Harrison and Reiman (1981). Some of multiclass queueing networks have been studied under this approach as well, including Peterson (1991) on a feedforward multiclass network, Reiman (1988) and Dai and Kurtz (1995) on a multiclass queue, and Chen and Zhang (1996b) on a reentrant line queueing network with a first-buffer-first-served priority discipline. However, for general structured multiclass queueing networks under either a FIFO or a priority service discipline, the above approach may not work, since the corresponding reflection mapping may not be well-defined (or the corresponding dynamic complementarity problem may not have a unique solution); see Mandelbaum (1989) and Bernard and El Kharroubi (1991). Moreover, it is now well-known that the diffusion approximation may not exist in some cases; Dai and Wang (1993) and Dai and Nguyen (1994) provided a counterexample for a network under a FIFO service discipline, and Chen and Zhang (1998) provided a counterexample for a network under a priority discipline. Therefore, the challenge is to answer the question, "for which classes of multiclass queueing networks does the diffusion approximation exist?" In the past few years, some research has been done to address this question. Chen and Zhang (1996a) provided a sufficient condition for networks under the FIFO service discipline, and Bramson (1998) and Williams (1998b) established the diffusion approximation for networks under the head-of-the-line processor sharing service discipline and networks of Kelly type under the FIFO service discipline. As previously mentioned, the latter work also established a sufficient condition that relates the existence of the diffusion approximation to the uniformly asymptotical stability. Whereas Chen and Zhang (1998b) established some more explicit sufficient conditions. In a contemporary independent work, Bramson and Dai (1999) establish the diffusion approximation for LBFS reentrant lines. Readers are also referred to Harrison (1988) and Harrison and Nguyen (1990;1993) for the earlier effort, and to Williams (1996) for the more recent survey on the diffusion approximation of multiclass queueing networks. The proof of the diffusion limit theorem for a multiclass queueing network usually takes the two steps: first to establish the C-tightness of the scaled queueing processes, and then to invoke the weak uniqueness for the limiting processes. The foundation of this approach is the work of Reiman and Williams (1988) and Taylor and Williams (1993) that provides a necessary and sufficient condition for the existence and the uniqueness of a class of semimartingale reflecting Brownian motions (SRBMs), which arises as the diffusion approximation limit (if the limit exists). A proof for the main sufficient condition that follows this approach can be found in Ye (1999). Instead, we shall provide an alternative proof by showing that our sufficient condition is equivalent to that given by Bramson (1998) and Williams (1998b). This paper is organized as follows. In the next section, we describe a multiclass queueing network and its corresponding fluid network under a priority service discipline. In section 3, we present the main sufficient condition theorem, and prove this theorem by relating it to the above-mentioned sufficient condition given by Bramson (1998) and Williams (1998). Then we shall present a number of corollaries that provide more explicit sufficient conditions. In addition, we shall present a sufficient condition for the weak stability of the multiclass priority queueing network, which implies the existence of a fluid limit (the functional strong law-of-large-numbers). In section 4, we establish the existence of the diffusion approximation for reentrant line queueing networks under the LBFS service discipline, and we study the diffusion approximation for a three-station network. We conclude our discussions in section 5. To close this section, we introduce some notation and convention that are used throughout this paper. The J-dimensional Euclidean space is denoted by R J , its nonnegative orthant by R J . Let R . Vectors are understood to be column vectors. The transpose of a vector or a matrix is obtained by adding to it a prime. When e represents a vector, it is the vector of ones with its dimension appropriate from the context. Let a ' f1; :::; Jg. The scalar jaj denotes the cardinality of a and the vector x a is the restriction of x to its coordinates with indices in a. Similarly, the matrix P ab is the submatrix of a matrix obtained by choosing the elements with row-indices in a and column-indices in b; P aa will be abbreviated to P a . Unless otherwise stated, vector operations and relatives are interpreted componentwise; for example, for means that each coordinate of x is strictly greater than the corresponding y coordinate. We assume the norm in R J vector x 2 R J . For a vector denotes a J \Theta J dimensional diagonal matrix whose jth diagonal component is x A J \Theta J matrix R is said to be an S-matrix, if there exists an x 0 such that Rx ? 0; and it is said to be completely-S if all of its principal submatrices are S-matrices. The composition is the function from R+ to R J whose jth coordinate is the real-valued function fx In particular, the jth coordinate of fx(t); t 0g with To present our convergence result, we introduce the path space D J [0; 1) (the space of all are right-continuous and have finite left limits on (0; 1)). The path space is endowed with the Skorohod topology (see Section 3.5 of Ethier and Kurtz (1986) or Pollard (1984)). For a sequence fX n g of D J [0; 1)-valued stochastic processes and converges to X in distribution. For any x 2 D J [0; 1), the uniform norm of x on the interval [s; t] is defined by sut with jjxjj [0;t] abbreviated to jjxjj t . A sequence fx n g of functions in D J [0; 1) is said to converge uniformly on compact set (u.o.c.) to x 2 D J [0; 1), if for each t 0, jjx This is denoted by We denote the probability measure of a probability space by P. We denote by oe(X) the oe-field generated by the random variables X, and by oe(B) the oe-field generated by B, a set of subsets of the sample paths. In the next subsection, oe(\Delta) will also be used to represent a mapping from classes to stations, where its domain is the class index, integers 1; :::; K. We hope no confusion will arise from the use of oe in these two completely different contexts . Queueing Network and Its Corresponding Fluid Network Model In this section, we describe in detail the queueing network under priority service discipline and its corresponding fluid network. A rigorous description of the latter is also necessary for the formulation of the main sufficient condition theorem in the next section. 2.1 Multiclass Priority Queueing Network The queueing network under consideration consists of J (service) stations; each station has a single server and an infinite waiting room. There are K classes of jobs; each class is served (by the server) at a specific station, while each station may serve more than one class of jobs. Let Jg be the set of station indices, and let K be the set of class indices. Let oe denote a mapping from K to J , with indicating that class k jobs are served at station j for each k 2 K. Let jg be the set of classes that are served at station j, be a J \Theta K matrix whose (j; k)th component c class, jobs are served in the order of arrival; and among classes, jobs are served under a preemptive resume priority service discipline. The priority discipline is described by a one-to-one mapping from f1; :::; Kg onto itself. Specifically, a class k job has priority over a class ' job if mapping can be equivalently described as a permutation ((1); :::; (K)) of f1; :::; Kg.) The primitive data of the queueing network are a K-dimensional exogenous arrival process K-dimensional service process K-dimensional routing sequences OE K. The quantity E k (t) indicates the number of class k jobs that arrived exogenously during the time interval [0; t], and S k (t) indicates the number of service completions for class k jobs after server oe(k) serves class k for a total of t units of time, K. We assume that E k (t) and S ' (t) (k; are mutually independent renewal processes. The arrival rates of the renewal processes E k (t) and S k (t) are ff k 0 and respectively. The mean interarrival time of S ' (t) is denoted by m k (= 1= k ). We further assume that the interarrival times of renewal processes E k (t) and S ' (t) have finite variances a 2 k and b 2 k respectively. For convenience, let indicates the sum of the service times for the first n jobs of class k, i.e., The quantity OE k vector in R K with its 'th component being one and other components being zeroes) indicates that the nth job of class k turns into a class ' job after service completion, ' 2 K; and OE k indicates the nth job of class k leaves the network after service completion, k 2 K and n 1. We assume the sequences OE k , are mutually independent i.i.d. sequences, and they are also independent of the exogenous arrival process E(t) and the service process S(t). Let p k' be the probability that OE k We call the K \Theta K matrix routing matrix, and assume it has a spectral radius less than one, or equivalently, P That is, the network is an open network. Let We assume that there are no jobs initially in the network. Before describing the performance measures and the dynamics of the queueing network, we introduce some useful notation, namely, H k , H k , L, H, h(k), B, e H , D and M . Let be the set of indices for all classes that are processed at the same station as class k and have a priority no less than that of class k. Let H fkg. We denote by L the set of all classes that have the lowest priorities at their respective stations; in other words, for each for each k 2 L, (k) (') for all ' 2 C(oe(k)), and we denote by H := K n L. Let in words, if k is not the highest priority class at station oe(k), then h(k) is the index for the class which has the next higher priority than class k at station oe(k), otherwise, (b 'k ) be a K \Theta K matrix with be a K-dimensional vector with e H and e H otherwise. The matrix diag() is a K-dimensional diagonal matrix whose kth element is k , and Now we describe the performance measures and the dynamics of the queueing network under a given priority service discipline . The performance measures of primary interest are a K-dimensional queue length process and a J-dimensional workload process indicates the number of class k jobs in the network at time t, and W j (t) represents the amount of time that station j has to work to empty out every job at station j at time t provided that no more external and internal arrivals to station j are allowed. Let T k (t) be the total amount of time that station oe(k) has served class k jobs during (0; t]. We call an allocation process. Note that S k (T k (t)) denotes the total number of class k job service completions by time t. Therefore, we have the following balance-equation (recalling our assumption that The work-conserving (or non-idling) condition and the preemptive priority service discipline imply that for each k 2 K, where is assumed to hold by default whenever H ;. Denote the k-dimensional total arrival process Given the allocation process T and the total arrival process A, the workload process can be formally defined as where the jth coordinate reads like Next, we derive some convenient alternative relations for the queue length processes. First, we rewrite (1) by centering, Let which is the cumulative idle time of the server at station oe(k) during the time interval [0; t] after serving jobs of the classes whose priorities are no less than class k. In other words, Y k (t) indicates the cumulative amount of time during [0; t] that is available for station oe(k) to serve classes whose priorities are lower than class k. In particular, for k 2 L, Y k (t) denotes the cumulative idle time of station oe(k) during the time interval [0; t]. Then the relation (6) has the vector form, Substituting the above into (4), we obtain an alternative expression for the flow-balance relation, where and it follows from (2) that This clearly implies that which in turn implies It follows from (10) that for all t s 0, t. In vector form, they are the same as for all t s 0. We note that since Q 0, under (13)-(14), condition (12) is equivalent to the seemingly stronger condition (11). Call a nominal total arrival rate (vector), fi k (the kth component of fi) a traffic intensity for class k, k 2 K, and ae j (the jth component of ae) a traffic intensity for station j, j 2 J . Usually, the vector simply called the traffic intensity of the queueing network. Actually, is the solution to the following traffic equation, which indicates that the nominal total arrival rate vector includes both external arrivals and internal transitions. We say the queueing network is under a heavy traffic condition if ae = e. 2.2 Multiclass Priority Fluid Network We describe a fluid network that corresponds to the queueing network described in the previous section. One obtains the former by replacing the discrete jobs in the latter with continuous fluids. Specifically, the fluid network consists of J stations (buffers) indexed by j 2 J := f1; :::; Jg, processing (serving) K fluid (job) classes indexed by k 2 K := f1; :::; Kg. A fluid class is processed exclusively at one station, but one station may process more than one fluid classes. As in the queueing network, oe(\Delta) denotes a many-to-one mapping from K to J , with oe(k) indicating the station at which a class k fluid is processed. A class k fluid may flow exogenously into the network at rate ff k ( 0), then it is processed at station oe(k), and after being processed, a fraction p k' of fluid turns into a class ' fluid, ' 2 K, and the remaining fraction, flows out of the network. When station oe(k) devotes its full capacity to processing class k fluid (assuming that it is available to be processed), it generates an outflow of class k fluid at rate call it the exogenous inflow (arrival) rate (vector), let call it the processing rate (vector). We call K \Theta K substochastic matrix the flow transition matrix. Corresponding to the open queueing network described in the last subsection, we consider an open fluid network. That is, we also assume that matrix P has a spectral radius less than one. Among classes, fluid follows a priority service discipline, which is again described by a one-to-one mapping from f1; :::; Kg onto itself. Specifically, a class k has priority over a class ' if We adopt the following notation from the queueing network subsection, C(j), C, h(k), L, H, B, e H , ', R, , fi, ae, M , and D. We say the fluid network is under a heavy traffic condition To describe the dynamics of the fluid network, we introduce the K-dimensional fluid level process whose kth component denotes the fluid level of class k at time t; and the K-dimensional unused capacity process whose kth component denotes the (cumulative) unused capacity of station oe(k) during the time interval [0; t] after serving all classes at station oe(k) which have a priority no less than class k (including class k). Sometimes, we also use a performance measure equivalent to the unused capacity, the K-dimensional time allocation process whose kth component the total amount of time that station oe(k) has devoted to processing class k fluid during the time interval [0; t]. These two processes are related in the following way: and can be rewritten in the vector form, With these performance measures, the dynamics of the fluid network is given as the following system of equations. Y (t) 0; for t 0; (16) where the operator Df is defined as for any t ? s and any K-dimensional function f ; and the set \Psi is defined as The equations (16) and (17) can also be written in terms of the time allocation process T , as In the fluid network (K; J ; '; R; \Psi; oe; ), we shall call ' drift vector, R reflection matrix, \Psi unused capacity set, and Q(0) the initial state. A pair ( said to be a fluid solution of the fluid network (K; J ; '; R; \Psi; oe; ), if it satisfies (16)-(18). For convenience, we also call fluid solution if there is a Y such that the pair ( Y ) is a fluid solution. A well-known property we will use later in this paper is that the processes Q, Y , and are Lipschitz continuous, and hence are differentiable almost everywhere on [0; 1). We call a time t 2 [0; 1) a regular point if all derivatives of such processes exist at t. Finally, we formulate a key condition used in this paper, which is the stability of higher priority classes in the fluid network. SHP -condition. There exists a time ? 0 such that, for any fluid solution with the initial condition jj Q(0)jj 1. 3 Sufficient Conditions We first present the main result, namely the sufficient condition for the diffusion approximation. Then we prove the main theorem by showing that a key condition in the main result, namely, the SHP -condition, is equivalent to the asymptotical stability condition as described in the Introduction . Next, we present some more explicit sufficient conditions for the SHP -condition, by constructing some Lyapunov functions. Finally, we discuss the weak stability, which implies the existence of the fluid approximation for the queueing network. 3.1 The Main Result As a standard procedure, we consider a sequence of queueing networks as described in section 2.1, indexed by be the exogenous arrival rate and the service rate respectively for the nth network. Then is the exogenous arrival process, and S n (t), with S n is the service process associated with the nth network. For ease of exposition, we assume that the routing process does not vary with n. We assume that for each network in the sequence, the initial queue length is zero. We append with a superscript n to all of the other processes and parameters that are associated with the nth network and that may vary with n. We assume that as n !1, a and where c a and c s are two K-dimensional constant vectors. Vectors ff and are interpreted as the exogenous arrival rate and the service rate for the limiting network. We call := respectively, the nominal total arrival rate and the traffic intensity for the limiting network, where call its kth component fi k the traffic intensity for class k, k 2 K. Our main theorem focuses on the weak convergence of the following scaled processes: under the heavy traffic condition, e: (23) We next define some notation that is used in formulating the main theorem below. The following are K independent driftless K-dimensional Brownian motions: where it is a K-dimensional driftless Brownian motion with covariance matrix Assume that R \Gamma1 H exists. Then " defined by is a J-dimensional driftless Brownian motion with covariance matrix, (R 0 Let Theorem 3.1 Suppose that the convergence (22) and the heavy traffic condition (23) hold. Suppose that R \Gamma1 H exists, the covariance matrix \Gamma , defined in (29), is non-degenerate, and matrix ~ RL , defined by ~ is completely-S. If the fluid network (K; J ; '; R; oe; ) satisfies the SHP -condition, then the weak convergence YL ); in [0; 1); (31) holds as n !1 where for t 0, Y ' (\Delta) is continuous and nondecreasing with " Z 1" Moreover, the process " X is a martingale with respect to the filtration generated by ( " By Taylor and Williams (1993), the limiting process " QL (t); t 0g is a semimartingale reflecting Brownian motion (SRBM) associated with (R J RL ). Readers are referred to Taylor and Williams (1993) for a formal definition of the SRBM. Roughly speaking, the SRBM QL starts at the origin, evolves in the interior of R J like a Brownian motion with drift term j and covariance matrix \Gamma , and is confined to the orthant by instantaneous reflection at the boundary, where the direction of reflection on the ith face the jth column of the reflection matrix ~ RL . 3.2 Asymptotical Stability Formally, we state the asymptotical stability condition as follows (which is a slight modification of Assumption 3.1 in Bramson (1998)). AS-condition: There is a real function H(t) 0 with !1, such that, for any for all t 0 and some with In addition, if Q(0). It follows from Bramson (1998) and Williams (1998b) that Theorem 3.1 holds if the SHP - condition is replaced by the AS-condition. The following proposition establishes the equivalence between the SHP -condition and the AS-condition. Hence, this provides a proof for Theorem 3.1. Proposition 3.2 Under the condition that ~ H RHL is completely-S, the AS- condition and the SHP -condition are equivalent. Before Proving this proposition, we state an oscillation inequality from Bernard and El Kharroubi (1991). Lemma 3.3 Suppose that u(\Delta); v(\Delta); w(\Delta) 2 C J (the space of all continuous functions f RL v(t) 0, for t 0; Then (from the assumption that matrix ~ H RHL is completely-S), where d 1 is a constant depending only on the matrix ~ RL , and for any (vector) function f , Proof (of Proposition 3.2). We first show that the SHP -condition implies the AS-condition. Suppose ( Y ) is a fluid solution of the fluid network (K; J with jj Q(0)jj 1. According to the SHP -condition, From (16)-(18), we obtain QH RL where we use ~ which follows from Lemma 2.2 in Chen and Zhang (1999b) due to the fact that the traffic Combined with (39), equation (40) implies Then applying Lemma 3.3, we have i.e., QL Now, we let Q( ), and let constant for the fluid level process Q. Then it can be seen that the first half of AS-condition holds. suppose We would like to show that let be as defined in the SHP -condition and define ( and Y Y Then, it can be verified directly that ( According to the SHP -condition, we know that Using equation (40) and Lemma 3.3 again, we have Q(0). Next we show that the AS-condition implies the SHP -condition. Denote a constant d 2 as is the (i; j)-th element of the matrix RLHR \Gamma1 H , and d 1 is the constant defined in Lemma 3.3. Define a real number ffl as and let t ffl be a number such that for all t 0. Then, by the AS-condition, we have for all t 0, and this inequality, combined with (40)-(42) and Lemma 3.3, implies for s; t t ffl . us construct a fluid solution ( T ) as the following: It can be checked directly that ( If we define then it can be verified directly that ( solution of fluid network (16)-(18) and hence, according to the AS-condition, holds for all t 0. This directly leads to inductively using the above technique, we have for all t 0 and all integer n. By letting n !1, with for all t 3.3 Lyapunov Conditions A key condition in the main theorem is the SHP -condition. We obtain some of its sufficient conditions. First we show that the sufficient condition named the L 2 -condition, as referred to in Chen and Zhang (1999b), implies the SHP -condition. To this end, we quote the L 2 -condition from Chen and Zhang (1999b) below: -condition. There is a (K \Gamma J)-dimensional vector h ? 0 such that for any (16)-(18), the function h 0 QH (\Delta) is strictly decreasing at t wherever h 0 It is clear that the L 2 -condition in fact constructs a linear Lyapunov function for the stability of higher priority classes. Proposition 3.4 The L 2 -condition implies the SHP -condition. Proof. Suppose the L 2 -condition is true. According to remarks after Theorem 3.1 in Chen and Zhang (1999b), the set of all possible derivative of QH (t) is compact. Combined with the we know that there exists ffl ? 0 such that when QH (t) 6= 0 and t is a regular point (i.e., the point at which derivatives of all functions involved exist). If jj QH (0)jj 1, then h 0 QH (0) jjhjj, and hence h 0 must hold for all This establishes the SHP -condition. 2 Remark The converse of Proposition 3.4 is not true. Even if both the SHP -condition holds and the matrix ~ RL is completely-S, the L 2 -condition may not hold. We construct a counterexample at the end of subsection 4.2. Therefore, the sufficient condition given by Theorem 3.1 strictly improves the sufficient condition given by Chen and Zhang (1999b). Next, similar to the above explicit L 2 -condition, we transplant the piecewise linear Lyapunov function approach for the stability of priority fluid network in Chen and Ye (1999) to construct another explicit condition for the existence of the diffusion approximation for the multiclass queueing network with priority service discipline. To this end, we introduce some notation and terminology. A partition (a; b) of K is called a (priority ) hierarchical partition, which shall be written as (a; b) 2 PK , if ' 2 a implies k 2 a, provided that is a class with higher priority in the same station as ', then k 2 a as well. The head class set H(B) of B ' K is defined to be the set in words, the set of the highest priority classes in each station that serves at least one class in B. If (a; b) 2 PK is a hierarchical partition, then the fluid state S(a; b) is defined to be the set and the regular flow rate set F (a; b) is defined to be a where y a satisfies 0 y a e and ' a +R a y It follows from the dynamic relations (16)-(18) that for (a; b) 2 PK , if t is a regular point, then the derivative Q(t) must be an element in F (a; b). (In fact, it is not difficult to show by construction that the set F (a; b) is exactly the set of all such derivatives.) Now we formulate the sufficient condition based on the piecewise linear Lyapunov function, and we shall refer to it as the PL 2 -condition in this paper. Similar results for the stability of multiclass fluid network with priority service discipline are contained in Theorem 3.1 and Corollary 3.2 in Chen and Ye (1999). There exists an ffl ? 0 and J (K \Gamma J)-dimensional nonnegative vectors x such that the following two conditions hold: (a) For any j 2 f1; :::; Jg, and any hierarchical partition (a; b) with b " sup d2F (a;b) (b) For any partition J 0 [ being nonempty, denote K Proposition 3.5 The PL 2 -condition implies the SHP -condition. Proof. Without lost of generality, assume that being a sufficiently large constant (say, a Lipschitz constant for the fluid level process Q). Then, it is direct to check that the PL 2 -condition is still satisfied with ffl; x being replaced by ffl; x J .) Let QH (t) and It suffices to show that, under the assumption of the PL 2 -condition, only if is differentiable at t: (47) Note that clearly implies the condition (46). Hence, it suffices to show (47). The remaining proof draws a similar idea from the proof of Lemma 4.1 in Dai, et al. (1999). [Also see the proof of Theorem 3.1 in Chen and Ye (1999).] Suppose t 0 0 is a regular point and I 0 be a subset of f1; Jg such that be the hierarchical partition such that a k such that . Then we note It follows from the condition (45) that This combined with the definition of I 0 implies that J (44), we have be two sequences such that t 1 since f(t) f i 0 (t) and f(t 0 Letting m !1, we have Similar to the use of the piecewise linear Lyapunov function approach for the stability of multiclass fluid network with priority service discipline in Chen and Ye (1999), we could formulate the PL 2 -condition in a more general form. We omit the extension here. The PL 2 -condition seems quite involved; however, it could be formulated into the problem of solving a set of linear programs. To this end, we introduce some notation. A linear combination is called a convex combination of vectors z A set Z ' R K is called a convex set if any convex combination of finite points of set Z is still in Z. A point z 2 R K is said to be an extreme point of the convex set Z if z 2 Z but is not a convex combination of other points in Z. It can be checked directly by definition that the regular flow rate set F (a; b) is a bounded convex set with at most finite extreme points. Denote the set of extreme points of F (a; b) as F e (a; b). Clearly, F e (a; is an empty set or a single point set. Then from Krein-Milman Theorem (see for example Rockafellar (1970)), any element q 2 F (a; b) is a convex combination of the points in F e (a; b). From this result, we can easily linearize the condition (a) of the PL 2 -condition. Furthermore, denote all the partitions of J into two nonempty sets as 0 and 1 as in (b) of the PL 2 -condition. Now, we convert the proposition to a set of LP problems: For any sequence of mappings j n first solve the following LP problem for any hierarchical partition (a; b) with b " Suppose the optimal values of the above LP problems are ffl prespectively. Then, the PL 2 - condition is satisfied if and only if In this LP problems formulation, the series of partitions of station index set J are considered because the condition (b) of the PL 2 -condition should be satisfied for any partition of J into two nonempty sets. That each sequence of mappings 1 (\Delta)g corresponds to a LP problem is incurred by the flexibility of choice of index j 1 in the condition (b) of the PL 2 -condition. The constraints (48) and (49) are translated from (44) and (45) respectively. At last, the constraint (50) is a restriction of the flexibility of the choice of the number ffl and x ij 's. We further explain why the PL 2 -condition holds if and only if ffl ? 0. Suppose the PL 2 - condition holds. Without loss of generality, suppose that (50) is also satisfied. According to the condition (a) in the PL 2 -condition, it is easy to see that constraint (48) is satisfied with preplaced by ffl. By the condition (b) in the PL 2 -condition, we can construct a sequence of mappings (from J n 0 to J n 1 ), such that, for each partition J n 1 and any 1 . That is, (49) is satisfied with j n replaced by " in the PL 2 -condition is a feasible solution to the LP problem corresponding to the sequence of mappings (\Delta)g. Hence, this LP problem has a positive optimal solution, and thus ffl ? 0. On the other hand, suppose that ffl ? 0. Then, we choose one of the LP problems with positive optimal solution. Suppose this LP problem corresponds to a sequence of mappings We claim that, if we denote the optimal solution of this LP problem as x and ffl, the PL 2 -condition holds with this set of parameters. Actually, all the conditions in the PL 2 -condition are obvious except the condition (b). Consider any nonempty partition in the condition (b). We have J some pg. For any j 0 2 J 0 , let according to the constrain (49) of the LP problem, we know at once that (45) is true. 3.4 Weak Stability Here we discuss the relationship between the SHP -condition and the weak stability of the fluid network, since the concept of weak stability is closely related to the existence of diffusion approximation for the queueing network. A fluid network (K; J ; '; R; \Psi; oe; ) is said to be weakly stable if (16)-(18) has a unique solution under the initial condition It is known (see Chen (1995)) that the weak stability implies that the fluid limit,n almost surely, and this convergence is also a necessary condition for the existence of the diffusion approximation for the multiclass priority queueing network (see Chen and Zhang (1999b)). Theorem 3.6 Suppose that the traffic intensity of the fluid network, ae e, that R \Gamma1 H exists, and that the matrix ~ H RHL is completely-S. Then the fluid network is weakly stable if it satisfies the SHP -condition. Remark. The converse of Theorem 3.6 is not true. In Proposition 4.4, an example will be given to show this. Proof of Theorem 3.6. Suppose the initial fluid level of the fluid network is First, we show by contradiction that Let QH (t) 6= 0g: Then, keeping in mind that by equations (40)-(42) and Lemma 3.3. Specifically, we have According to the definition of t 0 , there exists a for some ffl ? 0. However, for any t 2 ? t 0 with it can be checked directly that is also a fluid solution satisfying (16)-(18). Hence, according to the SHP -condition, we have which immediately leads to If we choose a point t 2 (with sufficiently close to t 0 , then we get since Q(\Delta) is continuous. Hence, jj contradicts (53) and thus proves (52). Finally, according to Lemma 3.3, the completely-S of RL H RHL implies that (40)- (42) has a unique solution In this section, we apply the main theorem of the previous section to study the diffusion approximation of two queueing network examples. In the first subsection, we prove the existence of the diffusion approximation for the reentrant line network under the LBFS service discipline. In the second subsection, we characterize the condition for the existence of the diffusion approximation for a three-station queueing network which is first studied in Dai, et al (1999) and which will be referred to as DHV network. We also employ a variation of this network to provide a counterexample for Proposition 3.4. 4.1 Reentrant Line with Last Buffer First Served Discipline We consider a reentrant line network under the LBFS discipline, i.e., 1). The parameters of the reentrant line network take the following special form: the exogenous inflow rate and the flow-transfer matrix and shown by Figure 1. In this case, we have with and, for where (b k' ) is as defined in subsection 2.1. oe oe oe oe Figure 1: A Re-entrant Line Network We note that in this case, the equation (20) takes the following simpler form, t. It is known that when ae = e, the matrix ~ H RHL is completely-S (see Dai, Yeh and Zhou (1997), Theorem 3.1). The next proposition implies that the network satisfies the SHP -condition under ae = e. (The proposition appears slightly stronger than the SHP - condition, since the initial condition jj in the SHP -condition is replaced by jj QH (0)jj 1.) Proposition 4.1 Suppose that the traffic intensity, ae j j there exists a real number 0 such that fluid solution ( T ) of the reentrant line with jj QH (0)jj 1. The proof of Proposition 4.1 is based on the following Lemma. To state the lemma, we introduce some notation. Let K be the J classes in the lower priority class set L, and M ? 0 the Lipschitz constant for the fluid level process Q. Denote the set of classes between class k j and k j+1 as Lemma 4.2 Let j 2 J be fixed. Then, there exists a real number j 0 such that 0, for any fluid solution ( T ) of the reentrant line with (By default, Proof. We prove the lemma in three steps. Step 1. We first show that, for any given fluid solution ( T ) of the reentrant line satisfying (55), It is sufficient to show that, for any regular point t ? 0, if jj d dt jj for some constant number fl ? 0. Now, suppose that t ? 0 is a regular point and that jj 0g. Then, by equation (17), we have since for such class '. For class (\Delta) is a non-negative function and t is a regular point of must be that with equation (54), implies solving the corresponding to ' ' in (57) and (58) jointly, we have The equation in (57) with can be written as From (59), we have ' 0 and from (57), for some d, ' 0 which leads to e d In view of k j+1 ' and (62), we have and hence, by (54), d dt jj dt This leads to the existence of a finite time t 0 such that Now we elaborate the above result on the value of ' which is useful in the following steps of the proof. Actually, we have ' . If to the contrary, in view of (59) and (62), we have and However, this contradicts X Step 2. Next, we show that, there exists j 0 such that, for all fluid solution ( T ) of the reentrant line satisfying (55), we have 0g. We first estimate k j which is the total outflow of class fluid up to time t . For each k 2 H k j and k ! k j+1 , we have and Hence, we have By omitting the second term of the left hand side of the equations in (66), multiplying them by summing them up, we obtainB @ where the second last equality of (67) follows from the results in (59) and the fact that ' Hence, we obtain the estimation Now, from and we have To obtain the last inequality in (69), we have used the estimation in (68). However, by (62) (with ' almost all t 2 [0; t ]; which implies By comparing (69) and (70), and keeping in mind the assumption that jj d t jj and hence what we need in (65). Step 3. At last, we show that, for any fluid solution ( T ) of the reentrant line satisfying (55), if We prove this by contradiction. Suppose there exists t ? t such that jj since the set ft t : jj 0g is open and nonempty, there exists an interval such that Let ffl be a number such that (t)jj. Let Now, define the following: It can be checked directly that ( fluid solution of the reentrant line satisfying condition (55). Then, by (65), and this immediately leads to ffl. But this contradicts condition (71). 2 Proof of Proposition 4.1. We use the above lemma inductively to show that, there exist fixed times t J t J \Gamma1 ::: t 1 such that for any fluid solution ( T ) of the reentrant line with jj QH (0)jj 1. First, let t 4.2; then QA J since jj QA J (0)jj jj QH (0)jj 1. Next, suppose 1). Consider the pair ( defined by where M is a Lipschitz constant of Q. Under the induction assumption, it can be checked directly that ( solution of the reentrant line satisfying (55), since (jj Then, by Lemma 4.2, We have immediately, by (73) and (74), that what we want in this proposition. 2 In view of Theorem 3.1, summarizing the above, we have Theorem 4.3 Suppose that, for the reentrant line with LBFS discipline, the convergence (22) and the heavy traffic condition hold. Then the weak convergence (31) holds with the limits defined by equations (32)-(37). Moreover, the process " X is a martingale with respect to the filtration generated by ( " Station 1 Station 2 Station 3 Figure 2: The three-station fluid network example 4.2 A Three-Station Priority Network We consider the network as shown by Figure 2, which shall be referred to as DHV network since it was first studied by Dai, Hasenbein and Vande Vate (1999). The parameters ff, P and C for this network take the form, The priority mapping (permutation) is represented by specifically, classes 4, and 6 have higher priorities at stations 1, 2 and 3 respectively. In this case, we have and, under heavy traffic condition e, ~ Proposition 4.4 Under the heavy traffic condition that ae = e (i.e., ae ~ RL is completely-S; (ii) the DHV fluid network satisfies the SHP -condition if and only if (iii) the DHV fluid network is weakly stable if and only if m 2 +m 4 +m 6 2. Proof of Proposition 4.4 (i). By definition of the completely-S matrix and in view of the heavy traffic condition, it suffices to verify the following: 1. The diagonal elements of the matrix ~ RL are all positive. 2. There exists a vector x R f1;2g x ? 0, i.e., To see this, first note the above is equivalent to the existence of positives x 1 and x 2 such that The latter is further equivalent to which, by some simple algebra and the heavy traffic assumption, can be written as We claim that the above inequality holds, since either hold. From the above process, we can also see that the vector x can be chosen as x Similarly, we can show that 3. ~ 4. ~ 5. ~ of Proposition 4.4 (ii) and (iii). We break down the proof into four lemmas. Lemma 4.5 Under the heavy traffic condition, the DHV fluid network satisfies the SHP - 2. In Dai, et al. (1999), it is shown that the linear Lyapunov condition given by Chen and Zhang (2000) could not provide a sharp characterization for the stability of the DHV network (under e). However, the linear Lyapunov condition given by Chen and Zhang (1999b) does yield a sharp characterization (except for a boundary case) for the diffusion approximation of the DHV network (under the heavy traffic condition Theorem 4.10. In particular, we shall prove the lemma by using Theorem 3.2 in Chen and Zhang (1999b) (in view of Proposition 3.4), and for convenience, we quote it below. Theorem 4.6 Suppose that there exists a (K \Gamma J)-dimensional vector h ? 0 such that for any given partition a and b of K satisfying (i) If class ' 2 a, then each class k with is also in a, we have a"H (' a +R ab x b inequality is assumed to hold by default when S Then the network satisfies almost all t 0 and any (with the parameters specified in this example) with jj (2) the L 2 -condition. Proof of Lemma 4.5. Through a tedious analysis of a set of inequalities corresponding to all the possible partitions a [ b in Theorem 4.6, we show that there exists a vector h as described in the above theorem if and only if there exists an h satisfying the following system of inequalities: In order to show the existence of such an h satisfying the inequalities (75)-(77), we divide the proof into the following four cases and show the existence of such an h in each of the four cases. The four cases are based on the following representation: Case 1. Suppose m 2 m 1 . Now, we select where M is a sufficiently large positive number and ffi a sufficiently small positive number. Then, h satisfies the inequalities (75)-(77). Case 2. Suppose m 4 m 3 . Similar to case 1, we select in this case, where M is a sufficient big positive number and ffi a sufficient small positive number. Case 3. Suppose m 6 m 5 . In this case, we select where M is a sufficient big positive number and ffi a sufficient small positive number. Case 4. Suppose 2. In this case, we show the existence of h directly. Under the assumption of this case, we have and eliminating h 2 from inequalities (75) and (76), we can show that the existence of positive constants h 2 , h 4 and h 6 satisfying inequalities (75)-(77) is equivalent to the existence of positive h 4 and h 6 satisfying It is clear that the above is equivalent to Note that m the above is the same as But since under the assumption in this case. 2 Lemma 4.7 Under the heavy traffic condition, the DHV fluid network is weakly stable if 2. Proof. By an almost word for word repetition of the proof of Lemma 4.5, we can show that, there exists a 3-dimensional vector h ? 0 such that h 0 almost all equations (16)-(18) with parameters for the DHV fluid network. This establishes that if the initial condition is Then, following the same line of the proof of Theorem 3.6, we can show that Therefore, it follows that the network is weakly stable. 2 Lemma 4.8 Under the heavy traffic condition, if m 2 +m 4 +m 6 ? 2 then the DHV fluid network is not weakly stable. Proof. Actually, this lemma is implied in part (b) of the proof of Theorem 2.4 in Dai, et al. (1999). We only outline the idea of the proof here and omit the details. Suppose the DHV fluid network is weakly stable under the condition 2. Let Q(t) and T (t) be the queue length process and the time allocation process of the DHV queueing network with Then, from Theorem 4.1 of Chen (1995),n with On the other hand, we know that classes 2, 4 and 6 in the DHV queueing network form a pseudostation (see Hasenbein (1997)), which means that no more than two of these three classes of jobs could be served at the same time. This implies which, combined with convergence (78), further implies for any t 0. Now, inequalities (79) and (80) contradict each other. 2 Lemma 4.9 Under the heavy traffic condition, if m 2 +m 4 +m then the DHV fluid network does not satisfy the SHP -condition. Proof. It is sufficient to construct a divergent fluid path equations (16)-(18) with nonzero initial fluid level (i.e., jj Q(0)jj ? 0), and it can be verified directly that the following construction suffices: and where [t] is the greatest integer that is less than or equal to t. In particular, Theorem 4.10 Suppose that the convergence (22) holds. Under the heavy traffic condition, if 2, the weak convergence (31) holds with the limits defined by equations (32)- (37). Moreover, the process " X is a martingale with respect to the filtration generated by ( " On the other hand, if f2;4;6g jj diverges to infinity as n !1 Proof. The first half of the theorem follows from Proposition 4.4 and Theorem 3.1, and the second half of the theorem follows from Lemma 4.8. 2 Remark 1. In all the examples studied before, the sufficient and necessary conditions for the existence of the diffusion approximation for those priority queueing networks coincide with the condition that the matrix ~ RL is completely-S. However, the DHV network provides a counterexample. In particular, when m 2 +m 4 +m 6 ? 2, the matrix ~ RL is completely-S, and hence, the "limit processes" in Theorem 3.1 would be well-defined; however, the convergence (31) does not hold, i.e., the diffusion approximation does not exist in this case. 2. We have not been able to characterize the diffusion limit for the boundary case 2. A Counterexample for the Converse of Proposition 3.4 We construct a 9-class variation of the DHV fluid network, and then show that for some parameters, the variation satisfies the SHP -condition but not the L 2 -condition. We provide an intuitive presentation, from which it is not difficult to write down a rigorous proof. The variation of the DHV network is as shown in Figure 3. The new network has three additional classes indexed by 7, 8 and 9, which are served by stations 1, 2 and 3, respectively. These three additional classes are assigned the lowest priorities at their respective stations. The additional parameters are positive exogenous arrival rates ff 7 , ff 8 and ff 9 , and the positive mean service times m 7 , m 8 and m 9 . All the other settings of this fluid network are the same as those of the DHV fluid network. Station 1 Station 2 Station 3 Figure 3: A variation of the DHV fluid network From Theorem 2.5 in Dai, et al. (1999), there exists a mean service time vector m (m 6 ) such that the DHV fluid network is stable, but there does not exist a linear Lyapunov function for its fluid level process. Now, let m 3 \Gammam and ff We claim that with the these parameters, the 9-class variation of the DHV network satisfies the SHP -condition but not the L 2 -condition. This is because the three additional classes have the lowest priorities at their respective stations and the higher priority classes behave the same as they are in the original DHV network. In addition, for the 9-class network, the matrix ~ 9 ), and hence is completely-S. Therefore, this variation of the DHV network provides a counterexample to the converse of Proposition 3.4. Concluding Remarks In this paper, we establish a sufficient condition for the diffusion approximation of multiclass queueing networks under priority service disciplines. This sufficient condition is weaker than the sufficient condition given by Chen and Zhang (1999b), and is more explicit (in terms of network parameters) than the condition given by Bramson (1998). With this sufficient condition, we establish the diffusion approximation for the reentrant line network under the LBFS discipline. By studying a three-station DHV network, we observe that the diffusion approximation may not exist, even if the "proposed" limiting SRBM exists (i.e., the corresponding reflection matrix ~ RL is completely-S). --R R'egulation de processus dans le premier orthant de R n Convergence of Probability Measures. State space collapse with application to heavy traffic limits for multi-class queueing networks Heavy traffic limits for some queueing networks. Fluid approximations and stability of multiclass queueing networks: work-conserving discipline Hierarchical modeling of stochastic networks Piecewise linear Lyapunov function for the stability of priority fluid networks. Diffusion approximations for Kumar-Seidman network under a priority service discipline Stability of multiclass queueing networks under priority service disciplines. A multiclass station with Markovian feedback in heavy traffic. On the convergence of multiclass queueing networks in heavy traffic. Nonexistence of Brownian models of certain multiclass queueing networks. The QNET method for re-entrant queueing networks with priority disciplines A multiclass network with non-linear Diffusion Approximations Markov Processes Brownian models of queueing networks with heterogeneous customer populations "The QNET method for two-moment analysis of open queueing networks" Brownian models of multiclass queueing networks: current status and open problem. Reflected Brownian motion on an orthant. Necessary conditions for global stability of multiclass queueing networks. "Network of queues - a survey of weak convergence results" The dynamic complementarity problem A heavy traffic limit theorem for networks of queues with multiple customer types. Convergence of Stochastic Processes. A multiclass feedback queue in heavy traffic. A boundary property of semimartingale reflecting Brownian motions. Convex Analysis "Limit theorems for stochastic processes" Existence and uniqueness of semimartingale reflecting Brownian motions in an orthant. "Heavy traffic theorems for queues: a survey" Some useful functions for functional limit theorems. On the approximation of queueing networks in heavy traffic. Stability and diffusion approximation of multiclass queueing networks A relationship between asymptotically stable and diffusion approximation for multiclass queueing networks. --TR
priority service discipline;multiclass queueing network;heavy traffic;semimartingale reflecting Brownian motion;diffusion approximation;fluid approximation
598395
New multivariate product density estimators.
Let X be an Rd-valued random variable with unknown density f. Let X1 ...., Xn be i.i.d, random variables drawn from f. The objective is to estimate f(x), where We study the pointwise convergence of two new density estimates, the Hilbert product kernel estimate d!/n i=1nj=1d1/2log n|xjXij|, where and the Hilbert k-nearest neighbor estimate k(d-1)!/2dnlogd-1(n/(k(d-1)!)) j=1d|xj-X(k)j|, where and X(k) is the kth nearest neighbor of x when points are ordered by increasing values of the product j=1d |xj-X(k)j|, and . The auxiliary results needed permit us to formulate universal consistency results (pointwise and in L1) for product kernel estimates with different window widths for each coordinate, and for rectangular partitioning and tree estimates. In particular, we show that locally adapted smoothing factors for product kernel estimates may make the kernel estimate inconsistent even under standard conditions on the bandwidths.
Introduction . The objective of this note is to study two new multivariate density estimates that avoid the messy problem of smoothing factor selection (in one case, at least), are invariant to a#ne transformations of the coordinates, and provide easy means to jointly estimate all 2 d marginal densities of a density f on IR d . As a by-product, we will be able to study the universal consistency of product kernel estimates and of rectangular partition estimates. independent observations of an IR d -valued random vector X with unknown density f . The classical kernel estimate of f is where h > 0 is a smoothing factor depending upon n, K is an absolutely integrable function (the kernel), and K h 1956). Observe that for the kernel the smoothing factor h is canceled and we obtain One may wonder what happens in this situation, now that the smoothing factor is absent. This problem is dealt with by Devroye and Krzy - zak (1998), who showed the following. Theorem 1. The Hilbert estimate fn (x) =V d n log n where V d is the volume of the unit ball in IR d , is weakly consistent at almost all x, that is, in probability at almost all x. We use the name Hilbert estimate because of the related Hilbert integral with a similar ker- nel. The Hilbert estimate is not invariant under a#ne transformations of the coordinates. That is, in transparent notation, where fn (x; Y ) denotes the density estimate at x # IR d given data Y # (IR d where b+aY denotes the sample of size n in which each i-th coordinate of each observation is transformed by In kernel density estimation, the invariance may be obtained if one uses product kernels. However, this causes additional problems as each component kernel requires its own smoothing factor. If we apply that principle to the Hilbert estimate, we obtain the product Hilbert estimate d! d Y log n|x i -X ji | . With this estimate, which once again has no smoothing factor, the invariance mentioned above follows readily. However, the weak pointwise consistency does not hold in IR d for d > 1 for all densities. Counterexamples will be provided below. In fact, for the product kernel estimate d are positive smoothing parameters, it is known that if h h, h # 0 and nh d #, then fn # f in probability at almost all x when K is a bounded compact support density (Devroye and Gy-orfi, 1985), and R |f almost surely for any K with R However, it is less known that if we allow the individual smoothing factors to tend to zero at di#erent rates and are allowed to depend upon x, this universality is lost! The natural conditions on h i would seem to be lim and lim d Y Within these conditions, and with K the uniform density on [-1, 1], there exist densities f for which almost everywhere in probability. It turns out that a su#cient condition on f for almost everywhere pointwise convergence is R f log d-1 (f The proof and the counterexamples follow in section 3. The paper then explores su#cient conditions for various types of convergence of the estimates, and discusses in this context the Jessen-Marcienkiewicz-Zygmund condition. Consistency is proved for the multivariate Hilbert product estimate, the product nearest neighbor estimate (which hasa nearest neighbor ranking that is invariant under scaling of the axes, a very desirable feature in high-dimensional data collection!), the ordinary product kernel estimate and finally, tree-based and rectangular partitioning estimates. 2. Sums of products of inverse uniforms. be the product of d i.i.d. uniform [0, 1] random variables. Its density is given by log d-1 (1/z) (d - 1)! Let Z 1 , . , Zn be i.i.d. and distributed as Z. Then we have: Lemma S1.n log d n in probability. Proof. The result follows from Theorem 2 of Rogozin, 1971 and Theorem 8.8.1 of Bingham, Goldie and Teugels, 1987 about stability of sums of i.i.d. random variables function F , then Sn/an # 1 in probability if R x is a slowly varying function and an is chosen such that l(a n )/a n # 1/n. Take We have R x log d x/d! and so we can take log d x/d! and an = n(log d n)/d!. Indeed, an (n(log d n)/d!))/d! (n log d 3. The Saks rarity theorem and its implications. To understand the reasons for defining conditions on f , it helps to understand why we have to do so. The reasons go back to the theory of di#erentiation (de Guzman, 1981, is a good reference). Consider a function f on IR d , together with a collection B of bounded measurable sets with the property that for every x # IR d , there exists a sequence , . from B with diameters (written diam(.)) decreasing to zero and such that x # . Such a collection is called a basis. The collection of sets in B containing x is denoted by B(x). We define upper and lower derivatives of f by and respectively (de Guzman, 1981, p. 105). we say that di#erentiates f if D+ (f, almost everywhere (x). For example, it is known that if B is the collection of all balls or all hypercubes, then di#erentiates all integrable functions f . This is a form of the celebrated Lebesgue density theorem, and is at the basis of the pointwise convergence properties of kernel estimates and indeed most density estimates. Let B 2 denote the interval basis, that is, the collection of all products of d finite intervals containing at least two points. This is the collection of all bounded rectangles of positive measure aligned with the axes. We will require the following result: Lemma A1. (the jessen-marcinkiewicz-zygmund theorem, 1935). B 2 di#erentiates L(1+log that is, all functions f on IR d for which While this includes most densities f , there are indeed exceptions. A good account of these is chapter 7 of de Guzman (1981, p. 167). First of all, according to the Saks rarity theorem (Saks, 1935), there exists a nonnegative function f on IR 2 such that D+ (f, almost everywhere (x) (with respect to B 2 ). Later, Marstrand (1977) found an f with this property that works for all orientations of the axes (each orientation of the axes has a di#erent collection B 2 ). El Helou (1978) found an f with the latter property and in addition Z |f | log a (1 for all a # (0, 1). Thus, with respect to B 2 , the logarithmic condition on f is nearly necessary. Consider now a standard kernel estimate on IR 2 with product kernel 4 I |x1 |#1 I |x2 |#1 . If we have di#erent smoothing factors for each coordinate, the form is I |x1 -X j1 |#h1 I |x2 -X j2 |#h2 It is easy to see that But by the result mentioned above, there exists a density f # 0<a<1 L(1 a such that at almost all x, there exist h #, such that Efn (x) #. Note that the results do not imply this when h 1 and h 2 are not allowed to depend upon x. As the variance of fn is O(Efn (x)/(nh 1 h 2 )), it is easy to see that if nh 1 h 2 #, then fn (x)/Efn (x) # 1 in probability at almost all x, and thus, fn (x) # in probability at almost all x. Therefore, if one adapts the smoothing factors to x, it is not true any longer that kernel estimates are pointwise consistent for all densities! We turn finally to the basis B 3 of all rectangles in IR 2 (rotated with respect to all possible orientations). Here the situation is extremely volatile (de Guzman, 1981, p. 224), as B 3 does not even di#erentiate the characteristic functions of bounded measurable sets. The counterexamples on which di#erentiability fails include densities is a bounded measurable set of area 1/c that is a specially selected subset of the Nikodym set N on [0, 1] 2 (N has measure one, but for each x # N , there exists a line l(x) through x such that l(x) # {x}). Take such an f . The implication is that there exist inconsistent kernel estimates of the rotation kind: for almost every x, there exist smoothing factors #, the standard conditions on smoothing and orthonormal rotation matrices A(n, x) such that the kernel estimate K(A(n, x)(x -X j at almost all x, where as before 4 I |x1 |#1 I |x2 |#1 . Thus, adaptation to both x and allowing adaptive rotations makes kernel estimates potentially inconsistent even on bounded densities with compact support. In the remainder of the paper, a rectangle is a set from B 2 , and not from B 3 . 4. Weak pointwise consistency of the multivariate Hilbert product kernel estimate. In this section, we prove the main consistency theorem: Theorem 2. Assume that f is a density with R f log d-1 (1+f) < #, and for which R g log s-1 for all its marginal densities g, where s denotes the dimension of the domain of g. Then the multivariate Hilbert product kernel estimate is weakly pointwise consistent almost everywhere: at almost all x, in probability. Proof. Let M denote the space of all d - d diagonal matrices with diagonal elements 1 or -1. Clearly, be vectors from IR d . For fixed x # IR d , define the flipped density where y # x means that y i # x i for all i. Observe in particular that f # and that f # is a bona- fide density with support on the positive quadrant with origin x. By the Jessen-Marcinkiewicz-Zygmund theorem (Lemma A1), we have, if B 2 denotes the interval basis on IR d , for almost all x, lim This implies that for almost all x, lim x (z) dz x (x) . Here [x, y] denotes the rectangle Q d To see this, note the following: let B be of the form [x, y]. Then as diam(B) # 0 (while varying y, not x), M#M Z MB x dz . This little excursion allows us to study the behavior of f # x instead of f . Interestingly, as we see that the same flipping applied to our estimator fn leaves fn unaltered. Thus, to show that fn # f at almost all x is equivalent to showing that fn (x) # f # x (x)/2 d at almost all x. The remainder of the proof requires the introduction of the marginal densities fS and f # x,S , where thus, fS is the marginal density of f with respect to all components whose index is in S, and similarly, f # x,S is the marginal density of f # x with respect to all components whose index is in S. We call x a jmz point (after Jessen, Marcinkiewicz and Zygmund) if for all S #, lim Here xS is the |S|-dimensional vector composed of components of x whose index is in S, and B is the collection of rectangles in this |S|-dimensional space. By Lemma A1, almost all points are jmz points. Fix such an x for the remainder of the proof. For # > 0, we can thus find # > 0 such that simultaneously for all S #, for all yS # xS R [xS ,yS x,S (z) dz x,S x,S Also, recall that f # x,S Lemma B1. Let be a jmz point of f with f(x) > 0. Let # and # be as above. Let be a random vector with density f # . Let S # {1, . , d} be a nonempty set of indices. Let A be the event that x i < conditional on A, there exist i.i.d. uniform [0, 1] random variables U i such that where # denotes stochastic domination. Proof. We assume without loss of generality that of f # x and f # S instead of f # x,S . Conditional on A, X has density f # /p, where Note that S (0)# d . Furthermore, if F is the multivariate distribution function for the conditional X , then as x is a jmz point, and therefore, as it is well-known that F (X 1 , which can be seen by applying the probability integral transform to each conditional distribution function in the conditional decomposition of F , we see that d Y We now return to the proof of our theorem, where # and # remain as defined earlier. We enlarge the data by considering an infinite i.i.d. sequence Y 1 , Y 2 , ., all distributed as X . Let B(Y be the collection of indices i in Y ji with Y ji # [x i , point. Let S #, and let T be the collection of the first n indices j with B(Y by Lemma B1, where U 1 , . , U d are as in Lemma B1. By Lemma S1, the right-hand-side is in probability asymptotic to Thus, the contribution of all Y j , j # T , when |S| < d, is asymptotically negligible. Assume first f # Then, taking d, we can no longer a#ord to artificially increase the data size as we did above. Thus, let T now be those j # n for which |B(Y j d. Note that T is binomial (n, p), where By the independence of T and the U i 's in Lemma B1, it is easy to see that and the right-hand-side is in probability asymptotic to (np) x (x)# d log d A similar weak lower bound is obtained, and by letting # 0, we obtain the sought result. The contribution of those terms in the density estimate with |S| = d is o(n log d n) when (as seen from the last chain of inequalities as well), just as with all S of size less than d. Thus, the proof of theorem 2 is complete. 5. Lack of strong convergence. For all f , it is true that at almost all x with f(x) > 0, the Hilbert product kernel estimates cannot possibly converge to f in a strong sense. Rather than to prove the full-blown universal theorem, we restrict ourselves to the uniform density on the real line and recall the following result from Devroye and Krzy - zak (1998), which is applicable as for the Hilbert product kernel estimate coincides with the standard Hilbert kernel estimate. Theorem 3. Let f be the uniform density on [0, 1]. Then, for any x # [0, 1], P{fn (x) # log log n so that there is no strong convergence at any point in the support. The poor rate of convergence of the estimate is best seen by considering points outside the support of f . If x is at least distance s away from the support of f , then fn (x) # c/(s d (log n) d ) for some constant c only depending upon k and d. 6. A product nearest neighbor estimate. The k-nearest neighbor density estimate of Fix and Hodges (1951) and Loftsgaarden and Que- senberry (1965) is where X (k,x) is the k-th nearest neighbor of x among Its properties are well-understood (Moore and Yackel, 1977; Devroye and Wagner, 1977; Mack, 1980; Bhattacharya and Mack, 1987; Mack and Rosenblatt, 1979). For example, at almost all x, we have g k,n (x) # f(x) as n # if k #. The k-nearest neighbor density is not scale-invariant because the relative order of the distances when the coordinates are linearly scaled. To remedy this, we introduce the product k-nearest neighbor density estimate log d-1 (n/k(d - 1)!)2 d is a permutation of X 1 , . , X d according to increasing values of This permutation is invariant under linear transformations of the coordinate axes (but not rotations). Interestingly, this product estimate has not been considered before except in the trivial case we obtain the standard univariate k-th nearest neighbor estimate. As the choice of scale is a perpetual cause of concern in estimation, the product k-th nearest neighbor estimate should be particularly useful. We will prove its weak consistency: Theorem 4. If k # such that k #, k/ log n # 0, and if R f log d-1 (f +1) < #, and if R g log d-1 (g+ lower-dimensional marginals of f , then at almost all x (that is, at all jmz points for f and all lower-dimensional marginals f ), g k,n (x) # f(x) in probability. Proof of Theorem 4. We only sketch a rough outline. Mimicking the proof of Theorem 2, we note first that we may wish to consider the flipped density at x, which is 2 d f(y), with y # x, all coordinates of y are at least equal to those for x. We will consider a small square of size # in each coordinate with bottom lower vertex at x. We will show that the k-th nearest neighbor of x is with probability tending to one in this square. Indeed, if Y +(Y 1 , . , Y d ) has density f , and x is a jmz point, then Q d approximately distributed as where the U i 's are i.i.d. uniform [0, 1] random variables, and f # As U i has density log d-1 (1/z)/(d - 1)!, z > 0, and distribution function # z log d-1 (1/z)/(d - 1)! as z # 0, we see that the order statistics of a sample of size n drawn from Q d are approximately distributed as F inv (1/n)/f # (x), F inv (2/n)/f # (x), and so forth, where F inv is the inverse distribution function of good approximation is F inv (u) # u(d - 1)!/(log d-1 (1/(u(d - 1)!))). Thus, the k-th nearest neighbor has a value concentrated in probability about (d - 1)!k/n . (D) The concentration follows from k #. We only need to show that the probability that the k-th nearest neighbor is in the square tends to one. To this end, we show that the nearest neighbor among all points that have m coordinates outside the square and d - m coordinates in the square is at distance (always measured by Q d asymptotically much larger than (D). Without loss of generality, fix the first m # 1 (m < d) coordinates. If x is also a jmz point for the marginal density for the last d - m coordinates, then given that the first m coordinates are outside the square and the remaining ones inside (and assuming that # is small enough), the nearest neighbor distance is asymptotically of the order of 1/(n log d-m-1 n) and thus it is improbable that the k-th nearest neighbor point can have any coordinate outside the small square. This concludes the sketch of the proof. 7. Product kernel estimates. In this section, we consider product kernel estimates defined by d are univariate kernels with R K 1. The smoothing factors h n,i are for now deterministic sequences. Product kernel estimates are of interest because they o#er scale invariance if the h n,i 's are proportional to scale (e.g., make h n,i proportional to a weighted sum of the n). This may introduce big di#erences between the h n,i 's. In fact, such di#erences may be desirable in situations like this one: let f be the product of two univariate densities, a smooth one and a jagged one. For each density, one may want to pick di#erent smoothing factors, and even di#erent orders for the kernel. In those cases, h n,1 and h n,2 may tend to zero at di#erent rates. As each density is locally a product density (as it resembles a uniform density), it is really important to consider product kernels with d individually picked smoothing parameters. It is interesting that the literature o#ers little help with respect to the universal consistency properties of these estimates with respect to pointwise or L 1 convergence. The "natural" conditions on the h n,i 's would appear to be lim and lim d Y In this section, we prove two basic consistency results, which we have not been able to find in the vast literature. Theorem 5. Let fn be the product kernel estimate, and let each component kernel K i be absolutely integrable. Then under the natural conditions (1) and (2), lim for all f . Theorem 6. Let fn be the product kernel estimate, and let all kernels K i be bounded, of compact support, and Riemann approximable, that is, in the L# sense, each K i is in the closure of the space of functions that are finite weighted sums of indicators of finite intervals. Then, under the natural conditions (1) and (2), lim at almost all x provided that R f log d-1 (1 Note. The conditions on the kernels are satisfied by kernels K i that are continuous, bounded and of compact support. With a bit of e#ort, we can extend Theorem 6 to include kernels K i with K i O(1/|x|) as |x| # Perhaps the easiest proof of Theorem 5, and the most transparent one, uses the embedding device from Devroye (1985) (where the embedding is used to handle the L 1 consistency of variable kernel estimates), which may be summarized in the following Lemma: Lemma B2. Let f and g be two densities on IR d , and let be a density estimate based on an i.i.d. samples of size n drawn from f . Assume that sup for some constant C. Then, if g n is the density estimate based upon an i.i.d. sample of size n drawn from g, we have Proof. Consider a uniform Poisson point process on IR d - [0, #) 2 . Let (U, V, T ) be a typical point in this process. Keep only those points with V < f(U) or V < g(U ). For T < t, there is almost surely a finite number of such points (with a Poisson (2t) distribution), so that we may order the points according to increasing values of T , obtaining (U 1 , be the first n values of U j for which Yn be the first n values of U j for which V j < g(U j ). Now, throw away the Poisson point process, which was only needed to couple the two samples. Interestingly, X 1 , . , i.i.d. and drawn from f and Y 1 , . , Yn is i.i.d. and drawn from g. Also, for every i, R max(f, g) dx R max(f, g) Each one of the triples (U generates a common point in both samples, and thus, the number of common points is stochastically greater than a binomial (n, p) random variable. The number of points in one sample not seen in the other sample is not more than a binomial (n, 1 - p) random variable, and its expected value does not exceed n(1 - We may assume that fn and gn are based on the (coupled) X j and Y j samples respectively. Then as R |f n - gn | # C(n-N) n by applying the triangle inequality n -N times. Proof of Theorem 5. We first verify that Lemma B2 applies to the kernel estimate with kernel K. Indeed, if #n Z d Y Z d Y =n d Y so that Lemma B2 applies with |. If all kernels K i are nonnegative, then simply, 2. By Lemma 2 then, it su#ces to prove theorem 5 for all continuous densities g of compact support, as those densities are dense in the L 1 space of all densities. Indeed, pick g continuous and of compact support such that R |f - g| < #. Let fn and g n denote the product kernel estimate, but based on samples drawn from densities f and g respectively. Applying Lemma B2, we have As # is arbitrary, it su#ces therefore to prove Theorem 5 for all such g. Since each K i is measurable and absolutely integrable, we may approximate it in the L 1 sense by a sum of indicator functions of intervals. Thus, for # > 0, we find a finite number of intervals [a ij and coe#cients k ij such that where The L i can even be picked such that R L also that R |L i | < R |K #, and that R |K i | # 1 (as 1). Define the constant d Y But if fn and g n are two product kernel estimates with the same data but di#erent product kernels K i , d Y d Y d Y d Y d Y d Y i=3 Y d Y d Y i=2 d Y i=3 Y #D . Again, by the arbitrary nature of #, it su#ces to consider kernels that are products of finite sums of weighted indicator functions of intervals. Let N be a bound on the number of indicators for any of the component kernels. It is easy to see then, by forming the Cartesian grid of these intervals, that such an estimate is equivalent to a kernel estimate with kernel is the shorthand notation for a rectangle of IR d with vertices a j and b j , and # j is a real number. Also, R denote the volume of [a j , b j ]. Introduce the notation and note that M j is a bona fide kernel with integral one. Then we have, letting fn denote the kernel estimate with kernel L, and f a continuous density of compact support, as where f nj is the kernel estimate with kernel M j . The upper bound tends to zero in the mean if each individual term tends to zero. Thus, it su#ces to prove the Theorem for kernels that are indicator functions of rectangles. But by Theorem 6, we have E|f nj - f | # 0 for all bounded f at almost all x. But then by dominated convergence. This concludes the proof of Theorem 5. Proof of Theorem 6. Let x be a jmz point for f . Let the kernel be proportional to an indicator a bounded rectangle necessarily containing the origin, where the vertices of R. By varying each coordinate in turn, we see that d where z i are points of IR d and s Denote the volume of [0, z i ] by p i . Let Mn denote the d - d diagonal matrix with elements h n,1 , . , h n,d on the diagonal. By Lemma A1 and condition (1), and thus d because R K = 1. We conclude that Efn f(x), and that #(R)n Q d and therefore, R x+MnR f #(R)n x is a jmz point, then by Lemma A1 and (2). We now turn to more general kernels. It will take some work to generalize the above results to a reasonably big class of kernels. It is easy to verify from the last chain of inequalities that under condition (2), for any bounded kernel, Var{fn (x)} # 0 at points x at which Efn (x) # f(x). Thus, Theorem 6 is valid for all bounded kernels for which (1) implies that Efn (x) # f(x) at almost all x. We find for each # > 0 a finite collection of rectangles R i and constants # i such that sup x where s > 0 is a large positive integer. From this, by integration, we note that Then |Efn where in the last step, we used (1) and the first part of the proof for kernels that are indicators of rectangles. Since # was arbitrary, the proof is complete. 8. Tree-based and rectangular partitioning density estimates. Let A 1 , A 2 , . be a sequence of partitions of IR d into rectangles (which do not have to be open or closed). For x, let An (x) denote the rectangle in An to which x belongs. Then the partitioning estimate of f is given by where #(.) is Lebesgue measure, and #(.) denotes the number of data points falling in a set. We assume for now that the sequence of partitions is picked before the data are collected. The present estimates contain all standard histogram estimates and indeed most tree-based density estimates. The purpose of this section is to discuss its universal consistency, pointwise and in L 1 . For L 1 consistency, there is a rather general theorem by Abou-Jaoude (1976a, 1976c) of which Theorem 7 below is a special case. However, we include it here, as our proof is short and uses new tools. The L# convergence was dealt with by Abou-Jaoude (1976b), but it is irrelevant here. There are just a few general consistency theorems for partitioning estimates, such as estimates that partition the space via order statistics (Hanna and Abou- Jaoude, 1981) or via multivariate rectangular partitions (Gessaman, 1970). The most di#cult problem, from a universal convergence point of view, is the pointwise convergence. We give just such a theorem below. Theorem 7. Let fn be a partitioning density estimate. Assume that diam(An (x)) # 0 at almost all x, and that n#(An (x)) # at almost all x. Then lim (There is no condition on f .) Theorem 8. Let fn be a partitioning density estimate. Assume that diam(An (x)) # 0 at almost all x, that n#(An (x)) # at almost all x, and that R f log d-1 (1 f) < #. Then at almost all x. Proof. Let x be a jmz point for f . Then R An if f(x) > 0. Thus, by Lemma A1, the theorem is proved at almost all points with f(x) > 0. When x is a jmz point, then by Lemma A1 again. Proof of Theorem 7. We simply use the result of Theorem 8 and bounded convergence: indeed, if # f at almost all x, and each fn is a bona fide (deterministic) density, then R |f (1974) (see also Devroye and Gy-orfi, 1985) has shown that we may add the phrases "in probability" or "almost surely" on both sides in case fn is a data-dependent sequence of estimates. Now note that the condition of Lemma B2 is satisfied for any partition estimate in which the partition does not depend upon the data with 2: indeed, consider two determistic samples di#ering in only the i-th point, and let the corresponding partitioning estimates be called fn and gn . Let #An (x) and #An (x) denote the cardinalities of An (x) under both samples. Then A#An Z A A#An |#A -#A| =n |#An #n So, now let fn and gn denote the same partitioning estimate, but based on samples drawn from densities f and g respectively, where g is a density that will be picked later. Applying Lemma B2, we have At this point, we pick picked so large that that R |f -g| #. By Theorem 8, at almost all x, E|gn (x)-g(x)| # 0, as g is bounded. but then E R |g by bounded convergence. Thus, As # was arbitrary, the proof is complete. 9. Acknowledgment The authors thank an attentive referee for pointing out a shortcut in a proof. 10. --R "Conditions n-ecessaires et su#santes de convergence L 1 en probabilit-e de l'histogramme pour une densit-e," "An approximation to the density function," "On the L 1 -Error in Histogram Density Estimation: The Multidimensional Case" Cambridge University Press Real variable Methods in Fourier Analysis "The equivalence of weak, strong and complete convergence in L1 for kernel density esti- mates," "A note on the L1 consistency of variable kernel estimates," "The Hilbert kernel regression estimate," "On the Hilbert density estimate," "The strong uniform consistency of nearest neighbor density estimates," Recouvrement du tore T q par des ouverts al-eatoires Discriminatory analysis "A consistent nonparametric multivariate density estimator based on statistically equivalent blocks," "Consistency conditions for probability estimators and integrals of density estimators," "Note on the di#erentiability of multiple integrals," "A nonparametric estimate of a multivariate density function," "Asymptotic normality of multivariate k-NN density estimates," "Multivariate k-nearest neighbor density estimates," "A counter-example in the theory of strong di#erentiation," "Consistency properties of nearest neighbor density function esti- mators," "On the estimation of a probability density function and the mode," "The distribution of the first ladder moment and height and fluctuation of a random walk," "Remarks on some nonparametric estimates of a density function," "On the strong derivatives of functions of an interval," "A useful convergence theorem for probability distributions," Empirical Processes with Applications to Statistics Measure and Integral --TR The Hilbert Kernal regression estimate
saks rarity theorem;nearest neighbor estimate;Jessen-Marcinkiewicz-Zygmund theorem;convergence;kernel estimate;bandwidth selection;nonparametric estimation;density estimation
598407
Coherence-Enhancing Diffusion Filtering.
The completion of interrupted lines or the enhancement of flow-like structures is a challenging task in computer vision, human vision, and image processing. We address this problem by presenting a multiscale method in which a nonlinear diffusion filter is steered by the so-called interest operator (second-moment matrix, structure tensor). An m-dimensional formulation of this method is analysed with respect to its well-posedness and scale-space properties. An efficient scheme is presented which uses a stabilization by a semi-implicit additive operator splitting (AOS), and the scale-space behaviour of this method is illustrated by applying it to both 2-D and 3-D images.
Introduction Oriented flow-like structures arise in many computer vision and image processing problems: Within the field of texture analysis they appear for instance in the automatic grading of fabrics or wood surfaces, but they are also of importance for fingerprint analysis in forensic applications. They are present in many scientific imaging problems ranging from fluid dynamics to meteorology, and last but not least in medical imaging, for instance in the analysis of trabecular structures in bones. Interestingly, related tasks such as gap completion or the completion of interrupted lines also play a role in human vision tasks such as perceptual grouping. Moreover, the success of paintings by Munch or van Gogh suggests that emphasizing flow-like structures may create effects which fascinate many people. Analysing flow-like patterns is an active research topic for certainly more than one decade; see for instance Kass and Witkin [28]. Besides methods such as Gabor filters or steerable filters, many of these approaches are equivalent to the so-called structure tensor (interest operator, second moment [17, 44]. In the meantime this field has even entered textbooks [21], and it can be regarded as well-established. Much less attention has been payed to the question how to enhance flow-like patterns. Poor quality of fingerprint or trabecular bone images is not unusual. In those cases it would be desirable to have a tool which improves the quality of flow-like structures without destroying for instance semantically important singularities like the minutiae in fingerprints. For problems like the grading of fabrics or applications to fluid dynamics it is also useful to have a multiscale simplification of the original image by embedding it into a scale-space in order to obtain a subsequently coarser, more global impression of the main flow-like structures. Of course, such a scale-space should take into account the coherence of the structures by smoothing mainly along their preferred orientation instead of perpendicular to it. Since flow-like structures can also be present in higher dimensional data sets, e.g. 3-D images of trabecular bones, it should be possible to generalize such a method to arbitrary dimensions. The preceding problems will be addressed in this paper by presenting an m-dimensional scale-space for the enhancement of coherent structures. The underlying concept can be motivated from ideas of Perona Current address: Department of Computer Science, University of Copenhagen, Universitetsparken 1, DK-2100 Copenhagen, Denmark. and Malik for improving edge detection by creating a feedback loop of an edge detector and a nonlinear diffusion process [42]. In a similar way we embed a classical method for describing flow-like structures - namely the structure tensor approach - into a nonlinear diffusion process. This turns a method for analysing coherent pattern into a technique for enhancing and simplifying them. In contrast to most nonlinear diffusion filters, however, we use an approach where the process is steered by a diffusion tensor instead of a scalar-valued diffusivity. This enables true anisotropic behaviour by adapting the diffusion process not only to the location, but allowing also different smoothing in different directions. We shall see that this filter belongs to a class of nonlinear diffusion methods for which many well-posedness and scale-space properties can be proved. This is also in contrast to the Perona-Malik filter, whose continuous formulation is only locally well-posed [29]. Details of the numerical implementation will be discussed as well. In particular, an efficient novel stabilization technique based on a semi-implicit additive operator splitting (AOS) is presented. It extends previous encouraging experiments with AOS schemes for nonlinear diffusion filtering with a scalar-valued diffusivity to the fully anisotropic case with a diffusion tensor. All theoretical and numerical discussions hold in the m-dimensional case. As examples, results from 2-D and 3-D implementations are presented. The outline of the papers is as follows: Section 2 surveys the underlying structure tensor method for describing coherence in images. This method is used in Section 3 for constructing a nonlinear diffusion process which smoothes along coherent flow-like structures. This process is called coherence-enhancing diffusion (CED). Section 4 gives a detailed analysis of the theoretical properties of a more general class of diffusion filters comprising CED. In Section 5 numerical and algorithmical questions are addressed; in particular, a more efficient alternative to the explicit scheme is presented. Section 6 applies CED to 2-D and 3-D images from different application areas. The paper is concluded with a summary in Section 7. Some results in this paper have been presented earlier at conferences [50, 56]. Related work. Since the work of Perona and Malik [42] numerous nonlinear diffusion filters have been proposed; see e.g. [23, 53] for an overview. Nevertheless, most of them use a (spatially varying) scalar diffusivity, not a diffusion tensor. Thus, they act inhomogeneously (nonuniformly) on the image, but - in our terminology - they remain isotropic. True anisotropic diffusion filtering is studied in the reaction-diffusion model of Cottet and Germain [15]. Its diffusion tensor uses the eigenvectors v 1 k ru oe , its eigenvalues are given by (j ? 0): This choice is similar to our method it that sense that it diffuses mainly along strongly anisotropic structures. However, there are two important differences: Firstly, we observe that this diffusion tensor cannot be treated within a scale-space framework using uniformly positive definite diffusion tensors. Moreover, the Cottet-Germain model uses an additional reaction term which leads to nontrivial steady-states and qualifies it as a pure restoration method without scale-space ambitions. Secondly, the eigendirections of D are adapted to ru oe , not to the eigendirections of the structure tensor. We shall see that the introduction of an integration scale in the structure tensor is an essential model feature in order to obtain reliable orientation estimates for flow-like structures. Recently Cottet and El Ayyadi have proposed a modified image restoration model which replaces the spatial regularization by a temporal regularization [14]. Nitzberg and Shiota [39] pioneered shape-adapted Gaussian smoothing, where the shape of an anisotropic Gaussian convolution kernel is a function of the structure tensor. Later on similar proposals have been made in [33, 61] and supplemented with scale-selection methods [1]. It should be noted that a common feature of all the preceding shape-adapted Gaussian smoothing methods is the combination of isotropic smoothing inside a region with anisotropic smoothing along edges. Space-variant Gaussian blurring is, however, not equivalent to an inhomogeneous diffusion process, and it does not preserve the average grey value. Anisotropic diffusion filters with isotropic diffusion within regions and anisotropic diffusion along edges can be found in [51] and the references therein. These methods are different from the present approach: CED is basically a pure 1-D diffusion, where a minimal amount of isotropic smoothing is added only for regularization purposes. Other anisotropic partial differential equations for smoothing images rely on morphological methods such as the mean-curvature motion (geometric heat equation, Euclidean shortening flow) [30, 4] with - being the direction perpendicular to ru. Since mean-curvature motion propagates isophotes in inner normal direction with curvature-dependent speed, we should not expect such completely local methods to be capable of closing interrupted line-like structures. The same holds for the affine invariant version of this process [3, 46]. All these methods do not take into account semilocal information as can be gained from the structure tensor. Recent results by Carmona and Zhong [12] confirm the importance of semilocal estimates of the smoothing direction also for equations of mean-curvature type, if one is interested in specific goals such as enhancement of line-like structures. Three-dimensional nonlinear diffusion filters have been investigated first by Gerig et al. [18] in the isotropic case, and by Rambaux and Gar-con [43] in the edge-enhancing anisotropic case. A generalization of coherence-enhancing anisotropic diffusion to higher dimensions was first proposed in [56]. A recent three-dimensional PDE-based filter by Krissian et al. [32] and a 3-D reaction-diffusion process by Payot et al. [41] may be related to these anisotropic diffusion techniques. The discussion above shows that the distinctive features of our approach is a semi-local analysis by means of the structure tensor combined with 1-D diffusion along one of its eigenvectors. 2 The structure tensor First we review a reliable tool for analysing coherent flow-like structures. Consider an m-dimensional image domain\Omega := (0; a 1 ) \Theta \Delta \Delta \Delta \Theta (0; am ), and let an image u(x) be represented by a bounded mapping A very simple structure descriptor is given by ru oe , the gradient of a Gaussian-smoothed version of u: The standard deviation oe denotes the noise scale, since it makes the edge detector ignorant of details smaller than O(oe). Convolution on a finite domain\Omega can be defined as convolution between K oe and ~ u on IR m , where ~ u denotes an extension of u by mirroring. This results in applying no-flux boundary conditions. Although ru oe is useful for detecting edges, it is unsuited for finding parallel structures, as we can see from Figure 1. The left image shows an original fingerprint. Figure 1(b),(c) illustrates the gradient orientation using grey values: vertical gradients are depicted in black, and horizontal ones in white. We observe that for small oe high fluctuations remain, while larger oe lead to entirely useless results. This is due to the fact that for larger oe neighbouring gradients with the same orientation, but opposite sign cancel one another. Gradient smoothing averages directions instead of orientations 2 . To make the structure descriptor invariant under sign changes, we may replace ru oe by its tensor product oe\Omega ru oe := ru oe ru T This matrix is symmetric and positive semidefinite, and its eigenvectors are parallel and orthogonal to ru oe , respectively. The corresponding eigenvalues jru oe j 2 and 0 describe just the contrast in the eigendirections. Now that we have replaced directions by orientations, we can average the orientations by applying a componentwise convolution with a Gaussian This matrix is named structure tensor, interest operator or second-moment matrix. It is useful for many different tasks, for instance for analysing flow-like textures [44], corners and T-junctions [17, 39], shape cues [33] and spatio-temporal image sequences [27]. Equivalent approaches have been discovered In our terminology, gradients with opposite sign share the same orientation, but point in opposite directions. Figure 1: Local orientation in a fingerprint image. From Top Left To Bottom Right: (a) Original Orientation of smoothed gra- dient, Orientation of smoothed gradient, 5. (d) Structure tensor independently in [7, 28]. A book by J-ahne [27] gives a nice overview of these methods and clarifies their mutual relations. It is not hard to verify that the symmetric matrix J ae is positive semidefinite. Let its eigenvalues be ordered such that and let fw 1 ; :::; wm g denote the corresponding orthonormal set of eigenvectors. Since the eigenvalues integrate the variation of the grey values within a neighbourhood of size O(ae), they describe the average contrast in the eigendirections w . Thus, the integration scale ae should reflect the characteristic size of the texture. Usually, it is large in comparison to the noise scale oe. The eigenvector wm corresponds to the smallest eigenvalue -m . It is the orientation with the lowest fluctuations, the so-called coherence orientation 3 . Figure 1(d) depicts the coherence orientation for the fingerprint image. We observe that it is exactly the desired average orientation of the lines. It should be noted how well the singularity corresponds to the singularity in the original fingerprint image. The eigenvalues of J ae provide useful information on the coherence of a structure, i.e. the actual amount 3 For the case that we have p identical minimal eigenvalues, one may regard every orientation within the span of as a coherence orientation. For natural images, this situation happens almost never and can be neglected. of anisotropy. As a measure for the coherence, one can define It becomes large for strongly differing eigenvalues, and it tends to zero for isotropic structures. Coherence-enhancing anisotropic diffusion in m dimensions Now that we know how to analyse coherent structures, we draw our attention to the question of how to enhance them. This can be done by embedding the structure tensor analysis into a nonlinear diffusion filter. The principle of nonlinear diffusion filtering is as follows. One calculates a processed version u(x; t) of f(x) with a scale parameter t - 0 as the solution of a diffusion equation with f as initial condition and reflecting boundary conditions: (D ru) on\Omega \Theta (0; 1); (8) @\Omega \Theta (0; 1): (10) Hereby, n denotes the outer normal and h:; :i the usual inner product. If one wants to adapt the diffusion process to the image itself one should choose the symmetric positive definite diffusion tensor as a function of the local image structure. In the case of enhancing flow-like patterns, it is natural to adapt the diffusion tensor D to the structure tensor J ae (ru oe ). How should this function look like? For enhancing coherence in images with flow-like structures, we need a smoothing process which acts mainly along the flow direction wm (with the notations from Section 2) and the smoothing should increase with the strength of its orientation given by the coherence -. This may be achieved in the following way: We construct D such that it has the same eigenvectors as J ae and its eigenvalues are given by -m := ae ff if -=0, serves as a threshold parameter: For - AE C we get -m - 1, and - C leads to -m - ff. The exponential function and the small positive parameter ff 2 (0; 1) were introduced mainly for two theoretical reasons: First, this guarantees that the smoothness of the structure tensor carries over to the diffusion tensor. The second reason is that the process never stops: Even if the structure becomes remains some small linear diffusion with diffusivity ff ? 0. Thus, ff serves as a regularization parameter which keeps the diffusion tensor uniformly positive definite. In the next section we shall see that these are useful requirements in order to establish many theoretical properties for CED. 4 A general well-posedness and scale-space framework Coherence-enhancing anisotropic diffusion filtering can be regarded as a special case within a more general framework for nonlinear diffusion filtering, for which many well-posedness and scale-space properties can be found. This framework shall be analysed now. We study a diffusion filter with the following properties: Assume that f Let a:=inf \Omega f , and consider the problem \Omega \Theta (0; 1); @\Omega \Theta (0; 1); where the diffusion tensor satisfies the following properties: Smoothness: positive definiteness: If w there exists a positive lower bound -(K) for the eigenvalues of D(J ae (w)). Evidently, coherence-enhancing anisotropic diffusion satisfies the preceding requirements. Under the assumptions (P c ) the following theorem, which generalizes and extends results from [13, 51], can be proved. Theorem 1 (Well-posedness properties, smoothness, extremum principle) The problem (P c ) has a unique solution u(x; t) in the distributional sense, which is smooth for t ? 0: -\Omega \Theta (0; 1)): This solution depends continuously on f with respect to (\Omega\Gamma , and it fulfils the extremum principle a - u(x; on\Omega \Theta (0; 1): (13) Proof: See Appendix A.1. Remarks: (a) We observe a strong smoothing effect which is characteristic for many diffusion processes: boundedness of the initial image is sufficient to obtain an infinitely often differentiable solution for arbitrary small positive times. Additional requirements - for instance that f should be uniformly continuous in order to apply the theory of viscosity solutions - are not necessary in our case. (b) The continuous dependence of the solution on the initial image has significant practical impact as it ensures stability with respect to perturbations of the original image. This is of importance when considering stereo image pairs, spatio-temporal image sequences or slices from medical CT or MRI sequences, since we know that similar images remain similar after filtering. (c) The extremum principle offers the practical advantage that, if we start for instance with an image within the range [0; 255], we will never obtain results with grey value such as 257. (d) Coherence-enhancing anisotropic diffusion in not the only filter which is covered by the theorem above. The well-posedness theory (as well as the subsequent scale-space framework) comprises the regularized Perona-Malik filter by Catt'e, Lions, Morel and Coll [13] as well as the edge-enhancing anisotropic diffusion filter described in [51]. It is also possible to establish a semidiscrete and fully discrete well-posedness and scale-space theory which proceeds in the same way; see [54] for more details. 4.1 Scale-space properties Scale-space representations embed an image f into a family fT t f j t - 0g of gradually smoother, simplified versions of it. Long before this concept became popular in the western world by the work of Witkin [59] and Koenderink [31], it had been discovered and axiomatically justified in Japan by Iijima [26, 55]. Most axiomatic scale-space representations are devoted to the linear diffusion scale-space (Gaussian scale-space), but one can also create nonlinear scale-spaces which can be classified in a unique way [3, 8, 40]. All these approaches are uncommitted, since their unique classification does not give us the liberty to incorporate a-priori knowledge. Anisotropic nonlinear diffusion filtering, however, does offer the possibility to incorporate knowledge into its evolution. So let us now study some of its scale-space properties. It is evident that the filter class (P c ) satisfies typical scale-space properties such as the semi-group property, invariance under Euclidean image transformations, grey-level shifts, or contrast reversion. Moreover, since it can be written in divergence form and uses reflecting boundary conditions, it is also not hard to verify that the average grey level Z is not affected by nonlinear diffusion filtering [54, pp. 63-64]:j\Omega j Z Average grey level invariance is a property in which diffusion scale-spaces differ from morphological scale-spaces. In general, the evolution PDEs of the latter ones are not of divergence form and do not preserve the mean grey value. A constant average grey level is useful for scale-space based segmentation algorithms such as the hyperstack [37, 49]. It is also a desirable quality for applications in medical imaging where grey values measure physical qualities of the depicted object. 4.1.1 Causality in terms of nonenhancement of local extrema Let us now turn to the question in which sense an evolution equation of type (P c ) can be considered as a smoothing, information-reducing image transformation. Koenderink [31] required that a scale-space evolution should not create new level curves when increasing the scale parameter. If this is satisfied, iso-intensity linking through the scales is possible and a structure at a coarse scale can (in principle) be traced back to the original image (causality). For this reason, he required that at spatial extrema with nonvanishing determinant of the Hessian isophotes in scale-space are upwards convex. He showed that this constraint can be written as A sufficient condition for the causality equation (16) to hold is requiring that local extrema with positive or negative definite Hessians are not enhanced: an extremum in - at scale ' satisfies @ t u if - is a minimum, and @ t is a maximum. This implication is easily seen: In the first case, for instance, the eigenvalues j 1 ,.,j m of Hess(u) are positive. Thus, which gives just the causality requirement (16). Nonenhancement of local extrema has first been used by Babaud et al. [5] in the context of linear diffusion filtering. However, it is also satisfied by nonlinear diffusion scale-spaces, as we shall see now. 4 4 As in the linear diffusion case, nonenhancement of local extrema generally does not imply that their number is nonincreasing for dimensions Theorem 2 (Nonenhancement of local extrema). Let u be the unique solution of 2\Omega is a local extremum of u(:; ') with nonvanishing Hessian. Then, is a local maximum, (18) is a local minimum. (19) Proof: See Appendix A.2. Nonenhancement of local extrema is just one possibility to end up with Koenderink's causality re- quirement. Another way to establish causality is via the extremum principle (13) following Hummel's reasoning; see [25] for more details. 4.1.2 Lyapunov functionals and behaviour for t !1 Interestingly, causality in terms of nonenhancement of local extrema can be regarded as a first representative of a much larger class of smoothing properties of nonlinear diffusion filtering. Other representatives result from studying the Lyapunov functionals of these processes. Lyapunov functionals are energy-like expressions which decrease during the evolution and which have a lower bound. They can be useful for finding attractors of a process for t ! 1. The theorem below establishes a class of Lyapunov functionals and shows that processes of type (P c ) converge to a flat steady-state which is given by the average grey value of the original image. This is a desirable property for scale-spaces, since such a steady-state can be regarded as the coarsest, most global representation of the original image. Theorem 3 (Lyapunov functionals and behaviour for t !1). Suppose that u is the solution of (P c ) and let a, b, - be defined as in (P c ) and (14). Then the following properties are valid: (a) (Lyapunov functionals) For all r 2 C 2 [a; b] which are convex on [a; b] the function Z is a Lyapunov functional: (i) It is bounded from below by the value of \Phi for a constant image with the same average grey level: continuous in 0, and decreasing for all t ? 0. (b) (Convergence) converges to a constant image with the same average grey value: lim Proof: See Appendix A.3. What are interesting representatives of this family of Lyapunov functionals? Considering the Lyapunov functions associated with respectively, the preceding theorem gives the following corollary. Corollary 1 (Special Lyapunov functionals). Let u be the solution of (P c ) and a and - be defined as in (P c ) and (14). Then the following functions are decreasing for t 2 [0; 1): (a) ku(t)k L p for all p - 2. (b) M 2n [u(t)] :=j\Omega j Z (c) H [u(t)] := Z Corollary 1 offers multiple possibilities of how to interpret nonlinear anisotropic diffusion filtering as a smoothing transformation. As a special case of (a) it follows that the energy ku(t)k 2 is reduced by diffusion. Using Parseval's equality we know that a decreasing energy is also equivalent to a decreasing sum of the squared Fourier coefficients. Part (b) gives a probabilistic interpretation of anisotropic diffusion filtering. Consider the intensity in an image f as a random variable Z f with distribution F f (z), i.e. F f (z) is the probability that an arbitrary grey value Z f of f does not exceed z. By the average grey level invariance, - is equal to the expected value Z z dF u(t) (z); (23) and it follows that M 2n [u(t)] is just the even central moment Z The second central moment (the variance) characterizes the spread of the intensity about its mean. It is a common tool for constructing measures for the relative smoothness of the intensity distribution. The fourth moment is frequently used to describe the relative flatness of the grey value distribution. Higher moments are more difficult to interpret, although they do provide important information for tasks like texture discrimination [22, pp. 414-415]. All decreasing even moments demonstrate that the image becomes smoother during diffusion filtering. Hence, local enhancement effects, which object to increase central moments, are overcompensated by smoothing in other areas. If we choose another probabilistic model of images, then part (c) characterizes the information-theoretical side of our scale-space. Provided the initial image f is strictly positive on \Omega\Gamma we may regard it also as a two-dimensional density. 5 Then, Z\Omega is called the entropy of u(t), a measure of uncertainty and missing information [11]. Since anisotropic diffusion filters increase the entropy, the corresponding scale-space embeds the genuine image f into a family of subsequently likelier versions of it which contain less information. Moreover, for the process reaches the state with the lowest possible information, namely a constant image. This information-reducing property indicates that anisotropic diffusion might be generally useful in the context of image compression. In particular, it helps to explain the success of nonlinear diffusion filtering as a preprocessing step for subsampling as observed in [16]. The interpretation of the entropy in terms of Lyapunov functionals carries also over to generalized entropies, see [48] for more details. From all the previous considerations, we recognize that anisotropic diffusion does really simplify the original image in a steady way. 5 Numerical aspects To approximate CED numerically, we replace the derivatives by finite differences. Since continuous CED has the structure 5 Without loss of generality we omit the normalization. its simplest discretization is given by the finite difference scheme \Deltat In this notation, U describes a vector containing the values at each pixel. The upper index denotes the time level and L ij is a central difference approximation to the operator @ x Since (27) can be rewritten as I \Deltat we observe that U k+1 can be calculated explicitly from U k without any matrix inversions. For this reason it is called an explicit scheme. Unfortunately, such explicit schemes require very small time steps \Deltat in order to be stable. Therefore, it is desirable to replace (28) by an implicit scheme which has the same first-order Taylor expansion in \Deltat, but better stability properties. One possibility is the AOS-stabilized scheme ll I \Deltat This method achieves a stabilization through the nonnegative matrices a semi-implicit discretization of the diffusion caused by the l-th diagonal entry of the diffusion tensor. The typically used step size \Deltat = 2 is about one order of magnitude larger than the ones for which an explicit scheme of type (27) is stable in 2-D or 3-D. For the standard approximations with central derivatives within a (3 \Theta 3)-stencil, the matrix inversions in (29) come down to solving diagonally dominant tridiagonal systems of linear equations. This can be performed in linear complexity with a modified Gaussian algorithm (Thomas algorithm). It should be noted that (29) uses an additive operator splitting (AOS) instead of the usual multiplicative operator splitting from the mathematical literature such as [34]. This guarantees that all axes are treated in the same way. AOS schemes have been introduced in [57] as an efficient and reliable method for isotropic nonlinear diffusion filtering, which perform well on parallel computer architectures [58]. Equation (29) shows one way how to extend them to anisotropic processes with a diffusion tensor. The final CED algorithm is as follows: 1. Calculation of the structure tensor in each pixel. This requires one convolution with a Gaussian K oe , and convolutions with K ae . The convolutions were implemented in the spatial domain exploiting the separability and symmetry of the Gaussian. 2. Principal axis transformation of the structure tensor in each pixel. In our case this was done by a cyclic Jacobi algorithm [47]. 3. Calculation of the diffusion tensor in each pixel. Here a significant speed-up is possible by creating a look-up table for the function (12) at the beginning of the programme run. 4. Calculation of I \Deltat 5. Calculation of l := ll by means of the Thomas algorithm [57]. 6. Calculation of U This algorithm is computationally less complex than it looks at first glance: typical execution times for one iteration on a HP 9000/889 are 0.3 seconds for a 256 \Theta 256 image and 9 seconds for a 64 \Theta 64 \Theta 64 image. Figure 2: Anisotropic equations applied to the fingerprint image. (a) Top Left: Original image. (b) Top Right: Mean curvature motion, Left: Anisotropic diffusion similar to the Cottet-Germain model, Coherence-enhancing anisotropic diffusion, 6 Examples Figure 2 illustrates the importance of choosing the appropriate smoothing direction in anisotropic processes. In Figure 2(b) mean curvature motion is applied to the fingerprint image. We observe that - although mean curvature motion is a completely anisotropic technique with many merits in computer vision - it cannot be used for closing interrupted line-like structures: topologically connected structures remain connected, but gaps become larger, since both ends move in opposite directions. MCM does not exploit any semilocal information. Figure 2(c) shows the effect of coherence-enhancing anisotropic diffusion where ff and the integration scale ae are set to 0. This model is close in spirit of the Cottet-Germain filter [15]. For such a model it is difficult to find a useful noise scale oe for smoothing along flow-like structures: for oe ! 0, ru becomes eigenvector of D and the diffusion is halted, since the corresponding eigenvalue - 1 is zero. If oe becomes larger, the effect illustrated in Figure 1(c) dominates: opposite gradients cancel one another leading to more or less random smoothing directions. Coherence-enhancing diffusion filtering with a nonvanishing integration scale is depicted in Figure 2(d). We observe that diffusion along the coherence orientation w 2 is well-suited for closing interrupted lines in flow-like textures. Due to its reduced diffusivity at noncoherent structures, the location of the semantically important singularity in the fingerprint remains the same. This is an important prerequisite that any image processing method has to satisfy if it is to be applied to fingerprint Figure 3: Scale-space behaviour of coherence-enhancing diffusion (a) Top Left: Original fabric analysis. In this and all subsequent CED images the parameters used. Figure 3 depicts the scale-space behaviour of coherence-enhancing anisotropic diffusion applied to a fabric image arising in computer aided quality control. The temporal behaviour of this diffusion filter seems to be appropriate for visualizing coherent fibre agglomerations (stripes) at different scales, a difficult problem for the automatic grading of nonwovens. Let us now investigate the impact of coherence-enhancing diffusion on images, which are not typical texture images, but still reveal a flow-like character. To this end, we shall process expressionistic paintings by Vincent van Gogh. Fig. 4 shows the restoration properties of coherence-enhancing anisotropic diffusion when being applied to a selfportrait of the artist [19]. We observe that the diffusion filter can close interrupted lines and enhance the flow-like character which is typical for van Gogh paintings. The next painting we are concerned with is called "Road with Cypress and Star" [20]. It is depicted in Fig. 5. In order to demonstrate the influence of the integration scale ae, all filter parameters are fixed except for ae. In Fig. 5(b) we observe that a value for ae which is too small does not lead to the visually dominant coherence orientation and, thus, the filtered structures reveal a lot of undesired fluctuations. Increasing the value for ae improves the image significantly (Fig. 5(c)). Interestingly, a further increasing of ae does hardly alter this result (Fig. 5(d)), which indicates that this van Gogh painting possesses a uniform "texture scale" reflecting the characteristic painting style of the artist. Figure 6 illustrates the potential of CED for medical applications. It depicts a human bone. Its internal Figure 4: Image restoration using coherence-enhancing anisotropic diffusion. (a) Left: "Selfportrait" by van Gogh (Saint-R'emy, 1889; Paris, Muse'e d'Orsay), structure has a distinctive texture through the presence of tiny elongated bony structural elements, the trabeculae. There is evidence that the trabecular formation is for a great deal determined by the external load [60, 35, 6]. For this reason the trabecular structure constitute an important clinical parameter in orthopedics. Examples are the control of recovery after surgical procedures, such as the placement or removal of metal implants, quantifying the rate of progression of rheumatism and osteoporosis, the determination of left-right deviations of symmetry in the load or establishing optimal load corrections for physiotherapy. The high resolution of contemporary CT using slipring technology and MR scanners now enables in vivo analysis of detailed trabecular structure. While in vivo analysis of the trabecular bone by means of a structure tensor is investigated in [24, 36], the present paper points out ways to enhance the coherence information in medical images, in order to ease such an analysis. From Figure 6(b),(c) we observe that CED is indeed capable of closing interrupted lines. Parallel flow- like structures are enhanced and a subsequent coherence analysis becomes much easier. Increasing the time t gives a coarser representation of the coherence. The entire evolution creates a task-driven scale-space which is dedicated to flow-like patterns. In medical applications physicians often insist in only very small amounts of smoothing, in order to reduce some noise without affecting clinically relevant structures too much. Simplifications as in Figure 6(c) would be considered as misleading. Figure 7 shows the results for two iterations of three-dimensional CED filtering. The data set reveals a size of 256 \Theta 256 \Theta 128, and the voxel dimensions are 0:25 \Theta 0:25 \Theta 0:5 mm 3 . It depicts a CT scan of a foot area by means of a Philips SR8000 slipring CT at 140 kV. Even for 3-D data sets, such a slight preprocessing using only a few iterations can easily be performed within the acquisition time. The price of a suitable hardware would be a small fraction of the price for a CT scanner. It should be noted that in some 3-D applications it might also be desirable to smooth along two directions instead of one as in CED. Diffusion methods of this type have been studied by Rambaux and Gar-con [43]. They are 3-D versions of the edge-enhancing anisotropic diffusion filter from [51]. 7 Summary and conclusions In the present paper we have treated the problem of enhancing flow-like patterns. For such tasks a reliable measurement of local orientation is needed. Our experiments demonstrate that the structure Figure 5: Impact of the integration scale on coherence-enhancing anisotropic diffusion 8). (a) Top Left: "Road with Cypress and Star" by van Gogh (Auvers-sur-Oise, 1890; Otterlo, Rijksmuseum Kr-oller-M-uller), Filtered with ae = 1. (c) Bottom Left: Figure (a) Top: High resolution slipring CT scan of a femural bone, showing the trabecular formation. Slice thickness 1 mm, field of view 6 Left: Filtered by coherence-enhancing anisotropic diffusion, oe =0:5, ae =6, t =16. (c) Bottom Right: Dito with t =128. tensor satisfies this requirement. Unlike many other applications, we do not restrict its application to pure image analysis, we use it as a tool for steering a scale-space evolution. To this end, we evolve the original image by means of a nonlinear anisotropic diffusion equation. Its diffusion tensor reflects the local image structure by using the same set of eigenvectors as the structure tensor. The eigenvalues are chosen in such a way that diffusion acts mainly along the direction with the highest coherence, and becomes stronger when the coherence increases. The resulting coherence-enhancing diffusion (CED) process gives a theoretically well-founded scale-space representation: proofs have been presented which show that its unique solution is stable under perturbations of the initial image, satisfies Koenderink's causality requirement, and creates a large family of Lyapunov functionals which ensure that the process is image simplifying and converges to a constant steady-state. This theoretical framework is valid in any dimension. We have also presented an m-dimensional numerical scheme where a stabilization based on additive operator splitting (AOS) allows time steps which are one order of magnitude larger than in the explicit case. Finally, the use of CED was illustrated by applying it to 2-D and 3-D data sets. The results indicate a variety of possible application areas ranging from computer aided quality control over fingerprint enhancement to medical imaging. This, however, gives only one aspect of the filter concept. Coherence-enhancing diffusion allows also generalizations to vector-valued images. Details in this direction can be found in [52]. Acknowledgments . The author thanks Robert Maas and Stiliyan Kalitzin for useful comments on a draft version of this paper, and Wiro Niessen for providing the 3-D trabecular bone data set. Figure 7: Three-dimensional CED applied to a CT data set of size 256 \Theta 256 \Theta 128. sections depicting slice no. 180 in x, no. 128 in y, and no. 100 in z, respectively. Right Column: Filtered, oe =0:5, ae =6, t=4. --R Enhancement of fingerprint images using shape-adapted scale-space operators Axioms and fundamental equations in image processing Image selective smoothing and edge detection by nonlinear diffusion. Uniqueness of the Gaussian kernel for scale space filtering The orientation of apatite crystals in bone Optimal orientation detection of linear symmetry Op'erateurs maximaux monotones et semi-groupes de contractions dans les espaces de Hilbert Maximum entropy in action Adaptive smoothing respecting feature directions Image selective smoothing and edge detection by nonlinear diffusion Nonlinear PDE operators with memory terms for image processing Image processing through reaction combined with nonlinear diffusion A fast operator for detection and precise location of distinct points Nonlinear anisotropic filtering of MRI data Road with cypress and star Signal processing for computer vision Representations based on zero-crossings in scale space Basic theory on normalization of pattern (in case of typical one-dimensional pattern) Lecture Notes in Comp. Computer Vision Maximum and comparison principles for anisotropic diffusion Toward a computational theory of shape: An overview The structure of images Directional anisotropic diffusion applied to segmentation of vessels in 3D images Splitting and alternating direction methods Die Architektur der Spongiosa Nonlinear multiscale representations for image segmentation Nonlinear image filtering with edge and corner enhancement Classification and uniqueness of invariant geometric flows An adaptive and constrained model for 3D X-ray vascular reconstruction Scale space and edge detection using anisotropic diffusion Nonlinear anisotropic diffusion filtering of 3D images Computing oriented texture fields Generic evolution of edges on families of diffused greyvalue surfaces ter Haar Romeny Probabilistic multiscale image segmentation Theoretical foundations of anisotropic diffusion in image processing A review of nonlinear diffusion filtering Anisotropic diffusion in image processing On the history of Gaussian scale-space axiomatics Structure adaptive anisotropic filtering --TR --CTR S. Tabik , E. M. Garzn , I. Garca , J. J. Fernndez, High performance noise reduction for biomedical multidimensional data, Digital Signal Processing, v.17 n.4, p.724-736, July, 2007 Jose-Jesus Fernandez , Sam Li, Anisotropic Nonlinear Filtering of Cellular Structures in Cryoelectron Tomography, Computing in Science and Engineering, v.7 n.5, p.54-61, September 2005 J.-O. Lachaud , B. Taton, Deformable model with a complexity independent from image resolution, Computer Vision and Image Understanding, v.99 n.3, p.453-475, September 2005 J. Martn-Herrero, Hybrid object labelling in digital images, Machine Vision and Applications, v.18 n.1, p.1-15, January 2007 Guy Gilboa , Nir Sochen , Yehoshua Y. Zeevi, Image Sharpening by Flows Based on Triple Well Potentials, Journal of Mathematical Imaging and Vision, v.20 n.1-2, p.121-131, January-March 2004 Leah Bar , Nahum Kiryati , Nir Sochen, Image Deblurring in the Presence of Impulsive Noise, International Journal of Computer Vision, v.70 n.3, p.279-298, December 2006
scale-space;nonlinear diffusion;image enhancement;texture
598422
Hypothetical Temporal Reasoning in Databases.
In this paper we integrate a historyencoding based methodology for checking dynamic database integrity constraints into a situation-calculus based specification of relational database updates. By doing this, we are able to: (1) Answer queries about a whole hypothetical evolution of a database, without having to update the entire database and keep all the information associated to the generated states, (2) State and prove dynamic integrity constraints as static integrity constraints, (3). Transform history dependent preconditions for updates into local preconditions.The methodology presented here is based on the introduction of operators of predicate past temporal logic as macros into the specifications, written in the situation calculus, of the dynamics of a database. Temporal subformulas of a query are treated as auxiliary views with the corresponding specification of their dynamics. An implementation of hypothetical temporal query answering is presented.
Introduction In (Reiter, 1995), as an application of his solution to the frame problem (Reiter, 1991), Ray Reiter proposed to specify the transaction based updates of a relational database by means of a particular kind of axioms written in the situation calculus (SC) (McCarthy et al., 1969). In (Bertossi et al., 1998) the implementation and the functionalities of SCDBR, a computational system for doing automated reasoning from and about those specications (Bertossi et al., 1998), are reported. We are motivated by the problem of answering queries about dier- ent states 1 in the evolution of a relational database, when the database is virtually updated by the execution of a sequence of primitive trans- actions, that are indecomposable and domain dependent transactions. Dedicated to the memory of our dear friend and colleague Javier Pinto (1959- 2001), who made important contributions to the logical foundations of the situation calculus. y Current address: University of Toronto, Dept. of Computer Science, Toronto, Canada. [email protected]. 1 In this paper we do no make any distinction between states and situations. c 2001 Kluwer Academic Publishers. Printed in the Netherlands. For example, we want to consider queries of the form \Has it always been the case that the database has satised a given condition C?", or \Has there been a state of the database where a certain condition C has been satised?", or \Has the salary of some employee decreased along the database evolution?". Reiter raised this problem in the context of his specications of transaction based database updates (Reiter, 1995). Although there is no explicit time in our situation calculus, we call these queries \temporal queries", due to their similarity with dynamic constraints (Reiter, 1995), also called \temporal constraints" (Chomicki, 1995) 2 . Furthermore, we call these queries \hypothetical" because we start from an initial, physical database at an initial state, list T of primitive transactions A virtually update the database, producing new states S we want to answer a query about the generated sequence of states, without physically updating the whole database accordingly (and possibly keeping the data for every intermediate state). We are interested in querying this whole virtual evolution of the database. The problem of answering this kind of queries was treated in detail in (Siu et al., 1996) and a solution was implemented as reported in (Bertossi et al., 1998). Nevertheless that solution is based on a kind of minimal progression of the database that depends on a detailed syntactical processing of the axioms of the specication, and the particular syntactical form of them. In this paper we reconsider this problem and we propose a new solution that relies on processing the query itself, rather than the underlying axioms. This is done on the basis of (1) a formulation of the query in a situation calculus language that contains temporal operators inspired by rst order past temporal logic (FOPTL) (Gabbay et al., 1994), (2) a reformulation of Chomicki's history encoding methodology for eciently checking temporal integrity constraints (Chomicki, 1995), in the context of situation calculus specications of database updates, and, in particular, (3) a specication in the situation calculus of the evolution of new history encoding auxiliary relations that are generated from the query. It turns out that the methodology we develop for answering queries can be adapted to give a solution to other reasoning problems. Here we show how to transform dynamic integrity constraints into static constraints, so that any available methodology for handling 2 Sometimes, in the literature, they are called \historical queries", but this name may cause confusions with work done by the temporal databases community that calls \historical" the queries about valid time, rather than about transaction time (Snodgrass et al., 1986), which can be better associated to the situations of the situation calculus. Hypothetical Temporal Reasoning 3 static integrity constraints can be adapted for the dynamic case. In particular, we can take advantage of our results on automated proving of static integrity constraints (Bertossi et al., 1996) when dealing with the dynamic case. The other problem we solve consists in transforming preconditions for action executions that depend on the history of the database into preconditions that depend on the local, execution state. This paper is concerned mainly with the problems of modeling and doing hypothetical reasoning in databases, a subject that has not received enough attention (but see (Bonner, 1990; Bonner et al., 1998; Chen, 1997)). We think hypothetical reasoning will become more and more important in databases that are used for decision support, where \what if" questions are relevant, as the ones emerging in on-line analytical processing (OLAP) and datawarehousing (Chaudhuri et al., 1997). To have computational tools that can be used to explore dierent courses of action without having to commit to any of them; in partic- ular, without having to physically update the database, is likely to be very important in many applications of information systems, specially in the presence of rich primitive transactions, like ours, that may aect several tables at the same time. This paper is structured as follows. In section 2 we brie y describe the situation calculus based specications of database updates. In section 2.1, we introduce temporal queries and constraints in a situation calculus framework. In section 3.1 we introduce our language for posing temporal queries. In section 3.2 we introduce the elements we need to evaluate queries, in particular, the specication of the dynamics of the auxiliary, history encoding, views; and we address the problem of answering the hypothetical temporal queries. In section 4 we apply the machinery developed in previous sections to the problem of transforming dynamic integrity constraints into static integrity constraints. In section 5 we apply our methodology to the problem of transforming history dependent transactions, i.e. transactions whose preconditions are temporal, into transactions with local conditions. In section 6 we sketch some possible extensions of the methodologies introduced in the previous sections. In section 7 we compare our work with other approaches in the literature, we comment on further work, and draw some conclusions. In appendix A, we illustrate our implementation of the developed methodology. In appendix B some proofs are given. 2. Specifying the Database Dynamics We will show the main ingredients of a specication in the situation calculus of transaction based database updates, as proposed in (Reiter, 1995). The SC is a family of languages of many sorted predicate logic used to represent knowledge and reason about dynamic domains that are subject to discrete changes caused by action executions. In its languages, we nd domain individuals, states and primitive transac- tions, i.e. domain specic and indecomposable transactions, that we will also call \actions", and which are at the same rst order level. In consequence, rst order quantication over all these sorts of individuals is possible. They are usually denoted by 8x, 8s, 8a, respectively. Among others we nd the following advantages in using the SC as a specication language: (1) It has a clear and well understood semantics. (2) Everything already done in the literature with respect to applications of predicate logic to DBs can be done here, in particular, all static and extensional aspects of databases and query languages are included. (3) Dynamic aspects can be integrated at the same object level, in particular, it is possible to specify how the database evolves as transactions are executed. (4) It is possible to reason in an automated manner from the specication and to extract algorithms for dierent computational tasks from it. (5) In particular, it is possible to reason explicitly about DB transactions and their eects. (6) In this form, it is possible to extend the functionality of usual commercial DBMSs. In every SC language we nd a constant for an initial state, S 0 , a function symbol, do, so that do(a; s) denotes the successor state that results from the execution of action a at state s. We also nd a pred- icate, Poss(a; s), with the intended meaning that action a is possible at state s. In a particular SC language we will nd function names for parameterized primitive transactions (actions), A(x), and names for tables, F (x; s), that is, predicates with a single state argument 3 . If T is a sequence of action terms A , to be executed in that order, we abbreviate the situation simply do(T ; s). As in (Lin et al., 1994), we will assume that the following foundational axioms of the situation calculus underlie any database spec- ication 4 : 1. Unique Names Axioms for Actions: A i (x) 6= A j (y), 3 They can be seen as usual database tables whose entries have an additional state stamp that is not stored in the extensional databases. In the knowledge representation literature they are usually called \ uents". States are used for distinguishing the successive snapshots of the database. 4 In this paper, a \database specication" always means a specication of the dynamics of a database. Hypothetical Temporal Reasoning 5 for all dierent action names A y]. 2. Unique Names Axioms for States: S 0 6= do(a; s), do(a 3. For some reasoning tasks we need an Induction Axiom on States: 8P [(P (S 0 )^8s8a (P A specication of the transaction based updates on a particular database will contain the following axioms: 4. A set, 0 , of SC sentences that do not mention any state term other than S 0 . This is knowledge about the initial state, and state independent knowledge. 5. Action Precondition Axioms: For each action name A, a precondition axiom of the form where A (x; s) is a SC formula that is simple in s, that is, it contains no state term other than s, in particular, no do symbol, no quantications on states, and no occurrences of the Poss predicate (Reiter, 1995). 6. Successor State Axioms (SSAs): For every table F (x; s), an axiom of the form where F is a formula simple in s, in particular, it does not contain the do symbol. Provided there is complete knowledge at the initial state, as is usually the case in relational databases, this axiom completely determines the contents of table F at an arbitrary legal database state, i.e. reached from S 0 by a nite sequence of transactions that are possible at their execution states. We are usually interested in reasoning about the states that are accessible in this form from the initial situation. For this purpose, an accessibility relation on states, , can be dened on the basis of the induction axiom by means of the conditions: :s < S 0 , We will denote this specication with . It includes the initial data-base 0 and the denition of the accessibility relation. Example 1. Consider a database of a company, with the following relations: Person x is an employee of the company when the database is in state s. Person x is a chief executive ocer of the company, in the state s. The salary of the person x is p in the state s. and primitive transactions: 6 Arenas, Bertossi Person x is hired by the company. Person x is red by the company. Person x is promoted to chief executive ocer. changeSalary The salary of the person x is changed to p dollars. The specication of the initial database has the the following formulas: ernest _ sue ernest ; sue 6= page ; john ernest ; john 6= page; ernest That is, John, Ernest and Page are the only employees of the company at the initial database state. The relations in this specication have the following successor state axioms (see For example, the rst SSA says that x is an employee at an arbitrary legal successor state if he was just hired or he already was an employee and he was not red in the transition to the successor state. Now, assume that we have the following precondition axioms for the actions in the database. applied to a formula containing a successor state returns an equivalent formula Hypothetical Temporal Reasoning 7 (with respect to the specication) evaluated at the preceding state. This is done by using the SSAs. More precisely, if predicate F , appearing in a formula , has a SSA like (2), then the operator, R, applied to , replaces each occurrence of an atomic formula of the form F ( t; do(a; s)) in by F ( t; a; s). The regression operator is implemented in SCDBR, a computational system for reasoning about and from specications of database dynamics as presented in this section (Bertossi et al., 1998). 2.1. Temporal queries and constraints In the context of such DB specications, a temporal query is a SC sentence ' in which all the states involved, including quantied states, lie on a nite state path S 0 S 1 S n , with a sequence of ground actions terms A some n. The query is true if and only if Example 2. In example 1, the temporal query \Has Sue been working in the company in all states generated by sequence T at S 0 ?" can be expressed in the SC by means of 8s (S 0 s S n Emp(sue; s)). The following sentence could be also a temporal query It asks whether the salary has not decreased. 2 A static integrity constraint is a formula of the form 8s(S 0 s '(s)), where '(s) is simple in the state variable s, such that is expected to hold (Reiter, 1995; Lin et al., 1994). A dynamic (or temporal) integrity constraint is a SC sentence of the form 8s 1 8s n (C(S that should be entailed by . Here, C(S that imposes a linear order constraint on the states S in terms of the accessibility predicate 5 . Example 3. The sentence 8s (S 0 s 8p could be a static integrity constraint, stating that Sue's salary can not be lower than 4000. The sentence 5 Dynamic integrity constraints are usually of this form, but the results we will present in this paper still hold if we admit more involved quantications on several states, related by the accessibility relation. 8 Arenas, Bertossi is a dynamic integrity constraint expressing that a salary never de- creases. 2 In general, we will not have explicit integrity constraints in our spec- ication, , of the database dynamics. We expect them to be logical consequences of (Reiter, 1995; Lin et al., 1994). In the next section we will introduce temporal operators as found in past temporal logic into the situation calculus. With these operators we will formulate queries and constraints, and their new syntactic form will allow us to process and evaluate them. 3. Answering Queries In (Chomicki, 1995), the problem of checking temporal constraints stated in FOPTL was considered. These are constraints that talk about, and relate, dierent states of the database. There we nd a sequence of transactions that are physically executed, and in order to minimize the cost of checking, one progressively updates new dened relations, or auxiliary views, r , that correspond to the temporal subformulas, , in the constraint. These views encode part of the database evolution up to a current database state. They are dened and updated in such a way that they store the historical information that is relevant to give an answer to the query about the satisfaction of the integrity constraint once the nal (current) state is reached. Then a new, non-temporal, but local and static query can be posed at the nal state. In this paper we will combine our reconstruction of Chomicki's history encoding in the context of specications of the dynamics of a database with the possibility, opened by those specications, of reasoning about the database evolution without having to physically update the database. In consequence, we will be in position to do hypothetical temporal reasoning about the database evolution. We can say that while Chomicki answers the query by positioning at the nal physical state of the database, we query a single future, virtual state from the initial, physical state. The fact that we are doing virtual updates makes it possible to apply our methodology to any temporal query, whereas, in the presence of physical updates, the queries have to be xed, predetermined in advance 6 . 6 This is not a limitation if, as in (Chomicki, 1995), one is interested in some xed dynamic integrity constraints only, but not in arbitrary temporal queries, as we are. Hypothetical Temporal Reasoning 9 3.1. A Query Language As discussed in section 2.1, a temporal query is a sentence ' in which all the states involved, including the quantied states, lie on a - nite state path S 0 S 1 S n , with a sequence of ground actions terms A In order to answer this kind of queries on an algorithmic basis, we need to dene them in a precise sense. Thus, we need to dene a query language for asking about the history of a sequence of states. To achieve this, we will introduce in the situation calculus some temporal operators inspired by rst order past temporal logic, and a macro, holds. With these new elements we will be in position to represent an important class of temporal queries. Nevertheless, if desired, the application of holds to a formula with temporal operators could be always rewritten into a usual situation calculus formula. The SC contains predicates with a state as an argument. For ex- ample, we use P (a; s) to state that a is an element of table P in the state s. We may eliminate the situation term from predicate P , and use a new meta-predicate, holds, and write holds(P (a);s) with the same meaning as before. Actually, we would like to extend the application of holds to more complex formulas, derived from SC formulas, but keeping the state dependency in the second argument of holds. Denition 1. A formula ' is state suppressed (an ss-formula) if it is constructed as usual from state independent predicates, state dependent predicates (i.e. database tables or uents) with the state argument supressed, boolean connectives, and rst order quantications on domain individuals. 2 For example, the following is an ss-formula: 8x9p (Ceo(x)^Emp(x; p) 7 The state arguments have been suppressed from the tables. Predicate holds will have an ss-formula in its rst argument, and a state in the second argument. This would make holds a second order predicate. We can go back to rst order expressions by considering holds as a macro, as an abbreviation, as something that can be rewritten into an expression of the original situation calculus. Thus, holds(';s), where ' is an ss-formula, is dened recursively as follows: 7 We should use new predicates, say Emp(; should be no confusion. is a state independent predicate holds(F (x);s) := F (x; s), if F is a predicate for a database table holds(:';s) := :holds(';s) holds(' _ ;s) := holds(';s) _ holds( ;s) holds(' ;s) := holds(';s) holds( ;s) holds(' ;s) := holds(';s) holds( ;s) holds(9x';s) := 9xholds(';s), if x is a variable for domain individuals holds(8x';s) := 8xholds(';s), if x is a variable for domain individuals. An advantage of using the macro holds is that we can extend the class of formulas ' in holds(';s), in such a way that they contain new, temporal operators that represent subformulas with some useful, natural and common quantication over states. In addition, we can make the nal, evaluation state, s, explicit. For example, we want to represent in a compact and distinguishable way the formula 8s 0 (S 0 which says that a is an element of table P in every state previous to s, without using an explicit quantication over states. For doing this, we introduce a logical temporal operator, 2, dened by More precisely, for posing temporal queries, we will introduce in the SC the four typical temporal operators of rst order past temporal logic, the same operators considered in (Chomicki, 1995). The intended meanings of them are: (a) ' for \' was true at the previous moment of time". (b) ' since for \ was true at some time in the past and from that time on, ' has been true". (c) 3' for \Sometime in the past ' was true". (d) 2' for \Always in the past ' was true". 8 They will be introduced as macros though, via the holds predicate. In consequence, the class of ss-formulas (denition 1) has to be extended by means of the extra rule: If '; are ss-formulas, then ', ' since , 3', 2' are also ss-formulas. 8 The last two operators can be dened in terms of the rst two by 3' := True since ', and 2' := :3:'. Hypothetical Temporal Reasoning 11 The combinations of holds and the temporal operators are dened by the following macros, that can be rewritten as SC formulas as follows: holds(' since ;s) := 9s 0 (S This is is a recursive denition. In it, ' and are formulas that may include connectives :, _, ^, and ; quantication over domain individuals; and operators , since, 3 and 2. From now on, our temporal query language will consist of the formulas we just dened. More precisely, our temporal queries will be of the form where ' is an ss-formula and T is a sequence of ground actions. Formula ' in (4) will possibly contain temporal operators, that is, it may contain subformulas starting with an application of a temporal operator. In section 3.2, to each of these subformulas, , we will associate a new, auxiliary, history encoding view, R . Next, for these views we will derive specications of their dynamics, and use them in the process of query answering. Before doing this, we present some examples of temporal queries expressed in terms of the new operators. Example 4. We can express the queries shown in example 2 as follows. \Has Sue been working in the company in all states generated by a sequence of actions T at S 0 ?": holds(Emp(sue)^2Emp(sue);do(T \Is is true that the salaries have never decreased along the states generated by action sequence T executed at S 0 ?": 2(Salary Example 5. The query \Was Joe hired as an employee of a lower rank before becoming a Chief Executive Ocer (CEO) in all states generated by a sequence of actions T at S 0 ?" can be expressed by the formula Example 6. The query \Is there anybody who has always been working in the company (along the execution of the sequence of actions T from can be expressed by the formula )):With the temporal operators we can express an interesting and natural class of temporal queries. The introduction into the situation calculus of the temporal operators cannot substitute for the whole expressive power of the situation calculus (Abiteboul et al., 1996), nevertheless we can express with them the queries we need in most common practical applications. 3.2. Evaluating the Query Our starting point consists of a SC specication as in section 2, and a query holds(';S), where ' is an ss-sentence, possibly containing temporal operators, to be evaluated at the nal state As expected, this formula implicitly refers to the states between S 0 and S. In order to answer the query, we will construct a new SC specication H that extends , and a new SC sentence, H(';S), such that the answer to the original query, coincides with the answer obtained from the evaluation of H(';S) with respect to H . The new sentence, H(';S), refers only to the state S, and H contains a specication of the dynamics of some new, history encoding, auxiliary relations that correspond to the temporal subformulas in '. Being in this new scenario, we can use any algorithm for answering that refer to a single, future state of the database. First we will generate H(';S), for an ss-formula ' and ground state S. Next, we will show how to generate H . 1. If ' is of the form t 1 t 2 , where t 1 and t 2 are terms (for domain 2. If ' is of the form P ( is a state independent predicate, then H(';S) := P ( t). 3. If ' is of the form F ( t), where F is a predicate for database table, then H(';S) := F ( t; S). 4. If ' is : , then H(';S) := :H( ;S). Hypothetical Temporal Reasoning 13 5. H( ;S) := H( ;S) H(;S), where is any of the usual binary propositional connectives. 6. H(Qx ';S) := Qx H(';S), where Q is any of the usual rst order quantiers. 7. If ' is (x), 3 (x) or 2 (x), where does not contain any of the operators , since, 3 and 2, then H(';S) := R ' (x; S), where R ' is a new table name. 8. If '(x) is (x) since (x), where (x) and (x) do not include any of the operators , since, 3 and 2, then H(';S) := R ' (x; S), where R ' is a new table name. By bottom{up transformation of a formula ' that appears in the macros holds, we can always obtain such a formula H(';S). Notice that this is a SC formula that is simple in the state S, i.e. it talks about an isolated state, S. Now, we will specify the dynamics of the new tables introduced in the last two cases in the inductive denition above by means of appropriate SSAs: (a) Let (x) be of the form (x). This formula is true at a given state i (x) is true at the previous state. Then, the new table R (x; s) has the following SSA: 8(a; s)P oss(a; s) 8x(R (x; do(a; s)) H( (x);s)). At the initial state (x) is false for each x, because S 0 has no predecessor state, so we specify 8x:R (x; S 0 ). (b) Let (x) be of the form (x) since (x). This formula is true at a state s, with predecessor state s 0 , i ( since ) was true at s 0 and is still true at s, or became true at s and became true at s 0 . This is equivalent to saying that (( since ) _ ) is true at s 0 and is true at s. Then, for R (x; s) it holds: This is not a SSA of the form (2), because there is a do(a; s) term in one of the formulas on the RHS. But we can get rid of it applying Reiter's regression operator R, that takes a formula, instantiated at a successor state of the form do(a; s), into a formula instantiated at the previous state, s (see section 2). So, we obtain: 14 Arenas, Bertossi Notice that the application of the regression operator leaves the RHS of the equivalence above as a simple formula in s. Also notice that when is a sentence, then the SC formula R a situation dependent propositional predicate. Finally, we also specify 8x:R (x; S 0 ). (c) Let (x) be of the form 3 (x). Given that 3 (x) := true since (x), the new table R has the specication: Let (x) be of the form 2 (x). Since 2 (x) := :3: (x), R has the specication: Example 7. Assume that the original specication contains the following SSA for the table P (x; s): We want to evaluate the query 9x(P (x) since 3Q(x)) at state then we introduce a new table R with SSA: Introducing R in the query, we obtain 9x(P (x) since R (x)). If the formula inside the quantier is (x), for the new table R we have Replacing R[P (x; do(a; s))] by the RHS of the SSA for P , we obtain the following SSA for R : The new query is 9xR (x; S). 2 The following proposition shows why we can use H and H to answer queries about a specication , constructed by using holds. Hypothetical Temporal Reasoning 15 Proposition 1. Let be a SC specication and T a legal sequence of ground actions 9 , then Notice that holds(';do(T ; S 0 )) is instantiated at the nal state this is the only state mentioned in the formula. So, we can see that we have transformed our problem of answering a temporal query with respect to a virtually updated database into the temporal projection problem of AI (Hanks et al., 1986), that is, the problem of querying a future state obtained by the execution of a sequence of ac- tions. To solve this problem we may apply some existing techniques for Reiter like specications, e.g. Reiter's query regression (Reiter, 1995), minimal rolling forward of the database based on information that is relevant to the query (Bertossi et al., 1998; Siu et al., 1996), or even full progression of the database (Lin et al., 1997). All these methodologies are supported by the database reasoner SCDBR (Bertossi et al., 1998). Example 8. We want to know if there is someone who has always been working in the company, in all states generated by the execution of the sequences of actions re(john)] from the initial situation. So, we are asking whether Applying our methodology we obtain the new SC query and the original specication extended to H by adding 8xR and Then we ask if H the query is simple in the nal state do(T ; S 0 ). Running the regression operator twice on the RHS and simplifying the resulting steps by means of the unique names axioms for actions, we obtain the following query to be posed to the initial database Simplifying R (x; S 0 ) to true, we obtain the equivalent query 9 We say that a sequence of actions SCDBR can answer this query by calling a conventional DBMS on the initial database, or a Prolog program if the initial database is a Prolog database. 2 The implementation in SCDBR of the methodology we have presented so far is described in appendix A. 4. Transforming Dynamic Integrity Constraints In section 2 we dened a Static Integrity Constraint (SIC) as a formula of the form 8s(S 0 s '(s)), where '(s) was a formula simple in s. By using the macro holds we can extend this denition by saying that a static integrity constraint is a formula of the form If ' is a formula that does not include operators , since, 3 and 2, then the previous formula is a static integrity constraint of the form showed in section 2. If ' includes these operators, then it can represent a more complex kind of integrity constraint. In fact, by means of this operators it is possible to represent several Dynamic Integrity Constraints (DICs). Thus, by using the equivalence between macros holds and H it is possible to transform a dynamic constraint in one specication into static constraint in another specication. Therefore, we can use our methodology to transform DICs into SICs. Actually, the work in (Chomicki, 1995) has to do with checking DICs statically. In our case, with our reformulation of Chomicki's methodology in terms of a specication of the dynamics of the history encoding relations, we can rewrite DICs as SC sentences expressing SICs, which can be proven as such from the (extended) specication of the database dynamics. In particular, we can use theorem proving techniques for proving SICs by automated induction, like the ones presented in (Bertossi et al., 1996), in order to automatically prove DICs from the specication of the database dynamics. The following proposition formalizes the idea showed above. Proposition 2. Given a SC specication . If H is constructed from as was showed in section 3.2, then Example 9. Let be the specication in example 1 and be the DIC (3) telling that an employee's salary cannot decrease, that must hold Hypothetical Temporal Reasoning 17 in every legal current state s of the DB. That is, as a sentence, it must follow from . We can express this integrity constraint in our extended format as follows: If create a table R with specication: R Introducing R in the rst argument of holds in (6) we obtain: If is the subformula 2((R we create a table R with specication R Introducing R in (8), we obtain Thus, the original DIC holds in every state if and only if the specica- tion H , consisting of plus (7) and (9), entails the SIC: The IC (10) can be split into the two binary static integrity constraints As shown in (Pinto, 1994; Bertossi et al., 1998), these constraints can be compiled into the specication of the extended database dynamics, in this case, modifying the original SSAs for the new tables R and R . 5. History Dependent Transactions As we saw in section 2, the formalism for specifying DB updates contains preconditions for action executions that depend on the current state of the database, only. Many concepts and algorithms that have originated from this formalism are based on this kind of local action precondition axioms (APAs). Nevertheless, there are natural scenarios in which the conditions for executing an action should depend on a longer history of the database. For example, in a voters database we might have the following APA for action vote That is, x can vote for y as long as y is a candidate, x is not younger than 18, and x has never been in jail. This is a history dependent transaction. We can use the macros holds to represent this kind of actions. In fact, we can extend the denition of action preconditions as follows: If includes some of the operators , since, 3 or 2, we have a history dependent action. We can use the machinery developed so far for transforming history dependent transactions into local transactions. To do this we only need to construct a new specication 0 H from H , in its turn obtained from H( (x);s) as before, but with the original APA (12) replaced by the new APA: which is of the form (1). As before, the new specication contains SSAs for the auxiliary tables introduced by the construction of H( (x);s). Proposition 3. Let be a SC specication containing a history dependent APA for action A and let H be the new SC specication containing SSAs for the auxiliary relations and the old APA replaced by the new, local one. If H and Poss H are the possibility predicate and accessibility relation dened on the basis of the new APA, then it holds: (a) For every ground state term S, and ground action term of the form A(c), Hypothetical Temporal Reasoning 19 (b) For every ground state term S, proposition says that at every accessible state, action A is possible in the old sense if and only if it is possible in the new sense and that both specications dene the same accessible states. Example 10. We can apply the methodology to the voters example. In (11), the original APA for vote(x; y) can be expressed by means of macros holds as follows: In consequence, we generate a new specication 0 extending , that includes now: 1. A new table R (x; s) that contains, at state s, the people x that have not been in jail before state s, whose specication consists of 2. The original APA for action A replaced by 6. Possible extensions 6.1. Explicit time. In (Chomicki, 1995), explicit time was also included to extend history encoding and deal with real-time issues. In (Arenas et al., 1998d) it is shown how to extend our methodology by introducing explicit time in the database. This can be done by considering time as a new parameter for actions (Reiter, 1996). In this way, situations will have their associated times. Here we give only some hints on how explicit time can be accommodated into our framework. As before, primitive actions will be denoted with function symbols, but now with one extra parameter of a new, temporal sort T . Thus, a would denote the instantaneous action of borrowing a book at time t 1 . We also include a new function time from actions to T , such that, for each action function A(x; the axiom time(A(x; t. Therefore, if borrow(book is an action term, then we would have time(borrow(book We also need a function, start , from situations to times, such that start(s) is the starting time for situation s. Since actions are instantaneous, we require that start(do(a; (Reiter, 1998). Nevertheless, situations may have a duration (Baier et al., 1998). The specication of the accessibility relation between situations, <, has to be modied by the axiom According to this characterization, s 1 < s 2 is true if all the actions that lead from s 1 to s 2 are possible in the intermediate situations where they are performed, and their times are in the right order. We also have to modify the unique names axioms as follows: In the temporal extension of the situation calculus we will nd temporal atomic formulas of the form t 1 t 2 , where t 1 and t 2 are temporal terms and 2 f=; 6=; <; >; ; g. We also have more complex temporal formulas of the form 3c , where c is a nonnegative integer, stating that formula is true in some previous time, and the previous and present times are subject to the constraint c. For example, if the time unit is a day, then 3 =5 :Emp(sue) states that ve days ago sue was not an employee of the company. More precisely, we dene: For example, since holds(Emp(sue); we have For a temporal formula '(x) of the form 3c (x), where is a non-temporal formula, the formula H('(x); S) (see section 3.2) is 9t(R ' (x; t new table. We use the temporal parameter t Hypothetical Temporal Reasoning 21 in R ' to store the amount of time that has elapsed since (x) was true. Thus, if (x) is true at s, then at state do(a; s), in t we store time(a) start(s). Moreover, if R ' is true, and therefore (x) was true units of time ago at some state previous to s, at state do(a; s), in t we store In consequence, R ' t; s) has the following successor state axiom: At the initial state we dene R ' by 8(x; t):R ' (x; t; S 0 ). With this extension to explicit time, now it is possible to express a metric temporal precondition for the action re saying that it is possible to re an employee if he/she has been working at least 30 days in the company: As before, this precondition can be changed by a new one referring to the execution state only: if '(x) is 3<30:Emp(x), then where the new table R ' is dened by 6.2. Open queries In this paper, we have just considered queries that are sentences, that is We think this kind of queries is more likely to occur in hypothetical reasoning, in the sense that they deal with global properties of an hypothetical state of the world. Nevertheless, our methodology can be easily applied to open queries that should return database tuples as answers. Those tuples can be retrieved from the domain elements appearing in the transaction log and from the initial database. This can be done, again, by means of the regression operator that is able to handle free variables. The formulas resulting Notice that, for a xed value of x, R' (x; t; do(a; s)) could be true for many values of t, if (x) was true many times in the past. 22 Arenas, Bertossi in the process can be easily simplied taking advantage of the unique names axioms before the nal evaluation process (cf. (Bertossi et al., 1998) and appendix A). 6.3. Regular expression queries In this paper we have considered a wide, but restricted class of historical queries, namely those that can be constructed on the basis of the usual rst order past temporal logic operators. In (Abiteboul et al., 1996), predicate calculus and extended temporal logic (ETL) were compared in terms of expressive power for temporal databases. ETL is a proper extension of rst order past temporal logic by means of formulas that are constructed on the basis of regular expressions. History encoding and our methodology can be extended to include regular expression queries on nite transaction logs. 7. Discussion and Conclusions Among the contributions in this paper we nd the following: (1) An embedding and representation of the operators of rst order past temporal logic in the situation calculus. (2) An extension of methodology presented in (Chomicki, 1995) to check dynamic integrity constraints to the case in which there is a specication of the evolution of the database. (3) A methodology for doing hypothetical reasoning along a virtual evolution of the database obtained by the execution of domain specic primitive transactions, whereas (Chomicki, 1995) concentrates on xed integrity constraints and physical and usual updates of the database. (4) A general solution to the problem of answering temporal queries in the context of Reiter's specications of database updates, and this solution works both in a progressive as in a regressive way. (5) A general transformation mechanism of dynamic integrity constraints into static integrity constraints, in a context like Reiter's, where both kind of constraints are expected to be logical consequences of the specication. general mechanism for transforming history dependent preconditions for action executions into preconditions to be evaluated at the execution state. (7) An implementation of all these methodologies. (8) An extension of all the previous results and techniques to the case of explicit time or metric temporal logic. Preliminary versions of this work can be found in (Arenas et al., 1998a; Arenas et al., 1998b). In the rst case, no temporal operators were considered, and temporal queries were much more complex than here. In the second case, explicit use of rst order past temporal logic Hypothetical Temporal Reasoning 23 and translations between it and the SC was made. The current version combines the best of the two approaches. We think that the methodologies developed here for relational data-bases could be applied in other scenarios as well, e.g. (1) hypothetical reasoning in work ows (Bonner, 1999; Davulcu, 1998; Trajcevski et al., 2000), (2) reasoning from and about policies (Chomicki et al., 2000), and (3) temporal reasoning in AI in general (Chittaro et al., 2000). 7.1. Complexity issues As already described, in (Chomicki, 1995) a procedure for checking temporal integrity constraints is presented. It is based on the idea of history encoding, that we have captured and used in the situation calculus framework. The history encoding methodology presented in (Chomicki, 1995) turns out to be polynomially bounded in the sense that the given an integrity constraint to be checked, the number of auxiliary relations to be introduced does not depend on the length n of the transaction log and the amount of historical information stored in the union of the auxiliary relations does not depend on n, but is bounded by a polynomial evaluated on the amount of data in initial database plus the domain values appearing in the transaction log (the history) and the constraint. In our SC context, we may have domain dened primitive actions, possibly appearing in transaction logs, that could have the instantaneous eect of inserting a huge amount of data in several database relations at the same time. If we restrict ourselves to most common situation in which those primitive actions are of the form, that inserts a tuple x into table P and deletes a tuple x from table P , respectively, then we still have polynomially bounded history encoding in the sense that the number of auxiliary relations depends on the temporal query and not on the length n of the transaction log A (producing states S the amount of data stored in the union of them is bounded by a polynomial on the number of domain values appearing in the initial relational database 0 plus A and '. 11 This situation and analysis is relevant for eciently answering historical queries by means of a physical progression of the database, in particular, through materialization of the auxiliary views (see section 3.2). Nevertheless, if we want to answers the query by appealing to a Our methodology allows us to have as 0 something more general than a relational database, e.g. a initial database containing more complex rst order formulas. Nevertheless, as shown in (Lin et al., 1997) progressing the database in this case, in particular, the historical auxiliary views, might become a very complex process. solution of the temporal projection problem via query regression (see section 3.2), and thus avoiding the materialization of the historical views, we have to analyze things in a dierent way. In the regression based approach, the number of auxiliary historical relations does not depend on the length of the transaction log, but on the original query only. The amount of data potentially stored in those relations is no longer relevant since they are not materialized. The problem is that in a general situation, the regression of a given formula may become exponentially long wrt the original query (Reiter, 2001), and thus leading to exponential time to evaluate the regressed query. Nevertheless, there are situations in which this evaluation can be done in polynomial time. This is the case of context-free successor state axioms (Reiter, 2001). Those are axioms in which there are no conditions on the database at the execution state for the actions to have their desired eects (there might be preconditions for their executions, but they do not appear explicitly in the SSAs). This is a common situation in databases, in particular, when only actions of the form insert P (x) and delete P (x) are considered. Our running example (example 1) contains context-free SSAs only. For example, the SSA for Emp is Here, action a = hire(x) will have the eect of having x inserted into Emp at the succesor state, without any condition. Nevertheles, this action does have a precondition to be executed, namely: Notice that the query to be regressed will contain some auxiliary relations, which have derived SSAs that will be used by the regression operator. It is an interesting subject for further investigation to nd conditions under which the derived SSAs will be context-free when the SSAs for the original database are context-free. For this purpose, some syntactic techniques introduced in (Arenas et al., 1998c) could be useful. In general, the complexity of regression based query answering in knowledge representation and databases requires further research. 7.2. Related work There has been some work done on hypothetical reasoning in databases. In (Bonner, 1990), a datalog language, Hypothetical Datalog, that allows both database specication and hypothetical reasoning, is pre- sented. There, special rules for hypothetical reasoning are included in Hypothetical Temporal Reasoning 25 the datalog specication. These rules contain predicates with a sort of annotations indicating that the predicate will be true if certain tuple is deleted or inserted into the database. Then, the kind of reasoning they allow is of the form \Would that predicate be true if these properties are added/included?". The nal virtual state is evaluated. It is also possible to specify a sort of hypothetical predicates, whose truth depends on the execution of future add/delete transactions. Hypothetical Datalog also benets from the possibility of specifying recursive predicates. The queries than can be posed at the hypothetical state are limited by the datalog formalism. In (Bonner, 1990) other related formalisms for hypothetical reasoning in databases are discussed. In (Chen, 1997) a language that can be considered as an extension of Hypothetical Datalog is presented. More complex database updates are integrated into the language, more precisely, as predicates in the rules. In addition, hypothetical reasoning with respect to a particular predicate, L, can be done by evaluating an auxiliary predicate, 3L. This predicate is evaluated as L, except for the fact that the updates that appear in the rules that have to do with L are not committed. After evaluation, the database goes back to the current physical state. The more interesting and more powerful logic programming formalism than the two above for specifying and executing updates is Transaction Logic Programming (Bonner et al., 1998). It also allows doing hypothetical reasoning. As was discussed in (Bertossi et al., 1998), Transaction Logic and the Situation Calculus can complement each other well. In the situation calculus it is possible to specify primitive transactions, in particular, giving an account of the frame problem for this kind of transactions; and transaction logic can be used to specify more complex transactions. In our case, instead, we restrict ourselves to relational databases (as opposed to deductive databases), but we have arbitrary domain specic transactions which are specied in the SC formalism. The hypothetical situation is created by virtually executing explicit transactions of this kind. Actually, Reiter's formalism is a language for reasoning about action executions (but not for executing actions); this makes it perfect for hypothetical reasoning. We are in position to query the whole database evolution, with involved relationships between the generated states; for this we take advantage of the existence of explicit states in our formalism and quan- tications over them. Our query language, both for trajectories and particular states is much more expressive. We do not need extra rules or auxiliary predicates for doing hypothetical reasoning; we just use the specication of our database, in particular, we will not get to the 26 Arenas, Bertossi situation of having to introduce new rules and predicates in the program which we might have initially forgotten. With the formalism we have, as it is, we do not have the possibility of introducing recursive predicates. Nevertheless, recursion could be introduced as macros as done in Golog (Levesque et al., 1997), a situation calculus based logic programming language for high level robot programming. Introducing predicates whose truth depends on future states does not seem to be a problem in our formalism, because quantications on states and the do operator should allow doing this. The problem of answering hypothetical historical queries in the context of the situation calculus specications of database updates was posed in (Reiter, 1995), where also some particular cases were treated. Further work on this problem is presented in (Reiter, 2001), but essentially the case of context-free successor state axioms is considered. Our methodology, being much more general, provides the same formulas to be evaluated against the initial database in those cases, but can be applied to a wider range of queries. Acknowledgements This research has been partially supported by FONDECYT Grants 1980945, #1990089, #1000593). Part of this work has been done during the second author's sabbatical at the TU Berlin. He is grateful to Ralf Kutsche and the CIS group for their support and hospitality; and to the GK \Distributed Information Systems", the DAAD and the DIPUC for their nancial support. --R Temporal versus First-Order Logic to Query Temporal Databases Hypothetical Temporal Reasoning with History Encod- ing Hypothetical Temporal Queries in Databases. Representation of Temporal Knowledge in the Situation Calculus. http://dcc. Automating Proofs of Integrity Constraints in the Situation Calculus. SCDBR: An Automated Reasoner for Spec- i cations of Database Updates Hypothetical Datalog: Complexity and Expressivity. Transaction Logic Programming. Work ow An Overview of Datawarehousing and OLAP Technology. Temporal Representation and Reasoning in Arti Programming with Logical Queries A Logic Programming Approach to Con ict Resolution in Policy Management. Logic Based Modeling and Analysis of Work ows. Temporal Logic: Mathematical Foundations and Computational Aspects. Reasoning GOLOG: A Logic Programming Language for Dynamic Domains. How to Progress a Database. Some Philosophical Problems from the Standpoint of Arti Temporal Reasoning in the Situational Calculus. Towards a Logical Reconstruction of Relational Database Theory. Mylopoulos and J. The Frame Problem in the Situation Calculus: a Simple Solution (Sometimes) and a Completeness Result for Goal Regression. On Specifying Database Updates. Natural Actions In Principles of Knowledge Representation and Reasoning: Knowledge in Action: Logical Foundations for Specifying and Implementing Dynamical Systems. Answering Historical Queries in Databases (extended ab- stract) Temporal Databases. --TR Temporal databases Hypothetical datalog The frame problem in situation the calculus Temporal logic (vol. 1) Efficient checking of temporal integrity constraints using bounded history encoding Temporal versus first-order logic to query temporal databases An overview of data warehousing and OLAP technology How to progress a database Logic based modeling and analysis of workflows Workflow, transactions and datalog Temporal representation and reasoning in artificial intelligence Programming with Logical Queries, Bulk Updates, and Hypothetical Reasoning Automating Proofs of Integrity Constraints in Situation Calculus Formalizing (and Reasoning About) the Specifications of Workflows The Dynamics of Database Views Temporal reasoning in the situation calculus
dynamic integrity constraints;hypothetical reasoning;database dynamics;historical queries
598450
Euclidean Reconstruction and Reprojection Up to Subgroups.
The necessary and sufficient conditions for being able to estimate scene structure, motion and camera calibration from a sequence of images are very rarely satisfied in practice. What exactly can be estimated in sequences of practical importance, when such conditions are not satisfied? In this paper we give a complete answer to this question. For every camera motion that fails to meet the conditions, we give explicit formulas for the ambiguities in the reconstructed scene, motion and calibration. Such a characterization is crucial both for designing robust estimation algorithms (that do not try to recover parameters that cannot be recovered), and for generating novel views of the scene by controlling the vantage point. To this end, we characterize explicitly all the vantage points that give rise to a valid Euclidean reprojection regardless of the ambiguity in the reconstruction. We also characterize vantage points that generate views that are altogether invariant to the ambiguity. All the results are presented using simple notation that involves no tensors nor complex projective geometry, and should be accessible with basic background in linear algebra.
Introduction Reconstructing spatial properties of a scene from a number of images taken by an uncalibrated camera is a classical problem in computer vision. It is particularly important when the camera used to acquire the images is not available for calibration, as for instance in video post-processing, or when the calibration changes in time, as in vision-based navigation. If we represent the scene by a number of isolated points in three-dimensional space and the imaging process by an ideal perspective projection, the problem can be reduced to a purely geometric one, which has been subject to the intense scrutiny of a number of researchers during the past ten years. Their efforts have led to several important and useful results. The problem is that conditions for a unique Euclidean reconstruction are almost never satisfied in sequence of images of practical interest. In fact, they require as a necessary condition that the camera undergoes rotation about at least two independent axes, which is rarely the case both in video processing and in autonomous navigation [14]. In this paper we address the question of what exactly can be done when the necessary and sufficient conditions for unique reconstruction are not satisfied. In particular: (i) For all the motions that do not satisfy the conditions, to what extent can we reconstruct structure, motion and calibration? (ii) If the goal of the reconstruction is to produce a new view of the scene from a different vantage point, how can we make sure that the image generated portrays a "valid" Euclidean scene? On our way to answering these questions, we pause to reflect on the nature of multilinear constraints. While constraints involvingtwo images at a time (fundamental constraints) are well understood and involve clean notation and geometric interpretation, muti-linear constraints are more difficult to work with and to interpret. It seems therefore natural to ask the following question (iii) Do multilinear constraints carry geometric information on the camera system that is not contained in bilinear ones? 1.1. Relation to previous work The study of ambiguities in Euclidean reconstruction (i) arises naturally in the problem of motion and structure recovery and self-calibration from multiple cameras. There is a vast body of literature on this topic, which cannot be reviewed in the limited space allowed. Here we only comment on some of the work that is most closely related to this paper, while we refer the reader to the literature for more details, references and appropriate credits (see for instance [4, 8, 10, 13, 19, 20, 21] and references therein). It has long been known that in the absence of any a priori information about motion, calibration and scene struc- ture, reconstruction can be performed at least up to a projective transformation [6]. Utilizing additional knowledge about the relationship between geometric entities in the image (e.g., parallelism) one can stratify the different levels of reconstructions from projective all the way to Euclidean [3, 5, 6, 18]. At such a level of generality, the conditions on the uniqueness and existence of solutions are restrictive and the algorithms are computationally costly, often exhibiting local minima [12]. The nature of the constraints among images of the same point in different cameras has been studied extensively, and is known to be multilinear (see for instance [7, 10, 20]). The algebraic dependency among constraints (iii) has been established by means of elimination [21] or other algebraic geometric tools [9]. However, an explicit characterization of how the information is encoded in different constraints - which is crucial in the design of robust estimation algorithms - is hard to derive by such means. Recently, Sturm [19] has proposed a taxonomy of critical motions, that is motions which do not allow a unique recon- struction. However, not only the given taxonomy is by no means intrinsic to Euclidean reconstruction (see [14]), but also no explicit characterization of the ambiguities in the re-constructed shape, motion and calibration has been given. A natural continuation of these efforts involved the analysis of cases where the motion and/or calibration were restricted either to planar or linear motion [2, 18] and techniques were proposed for affine reconstruction or up to one parameter family. Several techniques have been proposed to synthesize novel views of a reconstructed scene (ii): in [1], trilinear constraints have been exploited to help generate reprojected images for a calibrated camera. In the case of a partially uncalibrated camera, such a method has to face the issues of whether the reprojected image portrays a valid Euclidean scene. 1.2. Outline of this paper and its contributions As we anticipated in the previous section, the answer to question (iii) has been established before on an algebraic footing - the algebraic ideals generated by trilinear and quadrilinear constraints (as polynomials of image coor- dinates) are necessarily contained in that generated by bi-linear ones [9]. However, in order to give a complete account of ambiguities in 3D Euclidean reconstruction (espe- cially for self-calibration and motion recovery), it is crucial to know how the information on the Euclidean configuration of a camera system is encoded in the multilinear con- straints. In section 2 we give a novel, complete and rigorous proof that unveils how the information encoded in trilinear and quadrilinear constraints depends on that in bilinear ones. There we also discuss the role of multilinear constraints with regards to singular configurations of points. The well-known - but conservative - answer to question (i) is that structure can at least be recovered up to a global projective transformation of the three-dimensional space. However, there is more to be said, as we do in section 3 for the case of constant calibration. 1 There, we give explicit formulas of exact ambiguities in the reconstruction of scene structure, camera motion and calibration with respect to all subgroups of the Euclidean motion. In principle, one should study ambiguities corresponding to all critical configurations as given in [14]. However, it is only the ambiguities that exhibita group structure that are of practical importance in the design of estimation algorithms. In such a case, not only can the analysis be considerably simplified but also clean formulas for all generic ambiguities can be derived. Such formulas are important for 3D reconstruction as well as for synthesizing novel 2D views. Question (ii) is then answered in section 4, where we characterize the complete set of vantage points that generate "valid" images of the scene regardless of generic ambiguities in 3D reconstruction. These results have great practical significance, because they quantify precisely to what extent scene structure, camera motion and calibration can be estimated in sequences for which many of the techniques available todate do not apply. Furthermore, the analysis clarifies the process of 2D view synthesis from novel viewpoints. In addition to that, we give a novel account of known results on the role of multilinear constraints and their relationship to bilinear ones. Granted the potential impact on applications, this paper is mainly concerned with theory. We address neither algorithmic issues, nor do we perform experiments of any sort: the validation of our statements is in the proofs. We have tried to keep our notation as terse as possible. Our tools are borrowed from linear algebra and some differential geometry, although all the results should be accessible without background in the latter. We use the language of (Lie) groups because that allows us to give an explicit characterization of all the ambiguities in a concise and intuitive fashion. Traditional tools involved in the analysis of self-calibration involved complex loci in projective spaces (e.g., the "absolute conic"), which can be hard to grasp for someone not proficient in algebraic geometry. 2. Dependency of multilinear constraints revis- ited We model the world as a collection of points in a three-dimensional Euclidean space, which we represent in homogeneous coordinates as . The perspective projection of the generic point onto the two-dimensional image plane is represented by homogeneous coordinates x 2 R 3 that satisfy where -(t) 2 R is a scalar parameter related to the distance of the pointq from the center of projection and the non- In fact, even in the case of time-varying calibration, in principle, the best one can do is an affine reconstruction, not just a projective one! singular matrix A(t) - called "calibration matrix" - describes the intrinsic parameters of the camera. Without loss of generality we will re-scale the above equation so that the determinant of A is 1. The set of 3 \Theta 3 matrices with determinant one is called Special Linear group denoted by SL(3). The rigid motion of the camera g(t) is represented by a translation vector p(t) 2 R 3 and a rotation matrix R(t), that is an orthogonal matrix with determinant equal to one. Such matrices form a group called Special Orthogonal group and indicated by belongs to SE(3), the special Euclidean group of rigid motion in R 3 . The action of g(t) on the point q is given by In equation (1) we will assume that x(t) is measured, while everything else is unknown. When we consider measurements at n different times, we organize the above equations by defining which we will assume to be full-rank, that is rank(M C A C A which we re-write in a more compact notation as X ~ Mq. We call M 2 R 3n\Theta4 the motion matrix and X the image matrix. 2.1. Constraints on multiple images Let ~ denote the four columns of the matrix M and ~ be the n columns of the matrix X. Then the coordinates x(t same point seen from different views only if they satisfy the following wedge product equation: ~ This constraint, which is multilinear in the measurements simply expresses the fact that the columns of M and are linearly dependent. Constraintsinvolvingfour images are call quadrilinear, constraints involving three images are called trilinear, and those involving two images are called bilinear or fundamental. In general, the coefficients of all the multilinear constraints are minors of the motion matrix M . As it has been shown (see, for instance, Triggs in [20]), constraints involving more than four frames are necessarily dependent on quadrilinear, trilinear and bilinear ones. In this section we go one step further to discuss how trilinear and quadrilinear constraints are dependent on bilinear ones. When studying the dependency among constraints, one must distinguish between algebraic and geometric depen- dency. Roughly speaking, algebraic dependency concerns the conditions that a point in an image must satisfy in order to be the correspondent of a point in another image. Vice versa, geometric dependency is concerned with the information that correspondingpoints give on the operator that maps one to the other. The two notions are related but not equiva- lent, and the latter bears important consequences when one is to use the constraints in optimization algorithms to recover structure and calibration. While the geometric dependency of multilinear constraints has been established before under the assumption of constant calibration [10], we give a novel, simple and rigorous proof that is valid under the more general assumption of time-varying calibration. 2.2. Algebraic vs. geometric dependency To clarify the relation between algebraic and geometric dependency note that in general we can express a multi-linear constraint in the form: ff j are some polynomials of entries of M and fi j polynomials of entries of the image coordinates, with M and X defined as before. ff j 's are called the coefficients of multilinear constraints. Studyingthe algebraic dependency between constraints then corresponds to fixing the coefficients ff j and asking whether there are some additional constraints among the image coordinates X generated by three and four views 3 . This problem has been studied many researchers and an elegant answer can be found in [9] by explicitly characterizing the primary decomposition of the ideal (in the polynomial ring of image coordinates x i 's) generated by the bilinear constraints in terms of that generated by trilinear ones or quadrilinear ones. Geometric dependency, on the other hand, investigates whether, given the image coordinates X, the coefficients ff j corresponding to motion parameters in additional views can give additional information about M . These two different types of dependencies were previously pointed out (see for instance the work of Heyden [10]). For both types of depen- dencies, the answer is negative, i.e., trilinear and quadrilinear constraints in general are dependent of bilinear ones. We here give a simple but rigorous study of the geometric de- pendency. The results will also validate the ambiguity analysis given in following sections. Consider the case for the moment, disregard the internal structure of the motion matrix M 2 R 9\Theta4 . Its columns can be interpreted as a basis of a four-dimensional subspace of the nine-dimensional space. The set of k-dimensional subspaces of an m-dimensional space is called a Grassmannian manifold and denoted by G(m; k). Therefore, M is an element of G(9; 4). By just This subsection is for the benefit of the reader already familiar with existing work on the algebraic dependency among multilinear constraints. The reader who is not at ease with algebraic geometry or unfamiliar with the existing literature can skip this subsection without loss of continuity 3 In other words, it addresses the dependencyamong algebraic ideals associated with the three types of multilinear constraints. re-arranging the three blocks OE between G(9; 4) and three copies of G(6; The question of whether trilinear constraints are independent of bilinear ones is tightly related to whether these two representations of the motion matrix M are equivalent. Since the coefficients in the multilinear constraints are homogeneous in the entries of each block M i , the motion matrix M is only determined up to the equivalence relation: f0g. Thus for multilinear constraints the motion matrix is only well-defined as an element of the quotient space G(3n; 4)= - which is of dimension (11n \Gamma 15), 4 as was already noted by Triggs [20]. We are now ready to prove that coefficients ff j 's in trilinear and quadrilinear constraints depend on those in bilinear ones. Theorem 1 (Geometric dependency) Given three (or four) views, the coefficients of all bilinear constraints or equivalently the corresponding fundamental matrices uniquely determine the motion matrix M as an element in (or G(12; 4)= -) given that Ker(M i )'s are linearly independent. Proof: It is known that between any pair of images (i; the motion matrix: determined by the corresponding fundamental matrix F ij up to two scalars Hence for the three view case all we need to prove is that the map: ~ is injective. To this end, assume ~ then we have that, after re-scaling, M3 G3 for some- i 2 R 3. This yields M1 there exist U i 2 R 4\Theta4 with each column of U i is in 4 The Grassmannian G(3n; 4) has dimension (3n \Gamma The dimension of the quotient space is smaller since the equivalence relation has scales. 5 GL(4) is the general linear group of all non-degenerate4 \Theta 4 real matrices Combining these three equations, we obtain: The matrix on the right hand side of the equation has a non-trivial null-space since its columns are in spanfKer(M1 ); Ker(M2);Ker(M3)g which has dimension three. However, G1 is non-singular, and therefore it must be That is, the columns of are linear combinations of columns of -2G2 \Gamma G1 and are linearly independent. Thus we have A =@ which means that M 0 and M are the same, up to the equivalence relation defined in equation (4). Therefore, they represent the same element in G(9; 4)= -, which means that the map ~ OE is injective. In the case of four views, in order to show that coefficients in quadrilinear constraints also depend on bilinear ones, one only needs to check that the obvious map from G(12; 4)= - to (G(9; 4)= -) 4 is injective. This directly follows from the above proof of the three frame case. Comment 1 As a consequence of the theorem, coefficients ff j 's in trilinear and quadrilinear constraints are functions of those in bilinear ones. While the above proof shows that the map ~ OE can be it does not provide an explicit characterization of the in- verse. Such an inverse can in principle be highly non-linear and conditioning issues need to be taken into account in the design of estimation algorithms. We emphasize that the geometric dependency does not imply that two views are sufficient for reconstruc- tion! It claims that given n views, their geometry is characterized by considering only combinations of pairs of them through bilinear constraints, while trilinear constraints are of help only in the case of singular configurationsof points and camera (see comment 2). For four views, the condition that Ker(M i are linearly independent is not necessary. A less conservative condition is that there exist two groups of three frames which satisfy the condition for the three view case. Theorem 1 requires that the one-dimensional kernels of the matrices or are linearly indepen- dent. Note that the kernels of M i for are given by (\Gammap T the vector R T exactly the position of the i th camera center. Hence the condition of the theorem is satisfied if and only if the centers of projection of the cameras generate a hyper-plane of dimension In particular, when the three camera centers form a triangle, and when 4, the four camera centers form a tetrahedron. Comment 2 (Critical surfaces and motions) Although we have shown that the coefficients of multilinear constraints depend on those of bilinear ones, we have assumed that the latter (or the corresponding fundamental matrices) are uniquely determined by the epipolar geometry. However, this is not true when all the points lie on critical surfaces. In this case, as arguedby Maybank in [15], we may obtain up to three ambiguous solutions from the bilinear constraints. This is one of the cases when trilinear and quadrilinear constraints provide useful information. On this topic, see also [16]. Also, when the camera is undergoing a rectilinear motion (i.e., all optical centers are aligned), trilinear constraints provide independent information in addition to bilinear ones. This fact has been pointed out before; see for instance Heyden in [11]. 3. Reconstruction under motion subgroups The goal of this section is to study all "critical" motion groups that do not allow unique reconstruction of structure, motion and calibration. While a classification of such critical motions has been presented before (see [14]), we here go well beyond by giving an explicit characterization of the ambiguity in the reconstruction for each critical motion. Such an explicit characterization is crucial in deriving the ambiguity in the generation of novel views of a scene, which we study in section 4. In this section, we characterize the generic ambiguity in the recovery of (a) structure, (b) motion and (c) calibration corresponding to each possible critical motion. A subgroup of SE(3) is called critical if the reconstruction is not unique when the motion of the camera is restricted to it. For the purpose of this section, we assume that the calibration matrix A is constant. 3.1. Some preliminaries So far the only restriction we have imposed on the constant calibration matrix A is that it is non-singular and is normalized as to have However, A can only be determined up to an equivalence class of rotations, that is A 2 SL(3)=SO(3). 6 For more detail, please see [14]. The unrecoverable rotation in our choice of A simply corresponds to a rotation of the entire camera system. We borrow the following statement directly from [14]: Theorem 2 (Necessary and sufficient condition for a unique calibration) Given a set of camera motion none of the rotation component R i is of the form e b then the camera calibration A as an element in SL(3)=SO(3) is uniquely determined if and only if at least two of the axes are linearly independent. 6 Here take left cosets as elements in the quotient space. A representation of this quotient space is given, for instance, by upper-triangular matri- ces; such a representation is commonly used in modeling calibration matrices by means of physical parameters of cameras such as focal length, principal point and pixel skew. Although the necessity of the independence of the rotation axes has been long known in the literature (see e.g. [13]), the sufficiency is not proven till recent [14]. This theorem states a very important and useful fact: the condition for a unique calibration has nothing to do with translation (as opposed to the results given in [19])! See [14] for the detail. Due to this theorem, all proper continuous subgroups of SE(3) except are critical for self-calibration. So the first step in our analysis consists in classifying all continuous Lie subgroups of SE(3). It is a well known fact that a complete list of these groups (up to conjugation) is given by 7 : Translational Motion: (R 3 ; +) and its subgroups Rotational Motion: (SO(3); \Delta) and its subgroups Planar Motion: SE(2) Screw Motion: (SO(2); \Delta) \Theta (R; +) We are now ready to explore to what extent scene structure, camera motion and calibration can be reconstructed when motion is constrained onto one of the above subgroups. In other words, we will study the generic ambiguities of the reconstruction problem. In what follows, we use 3 to denote the 3D coordinates of the point respect to the camera frame at time t: To simplify nota- tion, for any u 2 R 3 we define b u to be a 3 skew-symmetric matrix such that 8v 2 R 3 the cross product u \Theta 3.2. Generic ambiguities in structure, motion and calibration Translational motion (R 3 and its subgroups). The co-ordinate transformation between different views is given by According to Theorem 2, the calibration A 2 SL(3) cannot be recovered from pure translational motion, and therefore the corresponding structure q and translational motion p can be recovered only up to the unknown transformation A. We therefore have the following Theorem 3 (Ambiguity under R 3 ) Consider an un-calibrated camera described by the calibration matrix undergoing purely translational motion R 3 (or any of its nontrivial subgroups) and let B be an arbitrary matrix in SL(3). If the camera motion p 2 R 3 and the scene structure q 2 R 4 are unknown, then B, B \Gamma1 Ap and are the only generic ambiguous solutions for the camera calibration, camera motion and the scene structure respectively. Note that this ambiguity corresponds exactly to an affine re-construction [18]. 7 The completeness of this list can be shown by classifying all Lie subalgebras of the Lie algebra se(3) of SE(3) and then exponentiate them. Rotational motion (SO(3)). The action of SO(3) transforms the coordinates in different cameras by According to Theorem 2, the calibration A can be recovered uniquely, and so can the rotational motion R(t) 2 SO(3). However, it is well known that the depth information of the structure cannot be recovered at all. We summarize these facts into the following: Theorem 4 (Ambiguity under SO(3)) Consider an un-calibrated camera with calibration matrix A 2 SL(3) undergoing purely rotational motion SO(3) and let - be an arbitrary (positive) scalar. If both the camera motion and the scene structure q 2 R 3 are unknown, then A, R and - \Delta q are the only generic ambiguous solutions for the camera calibration, camera motion and the scene structure respectively. Planar motion (SE(2)). While the previous two cases were of somewhat academic interest and the theorems portray well-known facts, planar motion arises very often in ap- plications. We will therefore study this case in some more detail. R 3 be the standard basis of R 3 . Without loss of generality, we may assume the camera motion is on the plane normal to e 3 and is represented by the subgroup SE(2). Let A be the unknown calibration matrix of the cam- era. As described in section 3.1 we consider A as an element of the quotient space SL(3)=SO(3). According to [14], any possible calibration matrix A 0 2 SL(3)=SO(3) is such that the matrix 0 is in the symmetric real kernel (SRKer) of the Lyapunov map for all A \GammaT R T A T By the choice of e 1 the real eigenvector of R is e 3 . Imposing S 2 SL(3), we obtain 3\Theta3 is a matrix function of s: Geometrically, this reveals that only metric information within the plane can be recovered while the relative scale between the plane and its normal direction cannot be deter- mined. If we choose an erroneous matrix A 0 from the set of possible solutions for calibration, then A some matrix B 2 SL(3). Since A \GammaT 0 is necessarily in SRKer(L), we further have that, for some s 2 R, A \GammaT A solution of (7) is of the form us define a one-parameter Lie group G SE(2) as: Then the solution space of (7) is given by SO(3)G SE(2) . The group G SE(2) can be viewed as a natural representation of ambiguous solutions in the space SL(3)=SO(3). Once we have a calibration matrix, say A 0 , we can extract motion from the fundamental matrix R 3\Theta3 as follows: we know that . Then we define and note that, for we have that D(s) commutes with R i.e., is an essential matrix since HD(s)p: The motion recovered from E is therefore is the true motion. Note that (HRH T ; HD(s)p) is actually a planar motion (in a plane rotated by H from the original one). The coordinate transformation in the uncalibrated camera frame is given by instead, the matrix A 0 is chosen to justify the camera cali- bration, the coordinate transformation becomes: Therefore, any point q viewed with an uncalibrated camera A undergoing a motion (R; p) 2 SE(2) is not distinguishable from the point HD(s)q viewed with an uncalibrated camera A undergoing a motion We have therefore proven the following Theorem 5 (Ambiguity under SE(2)) Consider a camera with unknown calibration matrix A 2 SL(3) undergoing planar motion SE(2) and let . If both the camera motion (R; p) 2 SE(2) and the scene structure q 2 R 3 are unknown, then AB SE(2) and B(s)q 2 R 3 are the only generic ambiguous solutions for the camera calibration, camera motion and scene structure respectively. Comment 3 Note that the role of the matrix H 2 SO(3) is just to rotate the overall configuration. Therefore, the only generic ambiguity of the reconstruction is characterizedby the one parameter Lie group G SE(2) . Subgroups SO(2), SO(2) \Theta R and SE(2) \Theta R. We conclude our discussion on subgroups of SE(3) by studying SO(2), SO(2) \Theta Rand SE(2) \Theta Rtogether. This is because their generic ambiguities are similar to the case of SE(2), which we have just studied. Notice that in the discussion of the ambiguity G SE(2) , we did not use the fact that the translation p has to satisfy Therefore, the generic re-construction ambiguities of SO(2) \Theta Rand SE(2) \Theta Rare exactly the same as that of SE(2). The only different case is SO(2). It is readily seen that the ambiguity of SO(2) is the "product" of that of SE(2) and that of SO(3) due to the fact As a consequence of Theorem 4 and Theorem 5 we have: Corollary 1 (Ambiguity under SO(2)) Consider an un-calibrated camera with calibration matrix A 2 SL(3) undergoing a motion in SO(2) and let \Delta). If both the camera motion R 2 SO(3) and the scene structure q 2 R 3 are unknown, then AB are the only generic ambiguous solutions for the camera calibration, camera motion and scene structure respectively. From the above discussion of subgroups of SE(3) we have seen that generic ambiguities exist for any proper sub-group of SE(3). Therefore all subgroups of SE(3) are critical with respect to reconstruction of scene structure, motion and camera calibration. Furthermore, such ambiguities which have been derived above based only on bilinear con- straints, are not resolved by multilinear constraints according to Theorem 1. 4. Reprojection under partial reconstruction In the previous section we have seen that, in general, it is possible to reconstruct the calibration matrix A and the scene's structure q only up to a subgroup - which we call K , the ambiguity subgroup. For instance, in the case of planar motion, an element in K has the form D(s) given by equation (6). Therefore, after reconstruction we have ~ suppose one wants to generate a novel view of the scene, ~ x from a new vantage point, which is specified by a motion ~ must satisfy ~ ~ In general, the reprojection ~ depends both on the ambiguity subgroup K and on the vantage point ~ g and there is no guarantee that it is an image of the original Euclidean scene. It is only natural, then, to ask what is the set of vantage points that generate a valid reprojection, that is an image of the original scene q taken as if the camera A was placed at some vantage point g(K). We discuss this issue in section 4.1. A stronger condition to require is that the reprojection be independent (invariant) of the ambiguity K , so that we have regardless of K; we discuss this issue in section 4.2. 4.1. Valid Euclidean reprojection In order to characterize the vantage points - specified by motions ~ g - that produce a valid reprojection we must find ~ g such that: ~ the reprojected image ~ x is ~ ~ Ag(K)q, the characterization of all such motions ~ g is given by the following Lie group: We call R(K) the reprojection group for a given ambiguity group K . For each of the generic ambiguities we studied in section 3, the corresponding reprojection group is given by the following Theorem 6 The reprojection groups corresponding to each of the ambiguity groups K studied in section 3 are given by: 1. (ambiguity of (R 2. (R of SO(2)). 3. (ambiguity of 4. (ambiguity of SE(3)). Even though the reprojected image is, in general, not unique, the family of all such images are still parameterized by the same ambiguity group K . For a motion outside of the group i.e., for a ~ the action of the ambiguity group K on a reprojected image cannot simply be represented as moving the camera: it will have to be a more general non-Euclidean transformation of the shape of the scene. However, the family of all such non-Euclidean shapes are minimally parameterized by the quotient space SE(3)=R(K). Comment 4 [Choice of a "basis" for reprojection] Note that in order to specify the viewpoint it is not just sufficient to choose the motion ~ g for, in general, g(K) 6= ~ g. Therefore, an imaginary "visual-effect operator" will have to adjust the viewpoint g(K) acting on the parameters in K . The ambiguity subgroups derived in section 3 areone-parametergroups(for the most important cases) and therefore the choice is restricted to one parameter. In a projective framework (such as [6]), the user has to specify a projective basis of three-dimensional space, that is 15 parameters. This is usually done by specifying the three-dimensional position of 5 points in space. 4.2. Invariant reprojection In order for the view taken from ~ g to be unique, we must have independent of K . Equivalentlywe must have K where K is the ambiguity generated by the motion on a sub-group G of SE(3). The set of ~ g that satisfy this condition is a group N (K), the so called normalizer of K in SE(3). Therefore, all we have to do is to characterize the normaliz- ers for the ambiguity subgroups studied in section 3. Theorem 7 The set of viewpoints that are invariant to re-projection is given by the normalizer of the ambiguity sub- group. For each of the motion subgroups analyzed in section 3 the corresponding normalizer of the ambiguity group is given by: 1. N (R 3 ; +)). 2. N (R of SO(2)). 3. N (ambiguity of 4. N (ambiguity of SE(3)). For motions in every subgroup, the reprojection performed under any viewpoint determined by the groups above is unique. 5. Conclusions When the necessary and sufficient conditions for a unique reconstruction of scene structure, camera motion and calibration are not satisfied, it is still possible to retrieve a reconstruction up to a global subgroup action (on the entire configuration of the camera system). We characterize such sub-groups explicitly for all possible motion groups of the cam- era. The reconstructed structure can then be re-projected to generate novel views of the scene. We characterize the "ba- sis" of the reprojection corresponding to each subgroup, and also the motions that generate a unique reprojection. We achieve the goal by using results from two view analysis [14]. This is possible because the coefficients of multilinear constraints are geometrically dependent of those of bi-linear constraints. Therefore, the only advantage in considering multilinear constraints is in the presence of singular surfaces and rectilinear motions. Our future research agenda involves the design of optimal algorithms to recover all (and only!) the parameters that can be estimated from the data based upon their generic ambiguities. The reconstruction and reprojection problem studied in this paper is for a constant calibration matrix. We will present generalized results for the time-varying case in future work. Acknowledgment This work is supported by ARO under the MURI grant DAAH04-96-1-0341. --R Novel view synthesis in tensor space. Affine calibration of mobile vehicles. Euclidean constraints for uncalibrated reconstruction. Multiple image invariance using the double algebra. Euclidean shape and motion from multiple perspective views via affine iterations. What can be seen in three dimensions with an uncalibrated stereo rig? Lines and points in three views Reduced multilinear constraints - theory and ex- periments Canonical representations for the geometries of multiple projective views. Theory of Reconstruction from Image Motion. Ambiguity in reconstruction from images of six points. A theory of self-calibration of a moving camera Affine reconstruction from perspective pairs obtained by a translating camera. Critical motion sequences for monocular self-calibration and uncalibrated Euclidean reconstruction The geometry of projective reconstruction I: Matching constraints and the joint image. The study of 3D-from-2D using elimination --TR --CTR Fredrik Kahl , Anders Heyden , Long Quan, Minimal Projective Reconstruction Including Missing Data, IEEE Transactions on Pattern Analysis and Machine Intelligence, v.23 n.4, p.418-424, April 2001 Pr Hammarstedt , Fredrik Kahl , Anders Heyden, Affine Reconstruction from Translational Motion under Various Autocalibration Constraints, Journal of Mathematical Imaging and Vision, v.24 n.2, p.245-257, March 2006
reprojection;multilinear constraints;reconstruction ambiguity;camera self-calibration
598459
The Joy of Sampling.
A standard method for handling Bayesian models is to use Markov chain Monte Carlo methods to draw samples from the posterior. We demonstrate this method on two core problems in computer visionstructure from motion and colour constancy. These examples illustrate a samplers producing useful representations for very large problems. We demonstrate that the sampled representations are trustworthy, using consistency checks in the experimental design. The sampling solution to structure from motion is strictly better than the factorisation approach, because: it reports uncertainty on structure and position measurements in a direct way&semi; it can identify tracking errors&semi; and its estimates of covariance in marginal point position are reliable. Our colour constancy solution is strictly better than competing approaches, because: it reports uncertainty on surface colour and illuminant measurements in a direct way&semi; it incorporates all available constraints on surface reflectance and on illumination in a direct way&semi; and it integrates a spatial model of reflectance and illumination distribution with a rendering model in a natural way. One advantage of a sampled representation is that it can be resampled to take into account other information. We demonstrate the effect of knowing that, in our colour constancy example, a surface viewed in two different images is in fact the same object. We conclude with a general discussion of the strengths and weaknesses of the sampling paradigm as a tool for computer vision.
Quite often in practice it is easy to come up with a function f proportional to the posterior. In this case, the posterior is f R f .u/ du but the integral-the normalizing constant-can be very difficult to compute (the best way to do it is to use a sampling method). An attractive feature of the MetropolisHastingsalgorithmisthatweneednotknow the normalizing constant for the distribution (because the constant is cancelled by the ratio). 1.5. Techniques for Building Practical MCMC Samplers It is easy to build a sampler using the Metropolis-Hastings algorithm. It seems to be very hard to build a good sampler-one that burns in quickly, mixes well, and gives a trustworthy picture of the posterior-using that algorithm. We describe a variety of techniques for building samplers, and conclude with a discussion of possible sanity checks. 1.5.1. Gibbs Samplers. It is quite common to encounter situations where the target distribution has a non standard form, but is standard when groups of variables have fixed values (this occurs in vision problems; see Sections, 2.3 and 3.2). In this case, it is natural to adopt a proposal mechanism that fixes one set of variables and draws a sample from the full conditional distribution on the other set, and vice versa. This very useful technique is known as Gibbs sampling (named by Geman and Geman (1984) but apparently due to the statistical physics literature, where it was known as the heat bath algorithm, Gilks et al., 1996b, p. 12). Usu- ally, the group of variables to be sampled is chosen at random, and sufficient samples are drawn so that each group of variables is visited many times. Gibbs sampling is very easy to implement. There is one considerable danger, which is often quite dif- ficult to avoid. If the groups of variables are strongly 112 Forsyth, Haddon and Ioffe Figure 1. Correlated variables cause Gibbs samplers to behave badly. The figure on the top left shows 100 samples drawn from a Gibbs sampler for two independent normal random variables, one with variance one and the other with variance ten. The stars indicate the samples; the line segments indicate the order in which the samples were drawn. Note that the sampler makes quite large vertical moves (because the variance in this direction is large). The figure on the top right shows 100 samples drawn from this distribution, now rotated by 45-, using a Gibbs sampler. In this case, the sampler can make only relatively small vertical and horizontal moves, and so the position of the samples changes relatively slowly; the 100 samples in the graph on the bottom left, which consist of those of the first graph rotated by 45-, give a much better picture of the distribution. On the bottom right, the x-coordinate for the samples drawn from the second sampler (solid line) and the x-coordinates of the third figure (dashed line). The solid curve (correctly) suggests that the samples drawn from the second sampler are quite strongly correlated. correlated, then a Gibbs sampler can mix very badly indeed. The effect is well known (for a full discussion, see for example, Gilks and Roberts, 1996) and easily illustrated (see Fig. 1). 1.5.2. The Hybrid Monte Carlo Method. A common difficulty with sampling methods is that the state of the sampler appears to perform a slightly biased random walk. The difficulty with random walk is that it takes a long time to move any distance along a domain, meaning that if the sampler is started at a point a long way from the mode of the distribution, it will take a long time before it reaches the mode. From our perspective, it is extremely important to have a representation of the distribution around the mode. Hybrid Monte Carlo is a method for making proposals that causes the state of the sampler to move rather quickly to the mode, and then explore it. The method is due to Duane et al. (1987) (and described in detail in Neal (1993)). Write the state of the sampler as q. The method requires that the target distribution can be written as Now let us think of U as a potential function; the state of the sampler will be the state of a particle of mass m subject to this potential function. This state can be determined by considering the momentum of the particle p and writing a Hamiltonian for the particle: H.q; p/ D U.q/ C We now need to integrate Hamilton's equations DrqU @t to determine the state of the particle. This temporary excursion into mechanics is actually justified, because we can exponentiate the negative Hamiltonian of the particle to get which is a new target distribution for a larger set of random variables. We now have two proposal moves: 1. Advance time in our particle model by some randomly chosen amount, either forwards or back- wards. This updates both q and p. As long as we use a symplectic integrator, the extent of the advance is uniform and random, and the choice of forward or backward is random, the accept probability is one. 2. Fix q and draw a sample for p from the full con- ditional. This is easy, because the full conditional distribution in p is normal and is independent of q. This sampler has very attractive qualitative behaviour. If the state is at a relatively large value of U, then the first type of move will travel quickly down the gradient of U to smaller values, while building up momentum. But the second move then discards this momentum; so we have a sampler that should move quickly to a mode-where U is small-and then move around exploring the mode under the influence of the random choice of momenta. Good values of the particle's mass and of the range of time values must be chosen by experiment. In practice, the hybrid method seems to be useful for continuous problems. It is very easy to implement for the colour constancy example given above, and has The Joy of Sampling 113 been successfully used on a variety of other continuous problems (Neal, 1993). 1.6. MCMC and Random Search in Vision Markov chain Monte Carlo has appeared in the vision literature in various forms. One common use is to attempt to obtain an MAP estimate by random search, usually using the Metropolis-Hastings algorithm (e.g. Geman and Geman, 1984; Geman and Graffigne, 1986). The Markov random field model is a spatial model which gives a posterior on image labellings given measurements as a function of measurement values and local patterns of pixel labels (so-called clique potentials; the topic is reviewed in Li (1995)). A standard method for estimating MAP labellings is to use an annealed version of the Metropolis-Hastings algorithm, where the posterior to be sampled is a function of a parameter that changes during the sampling process. This parameter is often thought of as tempera- ture; the intent is that for high values of the parameter, the posterior has only one mode, and as the temperature is reduced the state of the sampler will get stuck in that mode, thereby obtaining a global extremum. It is not possible to guarantee in practice that this occurs, and the algorithm has a rather mixed reputation (Collins et al., 1988; Golden and Skiscim, 1986). The notion of using a sampling method to perform inference on a generative model of an image pattern appears to be due to Grenander (1983). Few successful examples appear in the literature. In Jolly et al. (1996), an annealing method is used to estimate an MAP solution for the configuration and motion of a motor car template in an image. In Zhu (1998), a random search method is used to find a medial axis transform. In Zhu et al. (2000), an MCMC method is used to find simple shapes and road signs. In Green (1996), MCMC is used to perform inference in various vision-like situations, including reconstruction from single photon emission computed tomography data and finding a polygonal template of a duck in heavy spatial noise. In Phillips and Smith (1996), inference is performed on a hierarchical model to find faces, and a version of MCMC is usedtofindanunknownnumberofdisks.Templatesare used for restoration in Amit et al. (1991). Gibbs samplers are quite widely used for reconstruction (Geman and Geman, 1984; Geman and Graffigne, 1986; Zhu et al., 1998). Random search is now a standard method for estimating the fundamental matrix in structure from 114 Forsyth, Haddon and Ioffe motion problems; a review appears in Torr and Murray (1997). RANSAC-an algorithm for robust fitting, due to Fischler and Bolles (1981) and appearing in the statistical literature as Rousseeuw (1987)-proposes small sets of correspondences uniformly at random, fits a fundamental matrix to each set, and accepts the set whose fit gives the largest number of correspondences with a sufficiently small residual. The number of sets is chosen to ensure some high probability that a correct set is found. The main advantage of an MCMC method over RANSAC is that an MCMC method can produce a series of hypotheses with meaningful semantics- indicating, for example, the posterior probability that a particular point is an outlier, or the posterior probability that a pair of measurements come from a single point. 1.6.1. Particle Filtering (or Condensation, or Survival of the Fittest) and Resampling. The most substantial impact of sampling algorithms in vision has been the use of resampling algorithms in tracking. The best known algorithm is known as condensation in the vision community (Blake and Isard, 1998), survival of the fittest in the AI community (Kanazawa et al., 1995), and particle filtering in the statistical signal processing community, where it originated (Carpenter et al., 1999; Kitagawa, 1987). A wide range of variants and of applications of particle filtering are described in a forthcoming book (Doucet et al., 2001). This algorithm is a modification of factored sampling: one draws samples from a prior (which represents the state of the world up to the k1'th measurement), propagates these samples through a dynamical model, and then weights them using the posterior incorporating the k'th measurement. This set of weighted samples provides a representation of the prior for the next iteration. The algorithm is fast and efficient, and is now quite widely applied for low-dimensional problems. The attraction of resampling algorithms is that they can be used to incorporate new information. In tracking applications, new information comes because a new frame, with new measurements, has arrived. New information may come from other sources. In the colour constancy example, we assume that the algorithm is told that two patches in two different images are the same colour (this might occur because a recognition algorithm has a good match to the geometry, and knows the patches represent the same object). This information strongly constrains the inferred colours for other patches in each view (Section 3). In recognition applications one often encounters some form of hierarchical model, which again suggests resampling. In Ioffe and Forsyth (1999), a sampler is usedtolabelgroupsofimagesegments,usingtheircon- sistency with observed human kinematics. The human model used has nine segments. It is foolish to attempt to label all nine segment groups; instead, their algorithm uses a sampler to label individual segments with a frequency proportional to the posterior probability of that label given the image data. The set of individual segment labels is resampled to propose pairs of labels for pairs of segments, and so on. In this case, the new information is the use of an enhanced prior; the prior for pairs of labels emphasizes pairs of segments that lie in particular configurations, a property that is meaningless for single segments. 2. Example: Large Scale Sampling for Bayesian Structure from Motion Structure from motion is the problem of inferring some description of geometry from a sequence of images. The problem has a long history and a huge literature; space does not allow a comprehensive review, but see Beardsley et al. (1997), Faugeras et al. (1998), Faugeras and Robert (1996), Gool and Zisserman (1997), and Hartley and Zisserman (2000). Accurate solutions to structure from motion are attractive, because the technique can be used to generate models for rendering virtual environments (e.g. Debevec et al., 1996; Faugeras et al., 1998; Gool and Zisserman, 1997; Tomasi and Kanade, 1992). 2.1. Structure from Motion by Matrix Factorisation Assume m distinct views of n points are given; correspondences are known. In the influential Tomasi-Kanade formulation of structure from motion (Tomasi and Kanade, 1992), these data are arranged into a 2m n matrix of measurements D which must factor as D D UV, where U represents the camera positions and V represents point positions. An affine transform A is determined such that UA minimises a set of constraints associated with a camera, and A1V then represents Euclidean structure. In practice, factorisation is achieved using a singular value decomposition. This is a maximum likelihood method if an isotropic Gaussian error model is adopted; for an anisotropic Gaussian error model, see Morris and Kanade (1998). The formalism has been applied to various camera models (Poelman, 1993; Tomasi and Kanade, 1992; Triggs, 1995); missing data points can be interpolated from known points (Jacobs, 1997; Tomasi and Kanade, 1992); methods for motion segmentation exist (Costeira and Kanade, 1998); and methods for lines and similar primitives are known (Morris and Kanade, 1998). There are noise estimates for recovered structure (Morris and Kanade, 1998). These assume that errors in the estimates of structure are independent, an assumption that the authors acknowledge is not always sustainable. The factorisation method has one important weak- ness. Because the algorithm has two separate stages, it does not allow any payoff between model error- the extent to which the recovered model violates the required set of camera constraints-and measurement error-the extent to which model predictions correspond to data observations. This means that the model cannot be used to identify measurement problems (for example, tracker errors as in Fig. 5), and so is subject to reconstruction errors caused by incorporating erroneous measurements. This is a property of the al- gorithm, rather than of the problem; because U and V have relatively few degrees of freedom compared with D, it should be possible to identify and ignore many unreliable measurements if the full force of the model is employed. Recent work by Dellaert et al. has shown how strongly the model constrains the data; they use a sampling method to average over all correspondences, weightingthembyconsistencywithmeasureddata,and obtaining a satisfactory reconstruction. Their method removes the need to compute correspondences from structure from motion problems (Dellaert et al., 2000). 2.2. The Posterior on Structure and Motion It is useful to think of Bayesian models as generative models(e.g.Grenander,1983).Inagenerativestructure from motion model, U and V are drawn from appropriate priors. Then D is obtained by adding noise to UV. We assume that noise is obtained from a mixture model; with some large probability, Gaussian noise is used, and with a small probability, the measurement value is replaced with a uniform random variable. The priors on U and V are obtained from constraints on camera structure. We do not fix the origin of the co-ordinate system, and represent points in homogenous coordinates, so our U and V have dimensions 2m 4 and 4 n respectively. We assume a scaled orthographic viewing model with unknown scale that varies from frame to frame. The Joy of Sampling 115 All this yields a vector of constraint equations which contains elements of the form (expressing the fact that the camera basis consists of elements of the same length), (expressing the fact that the camera basis elements are perpendicular), and (from the homogenous coordinates). A natural prior to use is proportional to exp 22 constraint This prior penalises violations of the constraints quite strongly, but allows constraint violations to be paid off one against the other. This approach is in essence a penalty method. An alternative is to insist that the prior is uniform if the constraints are all satis- fied and zero otherwise-in practice, this would involve constructing a parametrisation for the domain on which the prior is non-zero, and working with that parametrisation. This approach is numerically more complex to implement; it also has the disadvantage that one is imposing constraints that may, in fact, be violated (i.e. the scaled orthography model may not be sufficient; the imaging element may be misaligned with respect to the lens, so that the camera basis consists of elements of slightly different length, etc. We can now write a posterior model. Recall that the noise process is a mixture of two processes: the first adds Gaussian noise, and the second replaces the measurement value with a uniform random variable. We introduce a set of discrete mask bits, one per measure- ment, in a matrix M; these mask bits determine by which noise model a measurement is affected. A mask bit will be 1 for a good measurement (i.e. one affected by isotropic Gaussian noise), and 0 for a bad measurement (i.e. one which contains no information about the model). These bits should be compared with the mask bits used in fitting mixture models using EM Haddon and Ioffe (see the discussion in McLachlan and Krishnan (1996), and with the boundary processes used in, among oth- ers, Blake and Zisserman, 1987; Mumford and Shah, 1989). We introduce a prior on M;.M/, which is zero for matrices that have fewer than k non-zero elements in some row or column, and uniform otherwise; this prior ensures that we do not attempt inference for situations where we have insufficient measurements. The likelihood is then P.DjU; V; M/, which is proportional to the exponential of C i;j 2m2eas 2b2ad and the posterior is proportional to: 22 constraint Notice that the maximum of the posterior could well not occur at the maximum of the likelihood, because although the factorisation might fit the data well, the U factor may satisfy the camera constraints poorly. 2.3. Sampling the Structure from Motion Model This formulation contains both a discrete and a continuous component. It is natural to consider using a Gibbs sampler, sampling from the full conditional on point positions given fixed camera positions, and from the full conditional on camera positions given fixed point positions. This works poorly, because the variables are very highly correlated-a tiny shift in a point position given fixed camera positions tends to result in a large error. Instead, the continuous variables are sampled using the hybrid method described in Section 1.2; discrete variables are sampled from the full conditional using a strategy that proposes inverting 5% of the bits, randomly chosen, at a time. Hybrid MCMC moves are proposed with probability 0.7 and discrete variable moves are proposed with probability 0.3. 3. Example: Sampling an Unknown Number of Components for Bayesian Colour Constancy The image appearance of a set of surfaces is affected both by the reflectance of the surfaces and by the spectral radiance of the illuminating light. Recovering a representation of the surface reflectance from image information is called colour constancy. Computational models customarily model surface re- flectances and illuminant spectra by a finite weighted sum of basis functions and use a variety of cues to recover reflectance, including (but not limited to!): specular reflections (Lee, 1986); constant average re- flectance (Buchsbaum, 1980); illuminant spatial frequency (Land and McCann, 1971); low-dimensional families of surfaces (Maloney and Wandell, 1986) and physical constraints on reflectance and illumination coefficients (Forsyth, 1990; Finlayson, 1996). Each cue has well-known strengths and weaknesses. The most complete recent study appears to be Brainard and Freeman (1997), which uses the cues to make Bayesian decisions that maximise expected utility, and compares the quality of the decision; inaccurate decisions confound recognition (Funt et al., 1998). 3.1. The Probabilistic Model We assume that surfaces are flat, so that there is no shading variation due to surface orientation and no in- terreflection. There are four components to our model: A viewing model: we assume a perspective view of a flat, frontal surface, with the focal point positioned above the center of the surface. As spatial resolution is not a major issue here, we work on a 50 50 pixel grid for speed. A spatial model of surface reflectances: because spatial statistics is not the primary focus of this paper, we use a model where reflectances are constant in a grid of boxes, where the grid edges are not known in advance. A natural improvement would be the random polygon tesselation of Green (1996). A spatial model of illumination: for the work described in this paper, we assume that there is a single point source whose position is uniformly distributed within a volume around the viewed surface. A rendering model: which determines the receptor responses resulting from a particular choice of illuminant and surface reflectance; this follows from standard considerations. 3.1.1. The Rendering Model. We model surface re- flectances as a sum of basis functions 'j ./, and assume that reflectances are piecewise constant: Xns Here j .x; y/ are a set of coefficients that vary over space according to the spatial model. Similarly, we model illuminants as a sum of basis functions ^i and assume that the spatial variation is given by the presence of a single point source positioned at p. The diffuse component due to the source Xne where i are the coefficients of each basis function and p/ is a gain term that represents the change in brightness of the source over the area viewed. The specular component due to the source is: Xne where m.x; y; p/ is a gain term that represents the change in specular component over the area viewed. Standard considerations yield a model of the k'th receptor response as: Cm.x;y;p/ hiki where Z and Z hik D k./^i ./ d and k./is the sensitivity of the k'th receptor class. The illuminant terms d.x; from the point source model; m.x; y; p/ is obtained using Phong's model of specularities. We write any prior probability distribution as . Our model of the process by which an image is generated is then: sample the number of reflectance steps in x and in y (kx and respectively) from the prior .kx;ky/ D .kx/.ky/. now sample the position of the steps (ex and ey re- spectively) from the prior .ex;ey jkx;ky/ D .ex jkx/.ey j ky/; for each tile, sample the reflectance (.m/ for the m'th tile) for that tile from the prior .m//; The Joy of Sampling 117 sample the illuminant coefficients from the prior sample the illuminant position p from the prior .p/; and rendser the image, adding Gaussian noise of known standard deviation cc to the value of each pixel. This gives a likelihood, The posterior is proportional to: Y .i/.p/ .m// 3.1.2. Priors and Practicalities. The spatial model: We specify the spatial model by giving the number of edges in the x and y direction separately, the position of the edges, and the reflectances within each block. We assume that there are no more than seven edges patches) within each direction, purely for efficiency. The prior used is a Poisson distribution, censored to ensure that all values greater than seven have zero prior, and rescaled. Edge positions are chosen using a hard-core model: the first edge position is chosen uniformly; the second is chosen uniformly, so that the number of pixels between it and the first is never fewer than five; the third is chosen uniformly so that the number of pixels between it and the second and between it and the first is never fewer than five; and so on. This hard-core model ensures that edge are not so close together that pixel evidence between edges is moot. Priors for reflectance and illumination: Surface reflectance functions can never be less than zero, nor greater than one. This means that the coefficients of these functions lie in a compact convex set. It is easy to obtain a representative subset of the family of planes that bounds this set, by sampling the basis functions at some set of wavelengths. Similarly, illuminant functions can never be less than zero, meaning that the coef- ficients of these functions lie in a convex cone. Again, this cone is easily approximated. These constraints on reflectance and illuminant coefficients are encoded in the prior. We use a prior that is constant within the constraint set and falls off exponentially with an estimate of distance from the constraint set. Because the constraint sets are convex, they can be expressed as a set of linear inequalities; for surface reflectance we have Haddon and Ioffe for illuminant we have Ci >0.Ifthe coefficients in these inequalities are normalised (i.e. the rows of the matrices are unit vectors), then the largest negative value of these inequalities is an estimate of distance to the constraint set. We use six basis elements for illumination and re- flectancesothatwecanhave(forexample)surfacesthat look different under one light and the same under another light. This phenomenon, known as metamerism, occurs in the real world; our exploration of ambiguities should represent the possibility. We represent surface colour by the colour of a surface rendered under a known, white light. 3.2. Sampling the Colour Constancy Model Proposals are made by a mixture of five distinct moves, chosen at random. The probability of proposing a particular type of move is uniform, with the exception that when there are no edges, no deaths are proposed, and when the number of edges in a particular direction is at a maximum, no births are proposed. An important advantage to this approach is that, within each move,we can assume that the values of variables that we are not changing are correct, and so apply standard algorithms to estimate other values. Calculations are straightfor- ward, along the lines of Green (1995). Moving the light: Proposals for a new x, y position for the light are obtained by filtering the image. We apply a filter whose kernel has the same shape as a typical specularity and a zero mean to the r, g and b components separately; the responses are divided by mean intensity, and the sum of squared responses is rescaled to form a proposal distribution. The kernel itself is obtained by averaging a large number of specularities obtained using draws from the prior on illuminant position. Using image data to construct proposal distributions appears to lead to quite efficient samplers; it is also quite generally applicable, as Zhu et al. (2000) (who call it data driven MCMC) point out. Proposals for a move of the light in z are uniform, within a small range of the current position. The real dataset has no specularities, and these moves have been demonstrated only for synthetic data. Birth of an edge: For each direction, we apply a derivative of Gaussian filter to the red, green and blue components of the image and then divide the response by a weighted average of the local intensity; the result is squared and summed along the direction of interest. This is normalised to 0.8, and 0.2 of a uniform distribution is added. This process produces a proposal distribution that has strong peaks at each edge, and at the specularity, but does not completely exclude any legal edge point (Fig. 2). Again, we are using image information to construct an appropriate proposal process. For a given state, this proposal distribution is zeroed for points close to existing edges (for consistency with the hard core model), and a proposed new edge position is chosen from the result. Once the position has been chosen, we must choose new reflectances for each of the new patches created by the birth of an edge. Gen- erally, if we give the two new patches reflectances that are similar to that of the old patch, we expect that there will be only a small change in the posterior; this is advantageous, because it encourages exploration. Cur- rently, we average the receptor responses within each new patch, and then use the (known) illuminant to estimate a reflectance that comes as close as possible to achieving this average value, while lying within the constraint set. We then add a Gaussian random variable to the estimated reflectance value; currently, we use a vector of independent Gaussian components each of standard deviation 0.5 (the choice will depend on the basis fitted). Death of an edge: The edge whose death is proposed is chosen uniformly at random. The death of an edge causes pairs of surface patches to be fused; the new reflectance for this fused region is obtained using the same mechanism as for a birth (i.e. the receptor responses are averaged, the known illuminant is used to estimate good reflectances for each patch, and a vector of independent Gaussian components each of standard deviation 0.5 is added to the result). Moving an edge: An edge to move is chosen uniformly at random. Within the region of available points (governedbythehard-coremodel-theedgecannotget too close to the edges on either side of it) a new position is proposed uniformly at random. This is somewhat in- efficient, compared with the use of filter energies as a proposal distribution. We use this mechanism to avoid a problem posed by a hard-core model; it can be difficult for a sampler to move out of the state where two edges are placed close together and on either side of a real edge. Neither edge can be moved to the real edge-the other repels it-and a new edge cannot be proposed in the right side; furthermore, there may be little advantage in killing either of the two edges. Proposing uniform moves alleviates this problem by increasing the possibility that one of the two edges will move away, so that the other can move onto the right spot. The Joy of Sampling 119 Figure 2. The proposal distribution for edge birth in the x direction for the Mondrian image shown. The proposal distribution is obtained by filtering the image, dividing the response by a weighted average of the local intensity, then summing down the y-direction. The result is normalised to 0.8, and 0.2 of a uniform distribution is added. Note that the filtering process leads to strong peaks near the edges; this means that the proposal process is relatively efficient, but does not completely rule out edges away from strong responses, if other evidence can be found for their presence (the likelihood component of the posterior). 120 Forsyth, Haddon and Ioffe Change reflectance and illumination: It is tempting to use a Gibbs sampler, but the chain moves extremely slowly if we do this. Instead, we sample re- flectance and illumination simultaneously using the hybrid method of Section 1.2. Poor behaviour by the Gibbs sampler can be explained as follows. Assume that the sampler has burnt in, which means that the current choice of surface re- flectance and illuminant coefficients yields quite a good approximation to the original picture. Assume that we have fixed the surface reflectance coefficients and wish to change the illuminant coefficients. Now we expect that the normal distribution in illuminant coefficients has a mean somewhere close to the current value and a fairly narrow covariance, because any substantial change in the illuminant coefficients will lead to an image that is different from the original picture. This means that any change in the illuminant coefficients that results will be small. Similarly, if we fix the illuminant coefficients and sample the surface reflectance coefficients, we expect that the changes that result will be small. 4. Experimental Procedures In each case, the sampler can be started at a state chosen at random, or at a state chosen by a start procedure (described in more detail in Section 5.4). The main difference between these methods is that choosing a start point tends to lead to a sampler that appears to burn in more quickly. 4.1. Structure from Motion Results are obtained using the hotel dataset, courtesy of the Modeling by Videotaping group in the Robotics Institute, Carnegie Mellon University. We report two types of experiment: in the first, the sampler is run on that dataset; in the second, some small percentage of the points in this dataset are replaced with uniform random numbers in the range of the image coordinates. This represents large noise effects. Coordinates in this dataset appear to lie in the range 1-512. The algorithm appears to be quite well behaved for a rang of choices of constant. Values forpthe constants for pFigs. 5, 6, 9 and are meas D 1= 2, constraint D 1= 5000; bad should be slightly larger than meas (allowing points to range some distance from the measurement before the measuprement has been disallowed) and we used meas D 5 / constraint for these figures. Experience suggestsitispossibletouse constraint verymuchsmaller without apparently affecting the freedom with which the sampler mixes. 4.2. Colour Constancy As Fig. 3 indicates, the sampler runs on synthetic im- ages, and makes reasonable estimates of the position of the edges and the specularity and of illuminant and surface colours. In this case the basis and constraints are all known in advance. Applying the sampler to real data is more interesting. The data set shown in Fig. 8 consists of images originally used in Forsyth (1990). Figure 3. Left: a typical synthetic Mondrian, rendered using a linear intensity scale that thresholds the specularity. Center: the proposal distribution for x and y position of the specularity, obtained by image filtering and shown with the highest value white. Right: a rendering of a typical sample for this case, using the sample's illuminant; a successful sampler produces samples that look like the image. Results for real images are shown in colour in Fig. 8. These are images of the same set of patches on a Mondrian of coloured paper patches, photographed under white, blue, yellow, purple, red and cyan light. There are no specularities, so we used a diffuse model for this data set. The original data has been lost, so we used versions scanned from the paper; these images were displayed on a CRT, photographed from that display, subjected to four-colour printing and then scanned; it is remarkable that any constancy is possible under the circumstances. A basis was obtained using the bilinear fitting procedure of Marimont and Wandell (1992). Determining appropriate constraint regions is more dif- ficult; we obtained a natural coordinate system using principal components, and then constructed a bounding box in this coordinate system. The box was grown 10% along each axis, on the understanding that none of the colours in the Mondrians of Forsyth (1990) were very deeply saturated. The red, green and blue receptor responses are represented by numbers in the range zero to one; we use cc D 1=64, implying that only the top six bits in each receptor response are reliable. 5. Assessing the Experimental Results Sections 2 and 3 phrased two standard vision problems as inference problems. These are quite nasty inference problems, with large numbers of both continuous and discrete variables. It is possible, as these sections indi- cated, to extract a representation of the posterior from these problems. Why do we believe that these representations are helpful? and how well do they compare with representations that other methods might offer? Some cautions must be observed before making comparisons. Firstly, it is important to apply a reality check to the representations that the sampler pro- duces, to determine if there is reason to believe that the sampler has burnt-in. Secondly, comparing a representation of a posterior given some data with the result of a method that reports a minimum error solution offers no more than a perfunctory error check. This is because the nature of the information produced by the two algorithms is different. The meaningful comparison is with other possible reports of the properties of the posterior. Here, no gold standard tests are available; there are no methods that are known to produce more accurate representations of a posterior density against which we can test a sampler. However, we can compare the representation produced by the sampler to methods that are significantly cheaper computationally. The Joy of Sampling 121 5.1. Reality Checks: Has the Sampler Burnt in and is it Mixing? There are convergence diagnostics for MCMC methods (e.g. see Besag et al., 1995; Roberts, 1992), but these can suggest convergence where none exists; it is easy to produce a chain that can pass these tests without having burnt in. Instead, we rely on general methods. Firstly, we check to ensure that the sampler can move to a near- maximal value of the posterior from any start position within a reasonable number of moves. Secondly, we check that the state of the sampler moves freely about the domain that is represented. Third, we have built various consistency checks into the experiments. 5.1.1. Structure from Motion. Figure 4 shows a series of samples drawn from the posterior for the structure from motion problem, with an indication of the order in which the samples were drawn, indicating that the sampler is mixing relatively well. While the sampler's mixing rate does appear to be sufficient to give a reasonable estimate of structure of the posterior around its mode, it is clear that the sampler does not move around the whole domain freely. This posterior contains a discrete symmetry; for any fixed value of the mask bits, one can multiply U by a square root of the identity on the left and V by a square root of the identity on the right, and obtain the same value of the posterior. This creates no particular difficulty in practice, because these solutions are very widely isolated from one another. Our sampler does not move from peak to peak, because the probability that the hybrid method would obtain sufficient momentum to cross the very large regions of very low probability is effectively zero. This is in fact a desirable property; the symmetry means that accurate estimates of the mean value of U and V would be zero. Consistency checks: In general, we expect that a sampler that is behaving properly should be able to identify correspondence errors and produce a stable representation. There are in fact a number of subtle tracker errors in the hotel sequence. Figure 5 shows that the sampler can identify these tracker errors. Figure 6 illustrates that large tracker errors, artificially inserted into the dataset for this purpose, can be identified, too. 5.1.2. Colour Constancy. The sampler described here has been run on many synthetic images where ground truth is known, and in each case reaches a small neighbourhood of ground truth from a randomly 122 Forsyth, Haddon and Ioffe Figure 4. These plots illustrate the path taken through the state space by the structure from motion sampler. Each plot connects the position of a given point in every tenth sample, starting at the 100th. The paths have been coded with a grey level for clarity; the early samples are light, and the path moves through darker grey levels. The fact that these paths repeatedly cross themselves and return to the same regions suggests that the sampler is mixing rather freely. selected start point-i.e. burns in-within about 1000 samples. The experimental data shown below suggests the sampler mixes well, because of the wide spread on the marginal densities on the reflectances. Consistency checks: The sampler is run on six images of the same scene, but the fact that these images are of the same scene is not built into the model. The spread of samples for surface reflectance coefficients recovered for a particular surface in a particular image, is quite wide (see Fig. 8). However, if we compare the spread of samples for that surface for different images, the clusters overlap. This means that the representation is correctly encoding the fact that these surfaces could be very similar. In fact, as we shall see in Section 5.2, the representation encodes the fact that all surface patches could be very similar. 5.2. Attractive Properties of Sampled Representations There are three attractive properties of the sampled representations we have derived: they provide a covariance estimate for inferred state; they can be resampled to incorporate new information they appear to be stable to perturbations of the input data set. We describe these properties below. 5.2.1. Covariance. The samplers described produce a representation of the posterior probability distribution, The Joy of Sampling 123 Figure 5. Two (cropped) frames from the hotel sequence showing a single sample reconstruction. Squares correspond to measurements with mask bit one (i.e. the measurement of that point in that frame is believed correct); a white cross on a dark background corresponds to a measurement with mask bit zero (i.e. the measurement of that point in that frame is believed incorrect); grey diamonds correspond to model predictions. The extent to which a diamond is centered within a square gives the extent to which a model prediction is supported by the data. In the right frame, at several locations the tracker has skipped to another feature for unknown reasons. In each case the reconstruction identifies the data point as being erroneous, and reprojects to a point in a significantly different position from the measurement reported by the tracker and lying where a correct measurement would be as seen by the position relative to the surface texture on the object. given a data set. A particularly attractive feature is that special datasets require no additional analysis. For ex- ample, if every element in the image has the same colour, we expect the colour constancy sampler to produce a very wide spread of samples for the surface reflectance; similarly, if a structure from motion data set is obtained by a camera translating in its plane, the sampler will return a set of samples with substantial variance perpendicular to that plane without further ado. A second attractive feature is that both expectations and marginal probability distributions are easily available: to compute an expectation of a function, we average that function's value over the samples, and to compute a marginal, we drop irrelevant terms from the state of each sample. Figure 7 illustrates the kind of information a sampler can produce for the structure from motion data; in particular, the sampler reflects the scatter of possible inferred values for a single point. Figure 8 show a set of typical results a sampler can produce from real images for the colour constancy problem. The spatial model identifies edges correctly. Groups of samples drawn for the same surface re- flectance under different lights intersect, as we expect. Furthermore, groups of samples drawn for different surface reflectances under the same light tend not to in- tersect, meaning that these surfaces are generally seen as different. The figure shows a rendering of samples under white light, to give some impression of the variation in descriptions that results. 5.2.2. Resampling to Incorporate New Information. Assume that we are engaged in colour constancy. We construct a representation of surface colour, and new 124 Forsyth, Haddon and Ioffe Figure 6. We perturb the hotel sequence by replacing 5% of the data points with draws from a uniform distribution in the image plane. The Bayesian method, started as in Section 5.4.1, easily discounts these noise points; the figure shows the same frames in the sequence as in Fig. 5, uncropped to show the noise but with a sample reconstruction indicated using the same notation as that figure.Squares correspond to measurements with mask bit one (i.e. the measurement of that point in that frame is believed correct); a white cross on a dark background corresponds to measurements with mask bit zero (i.e. the measurement of that point in that frame is believed incorrect); grey diamonds correspond to model predictions. The extent to which a diamond is centered within a square gives the extent to which a model prediction is supported by the data. Figure 7. Black points show an overhead view of a single sample of the 3D reconstruction obtained using 40 frames of 80 points in the hotel sequence, rotated by hand to show the right-angled structure in the model indicating that the structure is qualitatively correct; the cloud of grey points are samples of the position of a single point, scaled by 1000 to show the (very small) uncertainty available in a single point measurement. information arrives-what do we do? If the representa- ample, assume we have a sampled representation of the tion is probabilistic, the answer is (relatively) straight- posterior for two distinct images. We are now told that forward; we adjust our representation to convey the a patch in one image is the same as a patch in another- posterior incorporating this new information. For ex- this should have an impact on our interpretation of both images. The sampled representation is well suited to determining the effect of this information. In particular, we have samples of P.a; state a j image a/ and P.b; state b j image b/ where we have suppressed the details of the rest of the state in the notation. We interpret the same to mean that each patch is a sample from a Gaussian distribution with some unknown mean fi and a known standard deviation. We would like to obtain samples of state a, state b j image a, image b/ (image a will be abbreviated as im a, etc. Now we have that P.im a, im b j state a, state b;fi/ is proportional to Z P.im a, state a j a/P.a j fi/ da db.fi/ Now the term inside the integral is: P.state a, a; image a/ P.state b,b; image b/ a b We have two sets of samples, and .Ween- sure that these samples are independent and identically distributed by shuffling them (to remove the correlations introduced by MCMC). This means that, for the conditional density for the i'th sample, we have P. ia ji/ D P.state a;a;image a/. Now we construct a new sampler, whose state is fi; j;fig. We ensure this produces samples of the distribution We now use thei's and j's as indexes to our previous set of samples. We can marginalise with respect to a and b by simply dropping their values from the sample. The Joy of Sampling 125 The result is a set of samples distributed according to the desired distribution: Z P(im a, state a j a/P.a j fi/ da db.fi/ Building a sampler that obtains samples of fi; j;fig space according to the desired distribution involves technical difficulties beyond the scope of this paper. The approach essentially chooses pairs consisting of a sample from the set for image a and a sample from the set for image b; these pairs are chosen with a frequency that is higher when the values inferred for a particular patch are similar. Of course, this trick extends to more images. Figure 8 shows results obtained by assuming that a single surface patch in each of the six images is the same. Typically, a small number of sets of samples have a very much higher probability than all others, so that a sampled representation consists of a large number of copies of these samples, interspersed with one or two others. This results in very much reduced variance in the rendering of the patch that is known to be similar for the six images, because the error balls for this surface patch intersect in a relatively small region. However, this does not mean that the variance for the inferred reflectances for the other patches must be re- duced. It is reduced (Fig. 8), but this is because the representations recovered for each separate input image (correctly) captures the possibility that each of the surface patches is the same. This is another important reality check that strongly suggests the sampled representation is trustworthy: the algorithm has been able to use information that one patch is the same in each image to obtain a representation that strongly suggests the other patches are the same, too. 5.2.3. Stability of the Recovered Representations. Reconstructions cannot be compared on the basis of accuracy, because ground truth is not available. However, we can demonstrate that sampled representations are stable under various perturbations of their input. In structure from motion, small errors in tracker response for some points could lead to significant perturbations of the reconstruction for all points, because the reconstructed point positions are not independent- they are coupled by the reconstructed camera configu- rations. Small errors in tracker response actually occur: in the 40 frames of the hotel sequence that we used, six point measurements in nine frames are affected Forsyth, Haddon and Ioffe by small tracker errors as shown in Fig. 5. These (very small) errors affect the reconstruction obtained using the factorisation method because the factorisation of a matrix is a function of all its entries (or equiv- alently, the reconstructed point positions are coupled by the reconstructed camera configurations). To compare the stability of the methods, we now introduce larger tracker errors; a small percentage of data points, randomly selected, are replaced with draws from a uniform distribution on the image plane. If these points are included in the factorisation, the results are essentially meaningless. To provide a fair comparison, we use factorisations obtained using the method of Section 5.4.1 (these are the start points of our sampler). These reconstructions are guaranteed to ignore large error points but will ignore a significant percentage of the data. In comparison, the sampler quickly accretes all points consistent with its model, and so gives sig- nificantly more stable measurements (cf Torr and Zisserman, 1998, which uses maximum likelihood to identify correspondences). Because the reconstruction is in some unknown scaled Euclidean frame, reconstructions are best compared by comparing angles subtended by corresponding triples of points, and by comparing distances between corresponding points scaled to minimize the errors. The sampled representation is significantly more stable under tracker errors and noise than a factorisation method (Figs. 9 and 10). The Joy of Sampling 127 5.3. Comparing Different Algorithms for Obtaining Covariance Estimates Probability distributions are devices for computing ex- pectations. Computing an expectation is an integration problem; for high dimensional problems like those described here, the curse of dimensionality applies, and quadrature methods are not appropriate (e.g. the review of numerical integration methods in Evans and Swartz (2000). This leaves us with two possibilities: a random or quasi-random method, or an analytic approximation to the integral. Applying quasi-random methods to the problems described here appears to pose substantial technical difficulties; we refer the interested reader to Evans and Swartz (2000) and Traub and Werschulz (1999). The analytic approximation most currently used in computer vision is based on Laplace's method (de- scribed in Evans and Swartz (2000) and in the form we use it in Ripley (1996, p. 63); we shall call the approximation Laplace's method in what follows). This approach models a unimodal posterior distribution with a normal distribution, whose mean is at the mode of the posterior and whose covariance matrix is the inverse of the Hessian of the posterior at the mode. In essence, the approximation notes that the main contribution to an expectation computed using a peaky probability distribution is at the mode; the contribution of the tails is estimated by the Hessian at the mode. Figure 8. A: images of the same set of patches on a Mondrian of coloured paper patches, photographed under white, blue, purple, red, aqua and yellow light and scanned from Forsyth (1990), used as inputs to the sampler. B: renderings of typical representations obtained by the sampler, in each case shown under the coloured light inferred (so that in a successful result, the inferred representation looks like the image above it). Note the accuracy of the spatial model, and the robustness to image noise. C: renderings of typical representations under the same (white) light, so that a successful result implies similar renderings. D: The first two components of surface reflectance samples, plotted on the same axes for four different surfaces. Each sample is colour keyed to the image from which it was obtained; red samples for the red image, etc, with black corresponding to the white image. The circles show samples of the reflectance coefficients for the blue surface at the top left corner of the Mondrian; the stars for the yellow surface in the second row; the plusses show samples for the orange surface in the top row of the Mondrian and the crosses for the red surface in the bottom row. Each surface generates a smear of samples, which represent the uncertainty in the inferred surface reflectance, given the particular image input. There is an important consistency check in this data. Notice that the smear of samples corresponding to a particular surface in one image intersects, but is not the same as, the smear corresponding to that surface in another. This means that the representation envisages the possibility of their being the same, but does not commit to it. E: The first two components of surface reflectance samples, plotted on the same axes for four different surfaces. These come from the samples shown as D, resampled under the assumption that the blue surface in the top left hand corner of the Mondrian is the same for each image. We use the same representation and axes as in that figure. Notice that this single piece of information hugely reduces the ambiguity in the representation. F: Samples of reflectances returned for each patch on the Mondrian using the images shown as A (above), under each light, rendered under white light. There are four hundred samples per patch and per illuminant, each rendered as a small square; thus, a patch for which there is very little information shows a salt-and-pepper style texture. The rows show samples for the same patch under different illuminants; each column corresponds to an illuminant (in the order aqua, blue, purple, red, white and yellow). Notice the very substantial variation in appearance; white pixels denote samples which saturated. Notice also that for each patch there are samples that look similar. G: The samples obtained when all samples are resampled, assuming that the right (blue) patch is the same patch in each image. H: The samples obtained when all samples are resampled, assuming that the sixth (yellow) patch is the same patch in each image. Notice the substantial reduction in variance; while this constraint does not force the other patches to look the same, they do because they are in fact the same surface. 128 Forsyth, Haddon and Ioffe Figure 9. The factorisation method is relatively unstable under noise. We compare reconstructions obtained from the uncorrupted data set with reconstructions obtained when 5% of the entries in D are replaced with draws from a uniform distribution in the image plane; to represent the factorisation method fairly, we use the start points obtained using the algorithm of Section 5.4.1 (which masks off suspect measurements). Left shows a histogram of relative variations in distances between corresponding pairs of points and right shows a histogram of differences in angles subtended by corresponding triples of points. Note the scales-some interpoint distances are misestimated by a factor of 3, and some angles are out by =2. Figure 10. The Bayesian method is stable under noise. We compare reconstructions obtained from the uncorrupted data set with reconstructions obtained when 5% of the entries in D are replaced with draws from a uniform distribution in the image plane. Left shows a histogram of relative variations in distances between corresponding pairs of points and right shows a histogram of differences in angles subtended by corresponding triples of points. Note the significant increase in stability over the factorisation method; relative errors in distance are now of the order of 10% and angular errors are of the order of =40. Laplace's method is a natural linearisation, and has been used for estimates of covariance in the structure from motion literature (Morris and Kanade, 1998). However, as Fig. 11 indicates, the estimates it produces can differ substantially from the estimates produced by a sampler. As we have seen (Section 5.1), the sampler appears to mix acceptably, so this is not because the samples significantly understate the covariance (com- pare Fig. 11 with Fig. 4, which shows the order in which samples were drawn for the samples of Fig. 11). Instead, it is because Laplace's method approximates the probability density function poorly. This is because the log of the posterior consists largely of terms of degree four. In such cases, the Hessian can be a significantly poor guide to the structure of the log-posterior a long way from the mode. The Joy of Sampling 129 Figure 11. We compare the sampled representation of the posterior for the structure from motion problem with a representation obtained using an analytic approximation. Each of the six plots depict three different estimates of marginal posterior probabilities for point position in a plane parallel to the optical axis. (The points are the same points as in Fig. 4.) Samples are shown as a scatter plot. In each case, the one standard deviation ellipse for the covariance estimate obtained from Laplace's approximation is the largest of the three shown, and substantially overestimates covariance; its orientation is often misleading, too (it is plotted in light grey). In each case, the second largest ellipse is the one standard deviation ellipse obtained using Laplace's approximation and assuming that point and camera positions are independent; this is still an overestimate, but is a better estimate than that from Laplace's approximation (it is plotted in dark grey). Finally, the smallest ellipse in each case is obtained from the sample mean and covariance (it is plotted with the darkest grey). Laplace's approximation appears to significantly overestimate the covariance; this is almost certainly because the Hessian at the mode is a poor guide to the behaviour of the tails of the posterior for this problem. In particular, it overestimates the weight of the tails and therefore overestimates the covariance. This is because it is a purely local estimate of the structure of the posterior-we cannot rely on the second derivative of a function at a point necessarily to convey helpful information about what the function is doing a long way away from that point. In comparison, each sample involves (at least!) a comparison of values of the posterior at that sample and at the previous sample, so that the samples are not relying on a local estimate for the structure of the posterior. really useful comparison is available for the case of colour constancy. All current colour constancy algorithms report either exact solutions, or minimum error solutions. Laplace's method should produce absurd covariance estimates, because the domain of integration is heavily truncated by the constraints of Section 3-the tails make no contribution, and it is unreasonable to expect a sensible approximation from the method. 5.4. Speed Both samplers are relatively slow. Samples take longer to draw for the structure from motion problem (2000 samples for 40 views of 80 points in about a day on a Haddon and Ioffe 300 MHz Macintosh G3 system in compiled Matlab) than for the colour constancy problem (1000 samples in an hour in compiled Matlab on the same computer). While this is irritatingly slow, it does not disqualify the technology. In particular, it is important to keep in mind that cheaper technologies-the Laplace approximation estimate of covariance in Section 5.3 comes to mind-may offer significantly inaccurate representa- tions. There are several possibilities for speedups: An intelligent choice of start point: there is no particular reason to start these samplers at a random start point and then wait for the gradient descent component of hybrid MCMC to find the mode. Instead, we can start the sampler at a decent estimate of the mode; we describe relevant methods below. A faster mixing rate: generally, the better a sampler mixes the fewer samples one needs to draw, because the samples increasingly mimic IID samples. It isn't clear how to build a truly fast-mixing sampler. The best strategy appears to be to use image data to structure the proposal distribution (as in Section 3 and Zhu et al., 2000), but there are no proofs that this leads to a fast-mixing sampler. Lower per-sample cost: it is unlikely that a decent representation of covariance will be available with fewer than 1000 samples. This means that each sample should be cheap to obtain. Current possibilities include: a faster integrator in the hybrid MCMC method (we used a symplectic Runge-Kutta- Nystrom method from Sanz-Serna and Calvo, 1994, with no effort to choose the fastest overall integra- tor); a grouping of the variables that allows an effi- cient Gibbs sampler (separating cameras and points leads to a standard form but a sampler that makes only minuscule changes of state for each sample, for the reason illustrated in Fig. 1); and fitting a Gaussian at each sample and using this Gaussian to propose a new state.1 5.4.1. Starting the SFM Sampler. The sampler's state is given by .U; V; M/. We show examples for .m; n/ D .40; 80/ and .m; n/ D .24; 100/. This means the domain of the sampler is then 23200 (resp. 22400) copies of <640 (resp. <592). The relations between the discrete and the continuous variables are complex; for small errors, a sampler started at a random point burns in relatively quickly, but for large errors, the burn in can be very slow. The values of U and V depend strongly on M.If Mhasa1inaposition corresponding to a signifi- cant tracker error, then that error can strongly affect the values of U and V. This effect slows down the convergence of the sampler, because incorrect values of the continuous parameters mean that many data points lie a long way from the values predicted by the model, so that there is little distinction between points that correspond to the model and points that do not. We start the sampler at a fair initial estimate of the mode. We obtain an initial value for the mask Ma by sampling an independent distribution on the bits that tends to deemphasize points which are distant from corresponding points in the previous and next frames. In particular, the i, j'th bit of Ma is 0 with probability where 1ij D .di;j diC1;j /2 C .diCm;j diCmC1;j /2 C .di;j di1;j /2 C .diCm;j diCm1;j /2. Since this is a problem where the quantity of data swamps the number of parameters in the model, the choice of w is fairly unimportant; the main issue is to choose the value to be small enough that large tracker errors are masked almost certainly. The Ua and Va that maximise dij uiakvkaj miaj are then obtained by a sweep algorithm which fixes U (resp. V) and solves the linear system for V (resp. U), and then swaps variables; the sweeps continue until convergence (which is guaranteed). We now compute an affine transformation A such that then Us D UaA and Vs D A1Va. We now draw a sample from the full conditional on each bit in the mask given Us and Vs to obtain Ms The start state is then .Us; Vs; Ms/. 5.4.2. Starting the Colour Constancy Sampler. The sampler converges if started from a random sample from the prior, but this is slow and unnecessarily in- efficient. A good guess at edge positions follows by choosing a set of edges at maxima of the edge proposal distributions, censored to ensure the hardcore model applies. Similarly, a start point for the light position follows by choosing the maximum likelihood position from the proposal distribution; once the specular position is known, an estimate of illuminant colour follows. Finally, for each patch we obtain a reflectance estimate from the average colour within the patch and the illuminant colour. This yields a start point from which the sampler converges relatively quickly. 6. Discussion-Ups and Downs of Sampling Methods Good samplers are fast, burn in quickly, and mix well. It can be proven that some samplers are good (at least in theory) and some are obviously bad; most are merely mysterious as to their behaviour. It is possible to build samplers that yield representations that pass a wide range of sanity checks, and some of these are fairly fast. This is probably the best that can be hoped for in the near future. 6.1. Points in Favour of Using Sampled Representations There are several points in favour of using sampled representations: The strongest is the simple management of uncertainty that comes with such methods. Once samples are available, managing information is simple. Computing expectations and marginalization, both useful activities, are particularly easy. Incorporating new information is, in principle, simple. The output of a properly built sampler is an excellent guide to the inferences which can be drawn and to the ambiguities in a dataset. For example, in Fig. 7, we show uncertainty in the position of a single point in space (deter- mined by a structure from motion method) as a result of image noise. No independence assumptions are required to obtain this information; furthermore, we are not required to use specialised methods when the camera motion is degenerate-if, for example, the camera translates within a plane, the effect will appear in scatter plots that vary widely along the axis perpendicular to the plane. The main benefit that results is simple information integration. Building vision systems on a reasonable scale requires cue integration; for example, what happens if colour reports a region is blue, and shape says it's a fire engine? this contradiction can only be re-solved with some understanding of the reliability of the reports. A properly-built Bayesian model incorporates all available information, and is particularly attractive when natural likelihood and prior models are available (e.g. examples in Sections 2 and 3). In principle, sampling can work for arbitrary posteriors. The Joy of Sampling 131 Another feature of sampled methods is that they can handle complex spatial models. The main difficulty with such models is domains with complicated topolo- gies. For example, it is simple to deal with a domain whichconsistsofmanycomponentsofdifferentdimen- sion (Green, 1995). This means that a spatial model can be part of the posterior. For example, in Section 3, we model the layout of a Mondrian as a grid of rectangles, where neither the position nor the number of the horizontal and vertical edges of the grid are known. Instead, these are inferred from data. This offers the prospect of unifying information about coherence, spatial lay-out and model appearance by performing segmentation with explicit spatial models. Sampling methods are a standard approach to performing inference using spatial models (Geyer, 1999; Moller, 1999). 6.2. The Problems with Samplers While samplers are in principle generic, in practice building a good sampler requires a significant degree of skill. The number of samples required can be very large. Vision problems typically consist of large numbers of discrete and continuous variables. If a posterior is a complicated function of a high dimensional space, with many important modes, an extremely large number of samples may be required to support any useful representation (either as samples, or as a mixture model or some other simplified parametric model fit- ted to samples). However, for most well phrased vision problems, we expect to see a small number of quite tight modes in the posterior, suggesting that the relevant portion of the posterior could be represented by manageable numbers of samples; furthermore, an accurate representation of tails is a less significant need than a reasonable description of the modes. Samplers are currently relatively slow. However, it is possible to build samplers that are fast enough that useful solutions to real vision problems can be obtained in reasonable amounts of time. Generally, the prospect of understanding how to build better systems precedes understanding how to build faster systems. Sampled representations have a claim to universal- ity. Any conceivable representation scheme appears to rest on the presence of samples. For example, one might wish to approximate a posterior as a mixture model. To do so, one can either fit the model to a set of samples, or compute various integrals representing the error; but good numerical integrators in high dimensions are based on sampling methods of one form 132 Forsyth, Haddon and Ioffe or another. This suggests that, unless a problem can be persuaded to take a series of manageable parametric forms for which deterministic algorithms for computing fits are available, one is stuck with the difficulties that come along with sampling methods. Vision problems often have a form that is well adapted to sampling methods. In particular, there is usually a preponderance of evidence, meaning that the posterior should have few, large, well-isolated peaks, whose location can be estimated. Furthermore, it is commonly the case that computer vision algorithms can compute values for some variables given others are known. The Metropolis-Hastings algorithm gives a framework within which such algorithms can be integrated easily, to produce a series of hypotheses with meaningful semantics. Samplers are poorly adapted to problems that lead to large domains which have essentially uniform prob- ability. This might occur, for example, in an MRF model where there may be a very large number of states with essentially the same, near-maximal, posterior probability, because each is a small number of label-flips away from the extremum. The difficulty is not the sampler, but the representation it produces. It is quite easy to set up examples that require very large numbers of samples to represent these regions, particularly if the dimension of the domain is large. A fair case can be made that such problems should properly be reparametrised (perhaps by imposing a parametric whatever strategy is to be adopted for addressing them: firstly, because large domains of essentially uniform probability suggest that some problem parameters don't have any significant effect on the outcome; secondly, because estimates of the mode will be extremely unstable; and thirdly, because any estimator of an expectation for such a problem must have high variance. When can samples be trusted? Typically, the first samples must be discarded to allow the sampler to burn in. The rest represent the posterior; but what is k?. The usual approach is to start different sequences at different points, and then confirm that they give comparable answers (e.g. Gelman and Rubin, 1993; Geweke, 1992; Roberts, 1992). Another approach is to prove that the proposal process has rapid mixing properties (which is extremely difficult, e.g. Jerrum and Sinclair, 1996). Rapid mixing is desirable, because the faster the sampler mixes, the lower the variance of expectations estimated using samples (Geyer, 1999). The only mechanism available for many practical problems is to structure one's experimental work to give checks on the behaviour of the sampler. For example, in the work on structure from motion the sampler was able to identify bad measurements and gave stable reconstructions (Section 5.2); similarly, in the work on colour constancy the resampling algorithm correctly reduced the variance in the inferred colour of other patches when informed that some patches had the same colour (Section 5.2). 6.3. Reasons to be Cheerful Interesting vision problems are well-behaved enough to make samplers quite practical tools. Firstly, in most vision problems there is an overwhelming quantity of data compared to the number of parameters being stud- ied; as a result, it is usual to expect that the posterior might have a very small number of quite well-peaked modes, so that exploration of the domain of the sampler can be restricted to small subsets. Secondly, there is a substantial body of algorithms that make good estimates at the position of these modes (e.g. derivative filters estimating the position of edges; factorisation estimating structure and motion; etc.), so that a sampler can be started at a good state. Finally, many vision problems display a kind of conditional independence property that allows a large problem to be decomposed into a sampling/resampling problem (e.g. Section 3, and Ioffe and Forsyth, 1999). Acknowledgments This research was supported in part by a grant from Adobe systems, in part by an NSF Fellowship to SI, in part by an NSF Digital Library award (NSF IIS 9817353). The hotel sequence appears courtesy of the Modeling by Videotaping group in the Robotics In- stitute, Carnegie Mellon University. Thanks to Stuart Russell for pointing out the significance of MCMC as an inference technique. Note 1. We are indebted to Andrew Zisserman for this suggestion. --R Structural image restoration through deformable templates. Bayesian computation and stochastic systems. Visual Reconstruction. Bayesian colour constancy. A spatial processor model for object colour perception. Bayes and Empirical Bayes Methods for Data Analysis. Improved particle filter for non-linear problems The theory and practice of bayesian image labeling. Simulated annealing-an annotated bibliography Modeling and rendering architecture from photographs: A hybrid geometry- and image-based approach Structure from motion without correspondence. Sequential Monte Carlo Methods in Practice. Hybrid monte carlo. Approximating Integrals via Monte Carlo and Deterministic Methods. What can two images tell us about a third one? 3d reconstruction of urban scenes from image sequences. Colour in perspective. Random sample consensus: A paradigm for model fitting with application to image analysis and automated cartography. A novel algorithm for colour constancy. Is machine colour constancy good enough? The Joy of Sampling 133 Gamerman Inference from iterative simulation using multiple sequences. Bayesian Data Analysis. Stochastic relaxation Markov random field image models and their application to computer vision. Evaluating the accuracy of sampling based approaches to the calculation of posterior moments. Likelihood inference for spatial point processes. Strategies for improving mcmc. Introducing Markov Chain Monte Carlo. Introduction to markov chain monte carlo. Using simulated annealing to solve routing and location problems. Automatic 3d model building from video sequences. Reversible jump markov chain monte carlo computation and bayesian model determination. Mcmc in image analysis. Tutorial in pattern theory. General Pattern Theory. Multiple View Geometry. Automatic symbolic traffic scene analysis using belief networks. Finding people by sampling. The Markov chain Monte Carlo method: An approach to approximate counting and integration. Vehicle segmentation and classification using deformable templates. Stochastic simulation algorithms for dynamic probabilistic networks. Lightness and retinex theory. Method for computing the scene-illuminant chromaticity from specular highlights Markov Random Field Modeling in Computer Vision. A computational model of color constancy. Linear models of surface and illuminant spectra. The EM Algorithm and Extensions. Markov chain Monte Carlo and spatial point pro- cesses A unified factorization algorithm for points Optimal approximations by piecewise smooth functions and associated variational problems. Probabilistic inference using markov chain monte carlo methods. Toward template-based tolerancing from a bayesian viewpoint A dynamic bayesian network approach to figure tracking using learned dynamic models. Bayesian model comparison via jump diffusion. The paraperspective and projective factorisation method for recovering shape and motion. Stochastic Simulation. Pattern Recognition and Neural Networks. Convergence diagnostics of the gibbs sampler. Markov chain concepts related to sampling al- gorithms Robust Regression and Outlier Detection. Numerical Hamiltonian Problems. Perceptual organization using bayesian networks. Automated design of bayesian perceptual inference networks. Object localization by bayesian correlation. Introduction to general state-space markov chain theory Shape and motion from image streams under orthography: A factorization method. The development and comparison of robust methods for estimating the fundamental matrix. Robust computation and parametrization of multiple view relations. Complexity and Information. Factorization methods for projective structure and motion. Stochastic computation of medial axis in markov random fields. Integrating bottom-up/top- down for object recognition by data driven markov chain monte carlo --TR --CTR Chenyu Wu , Ce Liu , Heung-Yueng Shum , Ying-Qing Xu , Zhengyou Zhang, Automatic Eyeglasses Removal from Face Images, IEEE Transactions on Pattern Analysis and Machine Intelligence, v.26 n.3, p.322-336, March 2004 Zhuowen Tu , Song-Chun Zhu, Parsing Images into Regions, Curves, and Curve Groups, International Journal of Computer Vision, v.69 n.2, p.223-249, August 2006 Jens Keuchel , Christoph Schnrr , Christian Schellewald , Daniel Cremers, Binary Partitioning, Perceptual Grouping, and Restoration with Semidefinite Programming, IEEE Transactions on Pattern Analysis and Machine Intelligence, v.25 n.11, p.1364-1379, November David A. Forsyth , Okan Arikan , Leslie Ikemoto , James O'Brien , Deva Ramanan, Computational studies of human motion: part 1, tracking and motion synthesis, Foundations and Trends in Computer Graphics and Vision, v.1 n.2, p.77-254, July 2006
colour constancy;structure from motion;Markov chain Monte Carlo
598491
Dense Features for Semi-Dense Stereo Correspondence.
We present a new feature based algorithm for stereo correspondence. Most of the previous feature based methods match sparse features like edge pixels, producing only sparse disparity maps. Our algorithm detects and matches dense features between the left and right images of a stereo pair, producing a semi-dense disparity map. Our dense feature is defined with respect to both images of a stereo pair, and it is computed during the stereo matching process, not a preprocessing step. In essence, a dense feature is a connected set of pixels in the left image and a corresponding set of pixels in the right image such that the intensity edges on the boundary of these sets are stronger than their matching error (which is the difference in intensities between corresponding boundary pixels). Our algorithm produces accurate semi-dense disparity maps, leaving featureless regions in the scene unmatched. It is robust, requires little parameter tuning, can handle brightness differences between images, nonlinear errors, and is fast (linear complexity).
Introduction Stereo correspondence is one of the oldest problems in computer vision, with numerous applications. Due to noise and image structure, establishing correspondence is an ambiguous task. The very first designers of stereo algorithms recognized this fact. A way to disambiguate the problem is to make additional assumptions about the data. One natural assumption made implicitly or explicitly by most stereo algorithms is that disparity varies smoothly almost everywhere except the object bound- aries. This assumption leads to a variety of quite distinct algorithms but with the following common princi- ple. The disparity a pixel gets assigned should be influenced by the neighbors of that pixel, that is image pixels should cooperate in the stereo computation. Stereo algorithms differ not only in the way they encode cooperation among pixels, but also in how much of the image data is used. When designing a stereo algo- rithm, one soon discovers that the textured regions in a scene are relatively easy to match (although not in the case of repeated texture), while textureless regions are hard to match accurately. Stereo algorithms roughly break down into two groups, depending on whether they match textureless regions or not. The first approach is generally called feature based. See [16, 9, 17, 19, 22] for some examples. In this approach, only the "feature" pixels are detected and matched. These are the physically significant image pixels, such as intensity edges or corners. Textureless regions are left unmatched. The motivation is that the pixels in textureless regions cannot be matched reliably anyway. The advantage of the feature based methods is that they produce accurate results. The results are rather sparse, though. Many applications require dense mea- surements, and measurement interpolation is a difficult problem in itself. Feature based methods were especially popular in the early days of computer vision because image quality was generally poor and so comparing the raw image intensities of pixels was not a reliable measure for the likelihood of their correspondence. The second approach is to match all (or almost all) image pixels to produce dense disparity estimates. The intuition is that by propagating disparity estimates from the high texture areas, the disparity in low texture areas can be inferred. The requirement of dense disparity estimates in many applications and the improvements in image quality lead to a greater popularity of the dense stereo algorithms in the recent years. We briefly summarize dense stereo algorithms in section 2. For a comprehensive overview and comparison of dense stereo correspondence methods, see [25, 24]. The motivation behind the sparse stereo methods is that only the pixels in the textured image areas can be matched reliably. The motivation behind the dense stereo methods is that all or almost all image pixels can be matched (some dense algorithms attempt to explicitly Figure 1. An artificial stereo pair. Textureless square in front of textureless background. Disparity of the square is easy to determine, while the disparity of the background is ambiguous. detect and leave unmatched the occluded image pixels). The reality might be a mixture of the two assumptions. That is the disparity of textureless regions can be recovered in some cases, but not the others. Consider an artificial example in Figure 1. This stereo pair shows a bright textureless rectangle on a dark textureless background. The square shifts by several pixels to the left between the left and the right images of this stereo pair. Even though the square completely lacks texture, its disparity is easy to determine. The edges of the square give us a clear cue for matching. However most people would agree that the disparity of the background cannot be determined with any certainty. We propose a new approach to stereo correspon- dence. The view that we will hold is that not all regions of a stereo pair can be matched reliably. Thus our aim is to detect only those regions of a stereo pair which are easy to match accurately. We will call such regions dense features. For example in Figure 1 the central square in both images should be a good candidate for a dense feature. In essence, a dense feature is a connected set of pixels in the left image and a corresponding set of pixels in the right image such that the intensity edges on the boundary of these sets are stronger than their matching error (which is the difference in intensities between corresponding boundary pixels). We give our motivation behind this informal definition of dense features in Section 3. For now notice that our dense features are defined with respect to both images of the stereo pair overlapped at some disparity. Thus each dense feature has some disparity attached. After all dense features are computed, pixels that belong to some dense feature get assigned the disparity of that dense feature. We only need to disambiguate disparity assignment for pixels which belong to more than one dense feature. Due to descriptiveness of the dense features, there is not a lot of ambiguity. Purely local, and therefore efficient disambiguating step works well enough. Each pixel which happens to be in more than one dense feature chooses the disparity of the feature which is "densest" with respect to that pixel. This procedure is described in Section 4.4. Our approach is only superficially similar to the previous feature based methods. Most of the previous feature based algorithms match thin structures like edge pixels or corners, producing only sparse results. In ad- dition, matching with thin features still presents a lot of ambiguities. Our dense features have several advantages over the previously used features. The first obvious advantage is that the disparity maps we produce are semi- dense, that is we match more pixels. The second advantage is that our dense features help to reduce ambiguities in correspondence because their structure is more descriptive. Other advantages are that unlike the previous feature based methods, the detection of our dense features is an integral part of the algorithm, not a pre-processing stage. Furthermore, the threshold to detect a feature is adaptive, it depends on how noisy are the pixels being matched. Besides feature-based approaches, our algorithm is similar to segmentation based stereo. Our dense features can be thought of as the appropriate segments to match. However segmentation of dense features is an integral part of our stereo algorithm, not a separate preprocessing stage. Another algorithm we share some similarities with is the variable window algorithm [3]. In [3] a set of connected components or "windows" is computed at each disparity. These connected components contain only the pixels for which that disparity is likely. The disparity which gives the largest window is assigned to each pixel. Our dense features can also be looked at as windows. However [3] is not robust, its windows can grow to include many pixels which do not in fact belong to the disparity of the window. The boundary condition that we enforce helps to avoid this problem in our dense features Some dense stereo algorithms [12, 30] compute a confidence or certainty map. This maps assigns to each pixel the confidence in its disparity estimate. Thresholding disparity estimates at some confidence level results in semi-dense disparity map which is presumably more accurate. It is important to compare our semi-dense algorithm with such thresholded disparity maps, which we do in section 5.2. However a confidence map is usually a byproduct of the correspondence algorithm, and we found that thresholding it does not necessarily improves the results significantly. Our algorithm has many good properties. Its complexity is linear in the number of pixels times the number of disparities searched, so it is very fast, taking 1 second for smaller images and 7 seconds for larger images. It is even more efficient in its memory usage, which is linear in the number of pixels. It produces accurate results as tested by real data with ground truth, see Section 5. It can handle brightness differences and monotonic errors in intensities between the regions being matched. Even though it is feature based, a large percentage of pixels is matched, from 40 to 95 percent in our experiments. The exact percentage of the pixels matched depends on the particular imagery, of course. Occlusions do not need to be handled, since most of the occluded pixels do not belong to any dense feature. Our parameters have intuitive meaning, and we do not tune them separately for each stereo pair. The algorithm can handle not only homogeneous regions but also repeated texture regions. We do not need to produce a separate "uncertainty" map for the disparity map. Only the "certain" pixels, that is pixels belonging to some dense feature are assigned a disparity This paper is organized as follows. We start by discussing related work in Section 2. In Section 3 we describe the motivation behind our dense features. In Section 4 we explain how we compute and choose among the dense features. We conclude with experimental results in Section 5. Related Work In this section we briefly sketch most common dense approaches to stereo correspondence. These methods must deal with textureless regions. The basic idea behind all of them is to encourage "cooperation" among pixels, so that pixels in textureless regions get assigned smoothly varying disparities. We roughly divided such methods in a few groups below, according to the way they encode cooperation among pixels. Area correlation methods [18, 21, 8] assume that a pixel is surrounded by a window of pixels with the same disparity, and windows of pixels are matched. Cooperation is encouraged because close-by pixels are matched with only slightly different windows, and thus are likely to be assigned the same disparity. However choosing an appropriate window is a difficult problem, only a few researchers have addressed it [12, 6, 14, 28, 20]. Area correlation methods produce dense stereo maps, but can be quite unreliable not only in homogeneous regions, but also in textured regions for an inappropriately chosen window size. Cooperative methods [15, 30] directly encourage nearby pixels to cooperate by local iterative schemes which propagate information from a pixel to its neigh- bors. Energy minimization methods [1, 7, 10, 4, 23] also directly promote cooperation but use global opti- mization. They design and minimize energy functions which reward smooth or almost smooth disparity maps. The cooperative and energy minimization methods frequently have parameters which are difficult to set, and they tend to be inefficient. Another drawback is that it may still be difficult to assess whether a homogeneous region was assigned the correct disparity, since in some cases all pixels in a homogeneous region may be assigned the same, but nevertheless wrong disparity. In the last group are the segmentation based meth- ods. Their underlying idea is to use the results of an image segmentation algorithm to locate regions which are likely to belong to the same object, and match those regions [5, 13, 26, 27], The actual details vary significantly between these algorithms. Finding good regions to match through image segmentation is, of course, a difficult problem. 3 Dense Features for Stereo Correspon- dence In this section we give motivation behind our dense features and describe them in detail. There are two main questions in designing dense features. First we need an intuitive understanding of what kind of properties make some region a good candidate for a dense feature. That is what kind of region is easy to match reliably. Secondly we need to transfer this intuition into a computationally feasible solution. Our answer to the first question is as follows. Clearly the presence of intensity edges on the boundary of a region gives a good cue for matching and we want to incorporate this cue in a dense feature. When dealing with intensity edges, the usual problem is the selection of an appropriate threshold. The threshold should be above the noise level for a good performance. For stereo cor- respondence, there is a natural way of estimating when an intensity edge is strong enough. It is strong enough if the intensity difference on the edge is larger than the error of matching the edge pixels. Thus our dense feature is a connected set of pixels in the left image and the corresponding set of pixels in the right image with intensity boundaries stronger than the error of matching the boundary pixels. We call this the "boundary" condi- tion, and it is the main enabling idea of our algorithm: the intensity change on the boundary must be more significant than the noise level of the pixels being matched, otherwise the boundary does not carry any useful infor- mation, its significance is destroyed by noise. Consider an example in Figure 2. The first two columns are a stereo pair consisting of a foreground object (a square with a hole) in front of a background. The intensity of the foreground is 170, and the intensity of the background is 140. The background and the foreground are corrupted by N(0; 25) noise. The noise is strong, but it is not strong enough to destroy the edges of the foreground object in the left and the right images, and these edges give us a good cue for correspondence. The disparity of the foreground is 10. Consider the error surface at disparity 10, where the error surface is just the absolute difference between the left and the right images overlapped at disparity 10. We marked with bright color all pixels in this error surface where the error is smaller than the edge strength at that pixel. The resulting image is shown in the last column of figure 2. Observe that the foreground region is surrounded by the bright edges. Thus we are now facing the problem of segmentation, where the task is to segment a region surrounded by the bright edges. We actually detect dense features not in the error sur- face, but in another surface. Recall that our boundary condition for dense features says that the intensity change on the boundary must be greater than the error on the boundary. Notice that this definition treats the boundary pixels differently from all the other pix- els, thus enabling efficient detection of dense features. However if we apply the boundary condition to the error surface, then we are checking only that the boundary pixels form good matches at the disparity in question. If due to image structure and noise we find some false "good" boundary in the error surface, all the pixels inside are automatically matched, even if these pixels contain two completely unrelated textures in the left and the right images. To avoid the problem described in the previous para- graph, we apply the boundary condition to a surface which we call the match surface. The match surface at disparity d is set to 1 for pixels that are likely to have disparity d and it is 0 otherwise. When enforcing the boundary condition, dense features are allowed to consist only of pixels which are set to 1 in the match surface. Thus not only the boundary pixels have to be checked as a good match, but also the pixels inside the boundary. We want to allow for significant brightness changes between the corresponding regions, and thus pixels which differ in intensity significantly should be allowed to match. At the same time we wish to exclude from consideration regions with unrelated textures. Setting the match surface to 1 for smoothly varying regions of the error surface seems to work well for achieving these two purposes simultaneously. Section 4.2 explains how we compute the match surface in details. We now come to the second question, which is how to compute the dense features. We do not have a very good answer to this question, it is a topic for further im- provements. Ideally we need dense features which can overlap several disparities, since a textureless region can straddle many disparities. Also we would like to use a good contour based segmentation algorithm. Currently though we have only experimented with a very simple segmentation approach and only search for dense features which do not overlap several disparities. Furthermore we only test the left and the right boundaries of a region satisfy the "boundary" condition. Even with such a naive approach to dense feature computation we achieve impressive results, see Section 5. This give us some evidence that we are pursuing a useful direction in stereo correspondence. Here is our current simple approach to segment a dense feature from the match surface. We independently prune the left and right boundary of the match surface until what remains satisfies the boundary con- dition. Then we compute connected components in the pruned match surface, and these connected components are our dense features. This algorithm is explained in details in Section 4.3. 4 Description of the Dense Feature Stereo Algorithm In this section we give a complete description of our dense feature based stereo algorithm. We assume that the images are rectified so that the epipolar lines are the scanlines. We search in the disparity range is the maximum possible disparity, the only parameter provided by the user in our implementation. Right now we search with pixel pre- cision, that is only integer disparities d are considered, although the algorithm is easily extended to search in the subpixel range. The algorithm is organized as follows. We cycle through all d g. For each d there are four main steps. First we overlap the left and the right images at disparity d, and compute the error surface, see Figure 2. Square with a hole in front of background stereo pair. The last image shows in white the pixels at the disparity of the foreground for which the matching error is less than edge intensity at that pixel. for all pixels p do for do 1. Compute the error surface E(d; p) 2. Compute the match surface M(d; p) from E(d; p) 3. Find dense features ff 1 d g in M(d; p) 4. for for d do else if density(f i Figure 3. Overview of the algorithm. Section 4.1. The second step is to compute the match surface, see Section 4.2. The third step is to find all the dense features ff 1 d g in the match surface, see Section 4.3. The last step is to go through all d and assign disparity d to p if the disparity of p is still uninitialized, or if f i d is "denser" for pixel p than f j where d 0 is the current disparity assigned to pixel p and is the feature containing p at disparity d 0 . Note that this "density" can be different for distinct pixels of the same dense feature, that is density is a function of pixel. The importance of this property will be explained later. This final step is in Section 4.4. The summary of our algorithm is in Figure 3. 4.1 First Stage: Computing the Error Surface In this section we explain how we find the error sur- us denote the intensity of pixel p in the left image by L(p) and the intensity of pixel p in the right image by R(p). We will use notation E(d; p) for the error surface at disparity d and pixel p. To compute the error surface, we need a similarity measure between pixel p in the left image and pixel p d in the right image, where p d is the pixel with coordinates of p shifted by d to the right. We will keep the sign of that difference, because we will need it for the match surface computation. Our error surface E(d; p) has two components, namely E r (d; p) and E s (d; p). The first component just measures the difference in intensities between the two images, that is However even in the absence of noise, E r (d; p) measure is not accurate for pixels overlapping a surface with rapidly changing intensity when the pixel's true intensity is not integer. This happens because of image sampling artifacts, see [2] for more details. Computing disparity at subpixel accuracy helps to solve this problem, but as [2] points out, the additional computation time may not be worth it. Instead we use the method in [2] to construct the the second component of error surface E s (d; p) to be insensitive to image sampling. First we define ^ R as the linearly interpolated function between the sample points on the right scanline, and then we measure how well the intensity at p in the left image fits into the linearly interpolated region surrounding pixel p d in the right image e l q2[p d 1;p d+ 1] R(q)j: For symmetry, e r d) is the symmetric measure of similarity between pixels p in the left image and pixel p d in the right image: d d (p) Here sign() is the sign function, we use it to retain the right sign of the error surface. 4.2 Second Stage: Computing the Match Sur- face With the error surface defined, we are ready to compute the binary match surface. We denote this surface for disparity d and pixel p by M(d; p). At this stage, we want to set M(d; pixels for which disparity d might be the right disparity, and set M(d; for the rest of pixels. Left and right images of a stereo pair sometimes have significant brightness differences, due to different camera gains or changed light conditions, for example. We want to allow pixels with significant brightness difference to match, provided that nearby pixels experience similar brightness differences. At the same time we need to exclude the unlikely matches from the match surface. To satisfy these two goals simultaneously, we detect the regions in the error surface with smoothly varying er- rors, and set the match surface to 1 for those regions. This way we allow matching only between two regions differing by a smooth surface. For example matching between two regions with smoothly varying or constant intensities is allowed, even if these regions are of different brightness, as long as the difference surface is smooth. Matching a smoothly varying region with a textured region is not allowed, and matching between two regions with different textures is also not allowed. The algorithm to compute the match surface is in Figure 4. We start by initializing the match surface to 0. Then we sort all pixels in order of increasing E s (d; p). It can be done in linear time since the range of E s (d; p) is small. The next step is to go over all pixels p in order of increasing E s (d; p) and set M(d; either of two conditions hold. First condition is that M(d; for all nearest neighbors q of p, where the nearest neighbors of p are just the pixels above, to the left, to the right, and below p. We denote the nearest neighbors of p by N p . This condition initializes some "seeds" from which to grow the match surface. It makes sense to take the pixels with the smaller errors for the seeds, that is why we The second condition is that if M(d; then the distance between the two intervals . This condition makes sure that all the regions which are set to 1 in the match surface correspond to smoothly varying error surface. Notice that we use intervals of values instead of using just E r (d; p) or p). The reason for using the whole interval is that due to the image sampling error we do not know where the matching error lies within this interval, we just know that it is somewhere in the interval. Using an interval works better in image regions with rapidly changing intensity The value of is related to the noise level in the im- ages. However we found that in the imagery we experimented with, larger errors occur in textured regions, and are related to the image sampling artifacts rather, than to the camera noise. We set all the experiments. This value might seem rather small, but keep in mind that this is not the largest matching error that we allow, rather it is the largest difference between matching errors that we allow. Thus the two matched regions can differ significantly in intensity, but this difference must be smooth. In textured regions two neighboring pixels may have significantly different errors not explained by just the smooth brightness differences between the regions. However in textured regions the interval larger than in the low textured regions, and larger intervals are more likely to overlap. Thus this value of works well even in the textured regions In practice, of course, there are always a few pixels which do not obey our assumptions. To deal with these pixels, we compute connected components in the matching surface and patch all holes of small size, which we set to 5 in our implementation. The reason for 5 is the some pixel has an error not handled by our assumptions, it can lead to a wrong choice for its 4 nearest neighbors. 4.3 Third Stage: Detecting Dense Features In this section we explain how we find dense features in the match surface. Recall that to locate a dense fea- ture, we need to find a region in the match surface which satisfies our boundary condition, that is the boundaries must be on intensity edges larger than the error sur- This implies that we can match only regions where change in disparity occurs together with a change in in- tensity. In reality, of course, there are frequently uniform surfaces which straddle several disparities. To deal with such surfaces, we need to detect features which straddle several disparities. We plan to do so in the fu- ture, see section 6. However in the current implementa- tion, we can deal with some of such uniform surfaces by for all p Sort p in the order of increasing E s (d; p) for all p in order of increasing E s (d; p) do if M(d; else if 8q 2 N p s.t. M(d; Figure 4. Algorithm to compute the match surface at disparity d. for all p s.t. M(d; while jE r (d; p) avr(p; d)j d) R(p d 1)j do Figure 5. Algorithm to prune the left boundary. enforcing our boundary condition only on the left and right boundaries of a region. We do not enforce it on the top or the bottom boundary. Thus we can at least match low-texture surfaces sloping horizontally, like the ground plane. Recall that we have an interval [E s (d; for the error surface. So we have a choice of which value in this interval to use when applying our boundary con- dition. We chose E r (d; p) because it is the larger of the two and thus gives a more conservative estimate. We begin by pruning pixels on the left boundary of the match surface until the error of pixels on that boundary is smaller than the intensity edge on that boundary in the left and the right image. However we also want to correct for the brightness differences between the im- ages. Therefore we subtract the average brightness difference around pixel p in the left image and pixel p d in the right image from E r (d; p). We denote this difference by avr(p; d), and it is computed in the 3 by 3 window, that is if W p is the 3 by 3 window around p, then d) =9 The algorithm to prune the left boundary is given in Figure 5. We begin by taking some pixel p which does not satisfy our boundary condition. That is p is in the match surface, pixel to the left of p is not in the match surface, and jE r (d; p) avr(p; d)j + is larger than the intensity boundary between p and p 1 in the left image or jE r (d; p) avr(p; d)j + is larger than the intensity boundary between p d and p d 1 in the right image. 1 We remove such p from the match sur- face, that is we set M(d; we continue this pruning process until all left boundary pixels p satisfy the boundary condition. Notice a new parameter , which we set to 5 for all our experiments. This is the second and the last significant parameter of our algorithm. It is used to make sure that the intensity on the boundary is not only larger, but significantly larger (by ) than the error on the bound- ary. The value of should be above the noise level, that is above , but the best choice for both parameters is a topic for future research. We do similar pruning for the right boundary. Since we treat each scanline independently for the dense feature detection, there may be some inconsistencies between the horizontal intervals of our dense feature. That is a few horizontal lines may stick in and out our dense feature. In principle, a better way to extract a dense feature from the match surface would be to use some boundary extraction algorithm, for example the one in [11, 29]. However even our simple algorithm works quite well with the following filtering step. If pixel p is in a dense feature f d , but the pixels above and below p are not in f d , then p is also removed from f d . Also if pixel p is not in f d , but pixels above and below p are in f d then p is also placed in f d . After the filtering step, we find connected components in the pruned match surface, and remove compo- 1 Notice that the left and the right images are treated in the same way by our algorithm nents less than some minimum size, which we set to 25. The rest of the connected components are our dense features Figures 6(a,b) show the match surface and the dense features at disparity 14 for the scene in Figure 9(a). This is the correct disparity of the lamp. Pixels for which the match surface is 1 and pixels which belong to a dense feature are shown with bright intensity. Notice that the match surface is 1 for the majority pixels in the scene. However the match surface is 0 for the majority of the intensity edges for which the correct disparity is other than 14. That is why when the match surface is pruned using our "boundary" condition, most of the pixels are not in any dense feature. The remaining regions correspond to the lamp, few regions of repeated texture, and few spurious small regions. Unfortunately, we loose most of lamp handle because the intensity edge there is not strong enough. 4.4 Forth Stage: Choosing Dense Features Some pixel p can be a part of two dense features (no- tice that these features are at different disparities, since dense features at the same disparity do not overlap). One reason is repeated texture. Consider Figure 7(a). This is a cut out of a repeated texture region from the scene in Figure 9(a). This region are the books right above the lamp. Figures 7(b,c) shows dense features for this region at the wrong and the right disparities, respectively. Pixels which belong to a dense feature are shown in bright color, pixels which do not belong to any dense feature are shown in black color. Notice that for the right dis- parity, all the pixels are in a dense feature. Thus the feature at the right disparity is "denser" for the pixels which have a choice of features. However most often features overlap is due not to repeated texture. It happens because we do not enforce the boundary condition on the top and the bottom border. This allows some dense feature to be joined by a few extra regions, usually fairly small. Consider Figure 8(a). It shows a region occupied by a corner of the soda can to the right and slightly above the lamp in Figure 9(a). The background has texture due to the wall poster. Figure 8(b) shows the dense feature at the disparity of the soda can. The can grabbed a thin horizontal region due to the wall texture. Figure 8(c) shows dense feature at the correct disparity for that thin wall region. Notice that the correct disparity is "denser" for that region. Now we will formalize what we mean by "denser". We need to estimate how many pixels are there in the immediate surrounding of p in a dense feature. We found the following definition of density to work well in practice. Let M(d; p) be the match surface, and let H nw (d; p) be Manhattan distance from p in the north west direction to the nearest pixel q such that M(d; can be computed in one pass over the image for all pixels p. Similarly define H ne , H sw , and H se to be the Manhattan distance from p to the nearest pixel q such that M(d; q)=0 in the north east, south west, and south east directions. If f i d is a feature at disparity d containing p, then ne +H nw +H sw +H se : Notice that density(p; f i d ) can be different from d ). This is important since in many cases some pixels of a dense feature do belong to the disparity of that dense features while others do not. With this definition of density, it is possible to break off the wrong pixels from the dense feature in the final assignment, while leaving the other pixels. With this definition of density, the regions in Figures 7 and 8 are placed at the correct disparities, as can be checked in Figure 9. 5 Experimental Results In this section we present our experimental results on real stereo pairs, several of which have known ground truth. For all the experiments, the parameters were fixed as follows: set to 25. On the disparity maps, brighter pixels have larger disparity. Pixels for which no disparity was found (that is the pixels which do not belong to any dense fea- ture) are in black. 5.1 Handling of Nonlinear Errors Before presenting our experimental results, we describe the last component, which is the handling of non-linear errors in stereo imagery. In finely textured regions when the baseline between cameras is large, the noise is highly non linear. For such regions, even the sampling insensitive error measure does not help. However we can use another error measure developed in [28], which seems to work well in textured regions. The basic idea is that intensity monotonicity is preserved in these regions, and it should be exploited instead of raw image intensities. Let us measure local differences in intensities, retaining only their signs and not the magnitude. We define functions sgn l (p), sgn r (p), sgn a (p), and sgn b (p) as follows: stands for the pixel to the left, right, above, or below of p if correspondingly. (a) match surface at dense features at Figure 6. Comparison of match surface and dense features (a) left image (b) wrong disparity (c) right disparity Figure 7. Dense feature overlap due to repeated texture (a) left image (b) disparity of the can (c) disparity of the wall Figure 8. Dense feature overlap due to spurious texture (a) left image (b) ground truth (c) our algorithm Figure 9. Real imagery with dense ground truth Functions sgn l (p d), sgn r (p d), sgn a (p d), and sgn b (p d) are defined similarly on the right image. Now define i2fl;r;a;bg where d) measures how well signs of local variations match around p in the left image and p d in the right image. This is robust to all monotonic nonlinear changes. Notice that if the argument to function f is larger than 2, less than three of sgn i functions match, so the use of E t (d; p) is unreliable and it is set to 0. This is expected in areas of low texture. We use E t (d; p) at a stage separate from the stage where we use the interval [E s (d; second stage is for detecting textured regions effected by nonlinear errors which might have been missed, and it follows the stage we have described in Section 4. Only now E t (d; p) is used instead of the interval This second stage for detecting textured regions is even simpler, since E t (d; p) takes on binary values. That is after E t (d; p) is computed, we find dense features in it directly without computing the match surface. The value of is also set to 5, as in the first stage. 5.2 Tsukuba Stereo Pair Figure 9(a) shows the left image of a stereo pair from the university of Tsukuba. For this stereo pair the dense ground truth is known, and it is in Figure 9(b). The disparity map our algorithm computes is shown in Figure 9(c). The size of these images is 384 by 288, maximum disparity we search is 14. The running time is 1 sec, and 66% of pixels are matched. The three largest regions which our algorithm leaves unmatched are the upper right corner, the lower right corner, and the upper part of the region under the table, which are textureless. Some parts of on the table are also not matched. Out of the pixels that we match, 3.78% are found in- correctly, and 0.38% are off by not more than 1 pixel from the correct answer. The absolute average error is 0.06. This is the best performance out of the all the dense stereo algorithms compared in [24]. However direct comparison with the dense stereo algorithms is not fair because we only find a semi-dense disparity map. There is a better way to compare our algorithm with the dense stereo algorithms. Some dense stereo algo- matched pixels % 1 errors % total errors 48 1.35 16.49 87 2.31 24.32 Figure 10. Percentage of matched pixels versus errors for the compact window algorith rithms compute a certainty map. A certainty map assigns higher numbers to pixels with higher confidence of their disparity estimate. There are many ways to compute a certainty map. One way is to assign high confidence to pixels with better matching scores. Another way is to assign high confidence to pixels if their estimated disparity has a narrow peak in the plot of matching cost versus disparity. In other words these are the pixels with a unique disparity giving better matching costs. These pixels typically lie in areas of high tex- ture. We will threshold the certainty map and compare the percentage of matched pixels versus errors for some dense algorithms. We have tried two methods of computing confidence maps for the dense stereo methods. First we tried to count only the disparity estimates from regions with high texture. This method can be used on a disparity map from any dense stereo algorithm, and we tried it on the graph cuts method in [4]. However that did not seem to give significant improvements in error counts. Then we tried to threshold disparity map to leave only the pixels with the better matching score. We applied this thresholding to area correlation methods. We chose the compact window algorithm [28] because it performs reasonably well out of area correlation algorithms 2 . The results are summarized in figure 10. For the smaller percentage of pixels matched, the results do indeed im- prove, but at the same percentage of pixels matched as in our dense feature algorithm, which is 66%, our algorithm still performs significantly better. 5.3 Two Planes Stereo Pair Figure 12(a) shows the left image of another stereo pair for which the dense ground truth is also known. This stereo pair is from Microsoft. Figures 12(b,c) show See comparison of dense stereo methods at http://www.middlebury.edu/stereo/eval/results.html the ground truth and our answer, respectively. The image sizes are 284 by 216, and the maximum disparity we search for is 29. The running time was 2 seconds, with 87% of pixels matched. Since the ground truth was computed for the right image, we also computed our answer for the right image. Notice that the black region on the right is not matched, this region corresponds to the occluded pixels. Only four small regions which should be occluded are matched erroneously. Out of the pixels which our algorithm matches, 18.50% are matched in- correctly, 0.22% are off by not more than one pixel from the correct disparity. 5.4 Other real imagery with ground truth Recently D. Scharstein and R. Szeliski have collected an impressive database of several stereo sequences for which they were able to compute the dense ground truth 3 . This database should become a long needed benchmark for testing stereo algorithms. The results our algorithm gives on this new data base are summarized in the table in figure 11. Image sizes are 431 by 381, and the largest disparity we search for is 21. 5.5 Birch Stereo Pair Figure 13(a,b) shows the left and right birch tree images from SRI. The image size is 320 by 242, and the maximum disparity we searched for is 28. The running time was 2 seconds, with 41% of pixels matched. The right image is approximately 15% brighter than the left image. This difference is easily noticeable to the eyes, that is why we show both the left and the right images. In addition, the texture of the grass in the front part of the left image is almost all lost. Only the two bright spots in the very front and three bright spots further in the back retain texture, the majority of other grass pixels in the frontal half have intensity 0. This makes stereo correspondence very challenging. Our algorithm, however, successfully matches the trees and the five spots on the grass which have not lost texture. It does not match the grass which lost its texture because it cannot match the textureless regions in the left image to the textured ones in the right image. It is hard to notice in out displays, but the two trees in the front have smoothly varying dis- parity, the closer one changes disparity from 22 on the bottom to 26 on top, and the one to the left of it changes disparity from 20 to 21. If we enforced our "boundary" condition on the whole boundary, and not just on the left and the right boundary as we do now, we would not be able to get these results, due to the lack of sufficient horizontal texture on these trees. 3 available at http://www.middlebury.edu/stereo/ name 1 errors % total errors % matched running time in seconds Sawtooth 1.62 16.36 76 6 Venus 1.83 13.25 68 5 Bull Poster 1.05 7.85 77 7 Barn1 0.62 7.83 83 6 Barn2 Figure 11. Performance of our algorithm on other data with ground truth. (a) left image (b) ground truth (c) our algorithm Figure 12. Slanted planes stereo pair (a) left image (b) right image (c) our algorithm Figure 13. Birch Sequence from SRI (a) left image (b) our algorithm Figure 14. Shoe sequence from CMU 5.6 Shoe Stereo Pair Figure 14(a) shows the left image of another challenging stereo pair from CMU. The size is 512 by 480, and the maximum disparity is 14. The running time was 7 seconds, and 95% of pixels are matched by our al- gorithm. This stereo pair is difficult because of the repeated texture floor. Our algorithm was able to place almost all of the floor at the disparity 9. A manual inspection of the left and right images suggests that two plausible disparities of the floor are 9 and 3. However the disparity of the shoe varies from 13 to 11, so disparity 3 would place the floor too far, the shoe would have to float over it. So the disparity of 9 our algorithm produces is most likely right. 6 Discussion We proposed a new approach to stereo correspon- dence. The basic idea that motivates our approach is to find regions in stereo pairs which are easy to match ac- curately, and we call such regions dense features. Based on the experiments we have conducted, we think that the dense feature approach is a useful direction for future re-search Our results on the real stereo data, including the data with ground truth, show that our algorithm produces accurate results, can handle brightness differences between images, nonlinear errors, repeated texture, homogeneous image regions. It is robust with respect to pa- rameters, they do not need to be tuned separately for each stereo pair. It is also very fast and efficient with memory. The current implementation is quite simple, and there are many directions for future improvements. The biggest current limitation is that we cannot handle homogeneous sloped surfaces with slant other than hori- zontal. We plan to address this in our future work by allowing dense features to form across different dispar- ities. When we do that, we will need to check our "boundary" condition across the whole border, not just the left and right boundary as we do currently. With this extension we also plan to apply our algorithm to motion sequences. The second biggest limitation is the way we extract the dense features from the match surface. Instead of processing each scanline independently as we do now, it would be better to use a boundary extraction algorithm which is less local, for example apply the methods in [11, 29]. Another direction for future research is a comprehensive study of different phenomena which effect the error between the corresponding pixels, and the insights such study might bear on the selection of parameters and . Acknowledgments We would like to thank Prof. Y. Ohta from the University of Tsukuba, Prof. D. Scharstein from Middlebury College, and Dr. R. Szeliski from Microsoft re-search for providing the images with ground truth. --R Stochastic stereo matching over scale. A pixel dissimilarity measure that is insensitive to image sam- pling A variable window approach to early vision. Fast approximate energy minimization via graph cuts. Efficient stereo with multiple windowing. International Journal of Computer Vision Modelling the environment of an exploring vehicle by means of stereo vision. A computer implementation of a theory of human stereo vision. Globally optimal regions and boundaries. A stereo matching algorithm with an adaptive window: Theory and ex- periment Region correspondence by global configuration matching and progressive delaunay triangulation. Cooperative computation of stereo disparity. A computational theory of human stereo vision. An iterative prediction and correction method for automatic stereocomparison. Efficient registration of stereo images by matching graph descriptions of edge segments. A simple stereo algorithm to recover precise object boundaries and smooth surfaces. A flexible approach to digital stereo mapping. Stereo without epipolar lines: A maximum-flow formulation A taxonomy and evaluation of dense two-frame stereo methods An experimental comparison of stereo algorithms. Global matching criterion and color segmentation based stereo. A global matching framework for stereo computation. Stereo matching by compact windows via minimum ratio cycle. Image segmentation with minimum mean cut. A cooperative algorithm for stereo matching and occlusion detection. --TR --CTR Minglun Gong , Yee-Hong Yang, Fast Unambiguous Stereo Matching Using Reliability-Based Dynamic Programming, IEEE Transactions on Pattern Analysis and Machine Intelligence, v.27 n.6, p.998-1003, June 2005
adaptive threshold;stereo;visual correspondence;dense features
598537
A Multiphase Level Set Framework for Image Segmentation Using the Mumford and Shah Model.
We propose a new multiphase level set framework for image segmentation using the Mumford and Shah model, for piecewise constant and piecewise smooth optimal approximations. The proposed method is also a generalization of an active contour model without edges based 2-phase segmentation, developed by the authors earlier in T. Chan and L. Vese (1999. In Scale-Space'99, M. Nilsen et al. (Eds.), LNCS, vol. 1682, pp. 141151) and T. Chan and L. Vese (2001. IEEE-IP, 10(2):266277). The multiphase level set formulation is new and of interest on its own: by construction, it automatically avoids the problems of vacuum and overlap&semi; it needs only log n level set functions for n phases in the piecewise constant case&semi; it can represent boundaries with complex topologies, including triple junctions&semi; in the piecewise smooth case, only two level set functions formally suffice to represent any partition, based on The Four-Color Theorem. Finally, we validate the proposed models by numerical results for signal and image denoising and segmentation, implemented using the Osher and Sethian level set method.
partition problem of (Mumford and Shah 1989) for segmentation of images. For the implementation of the active contour model from (Chan and Vese 1999), (Chan and Vese 2001), the level set method of (Osher and Sethian 1988) was successfully used, together with a particular numerical approximation, which allowed to automatically detect interior contours. The method was then easily extended to vector-valued images (Chan, Sandberg and Vese 2000), and is robust with respect to noise. In this paper, we generalize further this active contour model (based binary segmentation), to segment images with more than two regions, by proposing a new multiphase level set framework for the (Mumford and Shah 1989) problem. We will show that, with a reduced number of level set functions, triple junctions and complex topologies can be represented. In addition, the phases used in the partition do not produce \vacuum" and \overlap". Finally, in the piecewise smooth case, based on The Four-Color Theorem, we show that only two level set functions formally should su-ce to represent any partition. The outline of the paper is as follows: in this Introduction, we give the necessary background on the main two ingredients of the method: the Mumford and Shah model and variational level sets; then, we shortly describe the most related relevant work. In Section 2, we present the proposed model in the piecewise constant case in two dimensions, while in Section 3 we consider the piecewise smooth version of the model, in one and two dimensions. Finally, in Section 4 we present numerical results for signal and image denoising and segmentation, using the proposed models, and we end the paper by a short concluding section and an appendix, with the details of the numerical algorithms. The Mumford and Shah problem Let be open and bounded. For the purpose of illus- tration, we consider for the moment the two-dimensional case, but any dimension could be considered. For instance, we will also treat the one-dimensional case in Section 3. Let C be a closed subset in made up of a nite set of smooth curves. The connected components of n C are denoted by i , such that We also denote by jCj the length of curves making up C. Let u 0 ! IR be a given bounded image-function. The segmentation problem in computer vision, as formulated by (Mumford and Shah 1989), can be dened as follows: given an observed image u 0 , nd a decomposition of and an optimal piecewise smooth approximation u of u 0 , such that u varies smoothly within each rapidly or discontinuously across the boundaries of To solve this problem, (Mumford and Shah 1989) proposed the following minimization problem: F MS (u; Z Z are xed parameters, to weight the dierent terms in the energy. For (u; C) a minimizer of the above energy, u is an \optimal" piecewise smooth approximation of the initial, possibly noisy, image u 0 , and C has the role of approximating the edges of u will be smooth only outside C, i.e. on Theoretical results of existence and regularity of minimizers of (1) can be found for example in (Mumford and Shah 1989), (Morel and Solimini 1988), (Morel and Solimini 1989), (De Giorgi, Carriero, Leaci 1989), (Morel and Solimini 1994). A reduced case of the above model is obtained by restricting the segmented image u to piecewise constant functions, i.e. inside each connected component . Then the problem is often called the \minimal partition problem", and in order to solve it, in (Mumford and Shah 1989) it is proposed to minimize the following functional: MS (u; Z It is easy to see that, for a xed C, the energy from (2) is minimized in the variables c i by setting in Theoretical results for existence and regularity of minimizers of (2) can be found for example in (Mumford and Shah 1989), (Massari and Tamanini 1993), (Tamanini 1996), (Tamanini and Congedo 1996), (Leonardi and Tamanini 1998). It is not easy to minimize in practice the functionals (1) and (2), because of the unknown set C of lower dimension, and also because the problems are not convex. After giving the necessary background on the level set method, we will review some alternative solutions to this problem, and other related relevant models for image segmentation, before presenting the proposed level set formulations. The level set method and variational level sets (Osher and Sethian 1988) proposed an eective implicit representation for evolving curves and surfaces, which has found many applications, because it allows for automatic change of topology, such as merging and breaking, and the calculations are made on a xed rectangular grid. W-w Figure 1: A curve, given by the zero level set of the function , is the boundary between the regions: A given curve C (the boundary of an open set ! 2 i.e. represented implicitly, as the zero level set of a scalar Lipschitz continuous function (called level set function), such that (see Fig. 1): in A typical example of level set function is given by the signed distance function to the curve. Using this representation, geometrical quantities, properties and motions can be expressed. Indeed, using the Heaviside function H(z), equal with 1 if z 0 and with 0 if z < 0, the length of C and the area of ! can be expressed respectively by (Evans and Gariepy 1992): Z Z H()dxdy (3) (we mention that the rst integral is in the sense of measures). Considering any C 1 (IR) approximation and regularization H " of the Heaviside function as " ! 0, and denoting by " (an approximation to the one-dimensional Dirac delta function - 0 ), we can approximate the length functional by L " R R ()jrjdxdy, and the area functional by A " R Then we can formally write the associated Euler-Lagrange equations, obtained by minimizing the above functionals with respect to , and parameterizing the descent directions by an articial time t, respectively (with associated initial @ @t r or @ @t A standard rescaling can be made, as in (Zhao et al. 1996), by replacing - " () by jrj, giving the following equations, already introduced in (Osher and Sethian 1988) in the context of the level set theory: @ @t r or @ @t (motion by mean curvature minimizing the length, and motion with constant speed minimizing the area). Here, r jrj represents the unit normal to a level curve of at every point, and div r represents the curvature of the level curve. For more recent and general expositions on the level set method and applications, we refer the reader to (Sethian 1999) and (Osher and Fedkiw 2001), (Osher and Fedkiw, to appear). Theoretical results of existence, uniqueness, and regularity of the front for the equations from (4), in the sense of viscosity solutions, can be found in many papers, for instance in (Barles 1994) for Hamilton-Jacobi equations, and in (Evans and Spruck 1991), (Chen, Giga and Goto 1991), (Crandall, Ishii and Lions 1992), or more recently in (Barles and Souganidis 1998), for generalized mean curvature ow equations and evolution of fronts. Related relevant work for image segmentation We brie y mention here some of the most related relevant works, and we discuss their connections or dierences with our approach. The weak formulation of the Mumford and Shah problem and approximations A weak formulation of (1) has been proposed in (De Giorgi and Ambrosio 1988), and studied in (Dal Maso, Morel and Solimini 1992), where C is replaced by the set J u of jumps of u, in order to prove the existence of minimizers (it is known that a global minimizer of (1), or of the weak formulation, is not unique in general). In (Morel and Solimini 1988), (Morel and Solimini 1989), the authors proposed a constructive existence result in the piecewise-constant case, and in (Koep er, Lopez and Morel 1994), a practical multi-scale algorithm based on regions growing and merging is proposed for this case. For a general exposition of the segmentation problem by variational methods, both in theory and practice, we refer the reader to (Morel and Solimini 1994). We also refer to (Ambrosio 1989) for theoretical results on functionals dened on the appropriate space for image segmentation: the space of special functions of bounded variation. Two elliptic approximations by -convergence to the weak formulation of the Mumford-Shah functional have been proposed in (Ambrosio and Tortorelli 1990), (Ambrosio and Tortorelli 1992). They approximated a minimizer (u; J u ) of F MS (u; J u ), by two smooth functions (u in the L 1264 ology, and v is dierent from 1 only in a small neighborhood of J u , which shrinks as ! 0. The elliptic approximations lead to a coupled system of two equations in the unknowns u and v , to which standard PDE numerical methods can be applied. Related approximations and numerical results can be found in (March 1992), (Chambolle 1992), (Chambolle 1995), (Chambolle 1999), (Bourdin and Chambolle 2000), (Bourdin 1999). Also, in (Cham- bolle and Dal Maso 1999), the authors provide an approximation by convergence based on the nite element method, to the weak formulation. Note that, most of the methods solving the weak formulation, do not explicitly compute the partition of the image and the set of curves C. In general (see for instance (Ambrosio and Tortorelli 1990), (Ambrosio and Tortorelli 1992), only an approximation to C is obtained, by a sequence of regions enclosing C, but converging in the limit to the empty set. Active contours without edges We recall now the authors's active contour model without edges from (Chan and Vese 1999), (Chan and Vese 2001), which is a particular case and the motivation of the proposed models from the present paper. Given the curve an open subset, and two unknown constants c 1 and c 2 , denoting n !, we have proposed to minimize the following energy with respect to c 1 ; c 2 and C: Z Z or in the level set formulation, with Z Z Z Considering H " and - " any C 1 approximations and regularizations of the Heaviside function H and minimizing the energy, we obtain: (0; x; R R R dxdy R dxdy @ @t div r This model performs active contours, looking for a 2-phase segmentation of the image, given by y))). The main advantages, by comparison with other active contour models, are: it automatically detects interior contours, the initial curve can be placed anywhere in the image, and it detects both contours with, or without gradient (called cognitive con- tours, following (Kanizsa 1997)). Natural generalizations are presented in this paper, in Sections 2 and 3, for image segmentation, where more than two segments and non-constant regions can be represented, using a new multi-phase level set approach. Inward and outward curve evolution using level set method A similar model with (Chan and Vese 1999), (Chan and Vese 2001) was proposed in (Amadieu et al. 1999). Again, this model is limited to object detection and two-phase segmentation, and it cannot segment images with more than two segments and with triple junctions, for instance. We will not give here the details of the model from (Amadieu et al. 1999), being similar with that one from (Chan and Vese 1999), (Chan and Vese 2001). The previous two models already discussed above, (Chan and Vese 1999)-(Chan and Vese 2001) and (Amadieu et al. 1999), cannot detect more than two segments and triple junctions. When working with level sets to represent triple junctions and more than two segments, the general idea is to use more then one level set function. Related relevant work is presented next, and this is the idea used in the proposed approach, but in a dierent way. A variational level set approach to multiphase motion The work from (Zhao et al. 1996) is devoted to motion of junctions and boundaries of multiple phases, in a variational level set approach. Each phase i is represented via a level set function i , such that 0g. The total length of boundaries between phases is computed as 1P R In order to keep the phases disjoint (no overlap) and their union the domain (no vacuum), the authors in (Zhao et al. 1996) have added an additional term to the energy which is minimized, in the form R dxdy. The Lagrange multiplier is updated at each time step, to keep the constraint points satised. Motions of triple junctions are then obtained. A level set model for image classication In (Samson et al. 1999), (Samson et al. 2000), the authors have applied the multi-phase level set representation from (Zhao et al. 1996) to the reduced model of Mumford and Shah, for piecewise constant image segmentation. The problem is called classication, because the mean intensities c i of classes are assumed to be known a-priori, and only the set of boundaries C is unknown. A statistical approach to snakes for bimodal and trimodal imagery In (Yezzi, Tsai and 1999), the authors are again using the idea of combining several level set functions, to represent more than two segments in an image. They are showing numerical results with binary ows (related with the models (Chan and Vese 1999), (Chan and Vese 2001), (Amadieu et al. 1999)), but with additional choices for the segmentation criteria (instead of R ju propose other choices, with dierent statistical meanings). They also propose interesting ternary ows, where two evolving curves segment an image into three regions (two foreground regions and one background region). Coupled geodesic active regions for image segmentation: a level set approach In (Para- gios and Deriche 2000), the authors are using again multiple level set functions for image segmentation, in a probabilistic framework. As in (Zhao et al. 1996), (Samson et al. 1999), (Samson et al. 2000), each region is associated with one level set function. So, if N regions need to be segmented, then N level set functions are needed. Results of coupled curve evolution are obtained, to segment images with up to ve dierent regions. As we have seen, there are several choices for the representation of the dierent phases and their boundaries by level sets. As mentioned above, a rst idea was proposed in (Zhao et al. 1996), and then applied in (Samson et al. 1999), (Samson et al. 2000): a level set function is associated to each phase or each connected component i (this is also used in (Paragios and Deriche 2000)). But then natural problems of vacuum and overlap appear, and these have been solved by adding additional constraints into the above mentioned models. An interesting idea, but dierent than ours, to remove the problems of vacuum and overlap, has been used in (Merriman, Bence and Osher 1994), but it is not clear how to incorporate this formulation into a variational framework. Their idea was that, at each step, after computing the characteristic functions i , associated with each phase i , to re-dene these characteristic functions by: i (x; number of phasesg, to avoid the problems of vacuum and overlap. For another work on partitions, we also refer the reader to (Ei, Ikota and Mimura 1999). Finally, we would also like to refer to a projection method for motion of triple junctions by level sets (Smith, Solis and Chopp 2002). In this paper, we propose a dierent multi-phase level set representation, and by construction, the distinct phases are disjoint (no overlap) and their union is the domain (no vacuum); also, we need fewer level set functions to represent the same number of phases. Finally, we will see that triple junctions and other complex topologies can be detected and represented by the proposed multi-phase level set representation. Based on these characteristics, we think that the proposed approach is new and dierent than the existing related models. The applications of the proposed multi-phase level set formulation are devoted in this paper to image segmentation, via (Mumford and Shah 1989). Many other authors have studied the minimization of the Mumford-Shah functional and related problems for segmentation, both in theory and in practice, and it is impossible to mention all of them. However, we would like to mention (Zhu, Lee and Yuille 1995), (Zhu and Yuille 1996), (Shah 1996), (Shah 1999), (Shi and Malik 2000), (Sharon, Brandt and Basri 2000). An interesting application of the level set method and energy minimization to segmentation of three-dimensional structures has been proposed in (Lorigo et al. 1999), to extract complicated curve-like structures, such as blood vessels. For general expositions on segmentation of images by variational methods, both in theory and algorithms, we refer the reader to (Mumford, Nitzberg and Shiota 1993) and (Morel and Solimini 1994). Also, for recent expositions of geometric PDE's, variational problems and image processing (including snakes, active contours, curve evolution problems), we refer the reader to (Sapiro 2001), (Aubert and Kornprobst 2001), (Guichard and Morel, to appear). To summarize, in this paper we propose: an extension and generalization of the active contour model without edges from (Chan and Vese 1999), (Chan and Vese 2001), to the general Mumford and Shah model, in two cases: the piecewise constant case (2), and the piecewise smooth case (1). The proposed models can identify individual segments in images with multiple segments and junctions, as compared with the initial model (Chan and Vese 1999), (Chan and Vese 2001), where the detected objects were belonging to the same segment. We also propose a new representation for multiphase motion by level sets (requiring only log 2 n level set functions for n segments or phases in the piecewise constant case), allowing for triple junctions, for example, without vacuum or overlap between phases. In the piecewise smooth case, based on The Four-Color Theorem, we show that only two level set functions su-ce for image segmentation. Finally, the proposed models inherit all the advantages of our active contour model without edges: detection of edges with or without gradient, detection of interior contours, automatic change of topology, robustness with respect to noise. The models can perform in parallel active contours, segmentation, denoising, object and edge detection. 2 Description of the model in the piecewise-constant case In this section, we show how we can generalize the 2-phase piecewise constant active contour model without edges (Chan and Vese 1999), (Chan and Vese 2001), to piecewise constant segmentation of images with more than two segments and junctions, using (2). We note again that, using only one level set function, we can represent only two phases or segments in the image. Also, other geometrical features, such as triple junctions, cannot be represented using only one level set function. Our goal is to look for a new multiphase level set model with which we can represent more than two segments or phases, triple junctions and other complex topologies, in an e-cient way. We will need only log 2 n level set functions to represent n phases or segments with complex topologies, such as triple junctions. In addition, our formulation automatically removes the problems of vacuum and overlap, because our partition is a disjoint decomposition and covering of the domain by denition. This is explained next. Let us consider level set functions i IR. The union of the zero-level sets of i will represent the edges in the segmented image. We also introduce the \vector level set function" and the \vector Heaviside function" are only 1 or 0. We can now dene the segments or phases in the domain in the following way: two pixels in will belong to the same phase or class, if and only if In other words, the classes or phases are given by the level sets of the function H(), i.e. one class is formed by the set (one phase or class contains those pixels (x; y) of having the same value H((x; y))). There are up to possibilities for the vector-values in the image of H(). In this way, we can dene up to phases or classes in the domain of denition The classes dened in this way form a disjoint decomposition and covering of Therefore, each pixel (x; y)will belong to one, and only one class, by denition, and there is no vacuum or overlap among the phases. This is an important advantage, comparing with the classical multiphase representation introduced in (Zhao et al. 1996), and used in (Samson et al. 1999), (Samson et al. 2000). The set of curves C is represented by the union of the zero level sets of the functions i . We label the classes by I, with 1 I us introduce a constant vector of averages in the class I, and the characteristic function I for each class I. Then the reduced Mumford-Shah energy (2) can be written as: F MS Z Z jr I j: (6) In order to simplify the model, we will replace the length term by R (i.e. the sum of the length of the zero-level sets of i ). Thus, in some cases, some parts of the curves will count more than once in the total length term, or in other words, some edges will have a dierent weight in the total length term. We will see that with this slight modication and simplication, we still obtain very results (it may have only a very small eect in most of the cases, because the tting term is dominant). Therefore, the energy that we will minimize is given by: Z Z Clearly, for we obtain the 2-phase energy (5) considered in our active contour model without edges. For the purpose of illustration, let us write the above energy for phases or classes (and therefore using Fig. 2 left): Z Z Z Z Z Z With these notations, we can express the image-function u as: Figure 2: Left: 2 curves f partition the domain into 4 regions: f 1 > 0; 2 > 0g, partition the domain into 8 regions: The Euler-Lagrange equations obtained by minimizing (8) with respect to c and , embedded in a dynamical scheme, are: given 1 (0; x; @t div io @t div io We note that the equations in are governed by both mean curvature and jump of the data energy terms across the boundary. We show in Fig. 2 right, the partition of the domain into eight regions, using three level set functions. It is easy to extend the proposed model to vector-valued functions, such as color images, following for instance (Chan, Sandberg and Vese 2000). In this case, u is the initial data, with images), and for each channel we have the constants In this case, the model for multichannel segmentation will be: Z Z Note that, even if we work with vector-valued images, the level set functions are the same for all channels (i.e. we do not need additional level set functions for each channel). The associated Euler-Lagrange equations can easily be deduced. 3 Description of the model in the piecewise-smooth case In this section, we propose a multi-phase level set formulation and algorithm for the general problem of (Mumford and Shah 1989) in image processing (1), to compute piecewise smooth optimal approximations of a given image. We consider the cases: In one dimension: for signal segmentation and denoising, we show that, using only one level set function, we can represent any signal with any number of segments in the partition. In two dimensions: (i) we generalize the 2-phase piecewise-constant model from (Chan and Vese 1999), (Chan and Vese 2001), to piecewise-smooth optimal approximations using only one level set function: dierent regions of distinct intensities can be represented and detected with the correct intensities. (ii) following the idea of the multi-phase level set partition from the previous section, we show that, in the piecewise-smooth case, using only two level set functions, producing up to four phases, any general case can be considered and represented by the proposed formulation. Our main idea is based on The Four-Color Theorem. The one-dimensional case: signal denoising and segmentation In many applications, we deal with a source signal u on b). The problem of reconstructing u from a disturbed input u 0 deriving from a distorted transmission, can be modeled as nding the minimum min Z (a;b)nC a ju where C denotes the set of discontinuity points of u, and #(C) denotes the cardinal of C (the counting measure). We let , with being a one dimensional level set function, and we introduce two functions u and u , such that . These two functions replace the two unknown constants used in (Chan and Vese 1999), (Chan and Vese 2001), and are such that u 0g). Then the energy (9) can be written in the level set formulation as: min a a a a ju a Minimizing this energy with respect to u we obtain the associated Euler-Lagrange equa- tions, embedded in a dynamical scheme: @ @t Note that, in one dimension for signal segmentation, only one level set function su-ces to represent a piecewise smooth function u, together with its set of jumps. u=u- u=u- u=u- u=u- u=u+- u=u+- u=u+- u=u+- Figure 3: Left: example of partition of the image u in regions with boundaries represented via a single level set function f = 0g, and with smooth value-functions u , u on each side of the curve. Right: example of partition of the image u in regions with boundaries represented via two level set functions and with smooth value-functions u ++ , all sides of the curves. The two-dimensional case: two-phase model We consider the corresponding two-dimensional case, under the assumption that the edges (denoted by C) in the image can be represented by one level set function , i.e. 0g. The most general case, allowing for any type of edges, including triple junctions, will also be considered. As in the 1-dimensional case, the link between the unknowns u and can be expressed by introducing two functions u and u , such that We assume that u + and u are C 1 functions on 0 and on 0 respectively (and therefore with continuous derivatives up to all boundary points, i.e. up to the boundary We illustrate our formulation in Fig. 3 (left). Then we obtain the following minimization problem from (1): Z Z ju Z Z Z Minimizing F respect to u we obtain the following Euler-Lagrange equations (embedded in a dynamical scheme for @~n @ @~n @ @ @t r r where @=@~n denotes the partial derivative in the normal direction ~n at the corresponding boundary. We also associate the boundary condition @ @ to equation (12). The equations for u and u will have a smoothing and denoising eect on the image u 0 , but only inside homogeneous regions, and not across edges. We would like to mention that ideas very similar with those from the above case, have been also developed by (Tsai, Yezzi and Willsky 2001), independently and contemporaneously. The two-dimensional case: four-phase model In the previous two cases, we have shown how we can minimize the general Mumford-Shah functional for segmentation in the case where the set of contours C can be represented by a single level set function, i.e. and has opposite signs on each side of C. By this method, we can already detect several objects of distinct gray-levels, but we have a constraint on the type of edges. There are cases where the boundaries of regions forming a partition of the image could not be represented in this way (i.e. using a single level set function). Again, the natural idea is to use more than one level set function, as in Section 2. We show that in the general case, the problem can be solved using only two level set functions, and we do not have to know a-priori how many gray-levels the image has (or how many segments). The idea is based on The Four-Color Theorem and is as follows. Based on this observation, we can \color" all the regions in a partition using only four \colors", such that any two adjacent regions have dierent \colors". Therefore, using two level set functions, we can identify the four \colors" by the following 0g. The boundaries of the regions forming the partition will be given by 0g, and this will be the set of curves C. Again, in our particular multiphase formulation of the problem, we do not have the problems of \overlapping" or \vacuum", (i.e. the phases are disjoint, and their union is the entire domain As in the previous case, the link between the function u and the four regions can be made by introducing four functions u which are in fact the restrictions of u to each of the four phases, as follows: These notations are illustrated in Fig. 3 (right). Again, using the Heaviside function, the relation between u, the four functions u u , and the level set functions 1 and 2 can be expressed by: Using the notation introduce an energy in level set formulation, based on the Mumford-Shah functional (1): Z Z Z Z Z Z Z ju Z Z Z As in Section 2, we note that the expression R R )j is not exactly the length term of C, it is just an approximation and simplication. In practice, we have obtained satisfactory results using the above formula, and the associated Euler-Lagrange equations are simplied. We obtain the associated Euler-Lagrange equations as in the previous cases, embedded in a dynamic scheme, assuming (t; x; y) 7! i (t; x; y): minimizing the energy with respect to the functions u we have, for each xed t: @~n @~n @~n @~n The Euler-Lagrange equations evolving 1 and 2 , embedded in a dynamic scheme, formally are: @t r @t r We have mentioned in the introduction existence results for the Mumford-Shah minimization prob- lem. The global minimizer is not unique in general. We can also show, by standard techniques of the calculus of variations on the spaces and (functions of bounded variation and special functions of bounded variation respectively), and a compactness result due to (Ambrosio 1989), that the proposed minimization problems from this paper, in the level set formulation, have a minimizer. Finally, because there is no uniqueness among minimizers, and because the problems are non-convex, the numerical results may depend on the initial choice of the curves, and we may compute a local minimum only. We think that, using the seed initialization (see Section 4), the algorithms have the tendency of computing a global minimum. 4 Numerical results We x the space steps Numerical results in the piecewise-constant case (2D) We show now numerical results using the models from Section 2, and in particular using the four-phase (with two level set functions) and the eight-phase (with three level set functions) models. The only varying parameter is , the coe-cient of the length term. We give the cpu time in seconds for our calculations, performed on a 140MHz Sun Ultra 1 with 256MB of RAM. In our numerical algorithm, we rst initialize the level set functions by , then we compute the averages c I , and we solve one step of the PDE's in i . Then we iterate these last two steps. We show in particular that triple junctions can be represented and detected using only two level set functions, that interior contours are automatically detected and also that the model is robust in the presence of noise and complex topologies. We begin with a noisy synthetic image with four regions (Fig. 4, 5 and 6), and we consider several dierent initial conditions. For the initial conditions (a), (b), (c) we use the four-phase piecewise (a) (b) (c) (d) ITERATIONS ENERGY/ITERATION (a) (b) (c) (d) Figure 4: Four dierent initial conditions and the energies versus iterations. constant model, while for (d) we use the eight-phase piecewise constant model. The energy decrease is shown in Fig. 4 bottom for the initial conditions (a)-(d). The image contains three objects of distinct intensities, all correctly detected and segmented for initial conditions (a), (c), (d). This is an improvement of the authors previous 2-phase active contour model (Chan and Vese 1999), (Chan and Vese 2001), with which all three objects would have the same intensity in the segmented image, belonging to the same segment or phase. Because the energy which is minimized is not convex, and also that there is no uniqueness for the minimizers, the algorithm may not converge to a global minimizer for a given initial condition. It is then natural to consider dierent initial conditions for the same image with the same parameters, and to compare the steady-state solutions from our numerical algorithm. For (c), we seed with small initial curves. Only using the initial conditions (a), (c), (d) do we compute a global minimizer for this image. For (b), the algorithm is trapped in a local minimum. In general, for real images with more complicated features, we think that initial conditions of the types (c), (d) should be used, which have the tendency to converge to a global minimizer. This type of initial condition is also related to the region growing algorithm (Koep er, Lopez and Morel 1994). We also note that using the initial condition (c), the algorithm is much faster (see Fig. 6 left). In Fig. 6 right, we show a numerical result on the same image with four segments, but using the 8-phase model with 3 level set functions. The correct segmentation is obtained, and four nal segments are empty. Figure 5: Segmentation of a noisy synthetic image, using the 4-phase piecewise constant model. First and 3rd columns: the evolving contours overlay on the original image; 2nd and 4th columns: computed averages of the four segments c 11 Right: (b) (the algorithm computes only a local minimum in this case). (c) (d) Figure (very fast). Right: (d) three-level sets evolution with up to 8 phases (at steady state the correct segmentation is obtained, with four segments, while the other four segments are empty). Figure 7: Results on a synthetic image, with a triple junction, using the 4-phase piecewise constant model with 2 level set functions. We also show the zero level sets of 1 and 2 . In Fig. 7 we show a noisy synthetic image with a triple junction. Using only one level set function, the triple junction cannot be represented. Most of the models need three level set functions, as in (Zhao et al. 1996) and (Samson et al. 1999), (Samson et al. 2000). Here, we need only two level set functions to represent the triple junction. We show their zero level sets, which have to overlap on a segment of the triple junction. We show next numerical results on two real pictures (an MRI brain image and a house), in Figures 8-9 and 10. We use here two level set functions, detecting four phases. We also show the nal four segments detected by the algorithm. We see how the model can handle complex topologies, and also that the four phases in Fig. 9 identify quite well the gray matter, the white matter, etc. In Fig. 11 we show an example of a color RGB image (three channels) with contours without gradient (cognitive contours following (Kanizsa 1997)). We also see that this result is an improvement of the result on the same picture from (Chan, Sandberg and Vese 2000), where the three objects had the same intensity in the end. Here, the correct intensities are detected, for each object. Again, this generalized model can detect \contours without edges". In Fig. 12 we show how the model works on another color RGB image, where we use three level set functions representing up to eight phases or colors. The algorithm detects six segments and junctions. In the classical approaches, it would have been necessarily to consider at least six level set functions (here, 2 of the nal 8 segments are empty). Numerical results in the piecewise-smooth case (1D & 2D) We begin this part by an experimental result for signal denoising and segmentation. We show in Fig. 13 left an original signal and its noisy version, together with two points, where at the initial time. In Fig. 13 right, we show the segmented signal, and the detected set of jumps given by at the steady state, using the proposed level set algorithm in dimension 1, from Section 3. Note that piecewise-smooth regions are very well reconstructed by the model, and that the jumps are well located and without smearing. We show in Figures 14 and 15 two numerical results using the 2-phase algorithm from Section 3: the evolving curves are superposed over the initial noisy image u 0 , and the denoised versions u of u 0 are also shown. In Figure 14, we see that the model performs as active contours, denoising and edge- detection, and several objects of distinct intensities can be correctly segmented with only one level set function. In Figure 15, we apply the model to a real piecewise-smooth image. As we have already mentioned, similar results with those from Figures 14 and 15 have been obtained independently and contemporaneously by (Tsai, Yezzi and Willsky 2001). Finally, we show in Figure 16 numerical results on a real noisy image, using the four-phase model from Section 3. At the initial time, the two curves given by f are shown in dierent colors (we use again the seed initialization). Figure 8: Segmentation of an MRI brain image, using two level set functions and four constant phases. Figure 9: The algorithm depicts quite well the nal four segments from the previous result (white matter, gray matter, etc. the nal averages are c Initial Image u 0 Evolving contours over u 0 Evolving segments (averages) Final four segments Figure 10: Segmentation of a real outdoor picture, using two level set functions and four constant phases. In the bottom row, we show the nal four segments obtained. The nal averages are: c Figure 11: Numerical results on a synthetic color picture. We show in particular that contours not dened by gradient can be detected. These are called cognitive contours (Kanizsa, 1997). Figure 12: Color noisy picture with junctions. We use three level set functions representing up to eight constant regions. Here six segments are detected. We show the nal zero-level sets of Original Signal Noisy Signal Initial phi=0 Reconstructed Signal Noisy Signal Final phi=0 Figure 13: Left: original and noisy signal, together with the set of points where at the initial time, represented by squares on the x axis. Right: reconstructed signal, noisy signal, and the set of points where at the steady state (the jumps). Figure 14: Results on a noisy image, using the 2-phase level set algorithm for the piecewise smooth Mumford-Shah model. The algorithm performs as active contours, denoising and edge detection. Figure 15: Numerical result using the 2-phase piecewise-smooth Mumford-Shah level set algorithm, on a piecewise-smooth real image. Figure First row: original and noisy image. 2nd-5th rows: curves over u 0 , denoised u and the four articial phases for increasing times, by the 4-phase piecewise-smooth model from Section 3. with re-initialization to the distance function. 5 Conclusion In this paper, we have introduced a new multiphase model for Mumford-Shah image segmentation, by level sets. The proposed model is a common framework to perform active contours, denoising, segmen- tation, and edge detection. The multiphase formulation is dierent than the classical approaches, and has the advantages that the phases cannot produce vacuum or overlap, by construction (there is no additional constraint to prevent vacuum or overlap), and it minimizes as much as possible the computational cost, considerably reducing the number of level set functions. We show in particular that triple junctions can be represented and detected using only two level set functions. In the piecewise-constant case, we only need to know an upper bound of the segments, while in the four-phase piecewise-smooth case, we do not need to know a-priori how many segments the image has. These models can be applied to other problems, such as texture segmentation and discrimination. Finally, we validated the proposed models by various numerical results in one and two dimensions. Appendix : The description of the numerical algorithms 4y be the space steps, 4t be the time be the discrete points, for 1 arctan The piecewise constant case For the purpose of illustration, we give the details of the numerical algorithm for the four-phase model from Section 2, by solving the equations: R R R R R R R R @t div io @t div io 1;i;j and 0 2;i;j given (the initial set of curves). For each n > 0 until steady state: compute by the above formulas the averages c n 00 . as follows (using a semi-implicit nite dierences scheme): let r n n r n n r n n r n n Similarly, let r n n r n n n n The piecewise smooth case We give here the details of the numerical algorithm for solving the following equations from Section 3, written in the form: @ @t r r i;j given (the initial curve). For each n > 0 until steady state: compute u n;+ i;j and u n; compute a C 1 extension of u n;+ i;j to f n i;j 0g and a C 1 extension of u n; i;j to f n i;j , as follows: c d r n i+1;j n i;j r n i;j n i 1;j n n grad n;+ u n;+ u n;+ u n; u n; We need the extension from step 2) above, to compute the jumps along the curve. For instance, to extend u + to the region f 0g, we solve 4u on f 0g, with given prescribed values on f > 0g. This can be done by iterating the scheme: (n is xed for varying k). Other possibilities for the extension step can be found in: (Zhao et al. 1996), (Chen et al. 1997), (Fedkiw et al. 1999), (Fedkiw 1999); (Jensen 1993), (Caselles, Morel and Sbert 1997). A usual procedure, when working with level set functions, is reinitialization to the distance function. We have used this procedure only in the last numerical result from Fig. 16. For details, we refer to (Sussman, Smereka and Osher 1994). Acknowledgments The rst author thanks to P. Burchard and R. March for their useful remarks and suggestions, and also to G.P. Leonardi, for pointing out to us interesting references on minimal partition problems. Both authors thank the unknown referees from IJCV and VLSM, for their very interesting remarks and suggestions, which helped enormously to improve the presentation of this paper, and also the organizing committee of VLSM, the Guest Editors O. Faugeras and N. Paragios. This work has been supported in part by grants NSF/DMS-9973341, NSF/ITR-0113439, ONR N00014-96-1-0277, and NIH P20MH65166. --R Inward and Outward Curve Evolution Using Level Set Method. A compactness theorem for a special class of functions of bounded variation. Approximation of functionals depending on jumps by elliptic functionals via convergence. On the Approximation of Free Discontinuity Problems. Mathematical Problems in Image Processing. Solutions de viscosit A new approach to front propagation problems: theory and applications. Image segmentation with a Implementation of a Image segmentation by variational methods: Mumford and Shah functional and the discrete approximations. Discrete approximation of the Mumford-Shah functional in dimension two An active contour model without edges. Active contours without edges. Active Contours without Edges for Vector-Valued Images Uniqueness and Existence of Viscosity Solutions of Generalized Mean Curvature Flow Equations. A simple level set method for solving Stefan problems. User's guide to viscosity solutions of second order partial di A variational method in image segmentation: existence and approximation results. Existence theorem for a minimum problem with free discontinuity set. New functionals in the calculus of variations. Segregating partition problem in competition-diusion systems Measure Theory and Fine Properties of Functions. Motion of level sets by mean curvature. The Ghost Fluid Method for Discontinuities and Interfaces. Uniqueness of Lipschitz extensions: Minimizing the Sup Norm of the Gradient. La grammaire du voir. A multiscale algorithm for image segmentation by variational method. On Minimizing Partitions with In On the Finiteness of Optimal Partitions. Motion of Multiple Junctions: A Level Set Approach. Segmentation of images by variational methods: a constructive approach. Segmentation d'images par m Variational Methods in Image Segmentation. Optimal approximation by piecewise smooth functions and associated variational problems. Level set methods: An overview and some recent results. To appear. Fronts Propagating with Curvature-Dependent Speed: Algorithms Based on Hamilton-Jacobi Formulation Coupled Geodesic Active Regions for image segmentation: A Level Set Approach. Geometric Partial Di Fast Marching Methods and Level Set Methods: Evolving Interfaces in Computational Geometry A common framework for curve evolution Riemannian Drums Fast Multiscale Image Segmentation. Normalized cuts and image segmentation. A projection method for motion of triple junctions by level sets. A level set approach for computing solutions to incompressible two-phase ows Optimal Approximation by Piecewise Constant Functions. Optimal Segmentation of Unbounded Functions. A statistical approach to snakes for bimodal and trimodal imagery Curve evolution implementation of the Mumford- Shah functional for image segmentation A Variational Level Set Approach to Multiphase Motion. Region competition: Unifying snakes Region competition: Unifying snakes --TR --CTR Chen , Yue Zhou , Yonggang Wang , Jie Yang, Rapid and Brief Communication: GACV: Geodesic-Aided C-V method, Pattern Recognition, v.39 n.7, p.1391-1395, July, 2006 Tariq D. Aslam, A partial differential equation approach to multidimensional extrapolation, Journal of Computational Physics, v.193 n.1, p.349-355, January 2004 Yingjie Zhang, An improved algorithm for the piecewise-smooth Mumford and Shah model in image segmentation, EURASIP Journal on Bioinformatics and Systems Biology, v.2006 n.1, p.5-5, January 2006 Ronny Ramlau , Wolfgang Ring, A Mumford-Shah level-set approach for the inversion and segmentation of X-ray tomography data, Journal of Computational Physics, v.221 n.2, p.539-557, February, 2007 S. Y. Wang , K. M. Lim , B. C. Khoo , M. Y. Wang, An extended level set method for shape and topology optimization, Journal of Computational Physics, v.221 n.1, p.395-421, January, 2007 Sasan Mahmoodi , Bayan S. Sharif, A nonlinear variational method for signal segmentation and reconstruction using level set algorithm, Signal Processing, v.86 n.11, p.3496-3504, November 2006 J. R. Rommelse , H. X. Lin , T. F. Chan, Efficient active contour and K-means algorithms in image segmentation, Scientific Programming, v.12 n.2, p.101-120, April 2004 Christophe Zimmer , J. -C. Olivo-Marin, Coupled Parametric Active Contours, IEEE Transactions on Pattern Analysis and Machine Intelligence, v.27 n.11, p.1838-1842, November 2005 Michael Hintermller , Wolfgang Ring, An Inexact Newton-CG-Type Active Contour Approach for the Minimization of the Mumford-Shah Functional, Journal of Mathematical Imaging and Vision, v.20 n.1-2, p.19-42, January-March 2004 Yang Xiang , Albert C. S. Chung , Jian Ye, An active contour model for image segmentation based on elastic interaction, Journal of Computational Physics, v.219 n.1, p.455-476, 20 November 2006 Abdol-Reza Mansouri , Amar Mitiche , Carlos Vzquez, Multiregion competition: a level set extension of region competition to multiple region image partitioning, Computer Vision and Image Understanding, v.101 n.3, p.137-150, March 2006 Cheng Bing , Wang Ying , Zheng Nanning , Bian Zhengzhong, Object based segmentation of video using variational level sets, Machine Graphics & Vision International Journal, v.14 n.2, p.145-157, January 2005 S. Drapaca , Valerie Cardenas , Colin Studholme, Segmentation of tissue boundary evolution from brain MR image sequences using multi-phase level sets, Computer Vision and Image Understanding, v.100 n.3, p.312-329, December 2005 Hailin Jin , Anthony J. Yezzi , Stefano Soatto, Mumford-Shah on the Move: Region-Based Segmentation on Deforming Manifolds with Application to 3-D Reconstruction of Shape and Appearance from Multi-View Images, Journal of Mathematical Imaging and Vision, v.29 n.2-3, p.219-234, November 2007 Payel Ghosh , Melanie Mitchell, Segmentation of medical images using a genetic algorithm, Proceedings of the 8th annual conference on Genetic and evolutionary computation, July 08-12, 2006, Seattle, Washington, USA Lin He , Chiu-Yen Kao , Stanley Osher, Incorporating topological derivatives into shape derivatives based level set methods, Journal of Computational Physics, v.225 n.1, p.891-909, July, 2007 Thomas Cecil, A numerical method for computing minimal surfaces in arbitrary dimension, Journal of Computational Physics, v.206 n.2, p.650-660, 1 July 2005 T. Amiaz , N. Kiryati, Piecewise-Smooth Dense Optical Flow via Level Sets, International Journal of Computer Vision, v.68 n.2, p.111-124, June 2006 Qiang Du , Max Gunzburger , Lili Ju , Xiaoqiang Wang, Centroidal Voronoi Tessellation Algorithms for Image Compression, Segmentation, and Multichannel Restoration, Journal of Mathematical Imaging and Vision, v.24 n.2, p.177-194, March 2006 Threshold dynamics for the piecewise constant Mumford-Shah functional, Journal of Computational Physics, v.211 n.1, p.367-384, 1 January 2006 Xavier Bresson , Selim Esedoglu , Pierre Vandergheynst , Jean-Philippe Thiran , Stanley Osher, Fast Global Minimization of the Active Contour/Snake Model, Journal of Mathematical Imaging and Vision, v.28 n.2, p.151-167, June 2007 Nikolay M. Sirakov, A New Active Convex Hull Model for Image Regions, Journal of Mathematical Imaging and Vision, v.26 n.3, p.309-325, December 2006 Xue-Cheng Tai , Oddvar Christiansen , Ping Lin , Inge Skjlaaen, Image Segmentation Using Some Piecewise Constant Level Set Methods with MBO Type of Projection, International Journal of Computer Vision, v.73 n.1, p.61-76, June 2007 Olivier Juan , Renaud Keriven , Gheorghe Postelnicu, Stochastic Motion and the Level Set Method in Computer Vision: Stochastic Active Contours, International Journal of Computer Vision, v.69 n.1, p.7-25, August 2006 Daniel Cremers , Nir Sochen , Christoph Schnrr, A Multiphase Dynamic Labeling Model for Variational Recognition-driven Image Segmentation, International Journal of Computer Vision, v.66 n.1, p.67-81, January 2006 Xavier Bresson , Pierre Vandergheynst , Jean-Philippe Thiran, A Variational Model for Object Segmentation Using Boundary Information and Shape Prior Driven by the Mumford-Shah Functional, International Journal of Computer Vision, v.68 n.2, p.145-162, June 2006 Ganesh Sundaramoorthi , Anthony Yezzi , Andrea C. Mennucci, Sobolev Active Contours, International Journal of Computer Vision, v.73 n.3, p.345-366, July 2007 Tammy Riklin-Raviv , Nahum Kiryati , Nir Sochen, Prior-based Segmentation and Shape Registration in the Presence of Perspective Distortion, International Journal of Computer Vision, v.72 n.3, p.309-328, May 2007 Matthias Heiler , Christoph Schnrr, Natural Image Statistics for Natural Image Segmentation, International Journal of Computer Vision, v.63 n.1, p.5-19, June 2005 Tony F. Chan , Xue-Cheng Tai, Level set and total variation regularization for elliptic inverse problems with discontinuous coefficients, Journal of Computational Physics, v.193 n.1, p.40-66, January 2004 Frank Losasso , Tamar Shinar , Andrew Selle , Ronald Fedkiw, Multiple interacting liquids, ACM Transactions on Graphics (TOG), v.25 n.3, July 2006 Qiang Chen , Jian Luo , Pheng Ann Heng , Xia De-shen, Fast and active texture segmentation based on orientation and local variance, Journal of Visual Communication and Image Representation, v.18 n.2, p.119-129, April, 2007 Nikos Paragios , Rachid Deriche, Geodesic active regions and level set methods for motion estimation and tracking, Computer Vision and Image Understanding, v.97 n.3, p.259-282, March 2005 Qi Xia , Michael Y. Wang, Level set based method for simultaneous optimization of material property and topology of functionally graded structures, Proceedings of the 2007 ACM symposium on Solid and physical modeling, June 04-06, 2007, Beijing, China Bodo Rosenhahn , Thomas Brox , Joachim Weickert, Three-Dimensional Shape Knowledge for Joint Image Segmentation and Pose Tracking, International Journal of Computer Vision, v.73 n.3, p.243-262, July 2007 Daniel Cremers , Mikael Rousson , Rachid Deriche, A Review of Statistical Approaches to Level Set Segmentation: Integrating Color, Texture, Motion and Shape, International Journal of Computer Vision, v.72 n.2, p.195-215, April 2007 Ronald P. Fedkiw , Guillermo Sapiro , Chi-Wang Shu, Shock capturing, level sets, and PDE based methods in computer vision and image processing: a review of Osher's contributions, Journal of Computational Physics, v.185 n.2, p.309-341, March
energy minimization;level sets;image segmentation;edge detection;active contours;curvature;denoising;multi-phase motion;PDE's
598632
Multistage Nonlinear Blind Interference Cancellation for DS-CDMA Systems.
In this paper we propose a multistage nonlinear blind interference cancellation (MS-NL-BIC) receiver for direct-sequence code-division multiple-access (DS-CDMA) systems. The receiver uses higher order statistics of the received baseband signal. Specifically, we use the second and fourth moments of the received signal to determine a component of the received vector that has significant mean energy and low variability of the energy, both of which are favorable characteristics for application in an interference cancellation scheme that uses hard decisions. The structure of the receiver is multidimensional and can be viewed as a matrix of receivers. Each row in the matrix consists of receivers that perform (hard decisions) cancellation of successive components that have significant mean energy and low variability of the energy. The columns of the matrix essentially resemble multistage receivers that iteratively refine performance from earlier stages. Simulation results show that unlike linear receivers, the MS-NL-BIC is exceptionally efficient in systems with strong and highly correlated interferers, as may be the case in overloaded DS-CDMA systems.
Introduction One of the driving forces of the next generation of wireless communications is the demand for higher data rates and higher capacity of wireless systems. Primary applications of higher data rates seem to be in the downlink direction (for example, typical internet data tra#c such as downloading of web pages). Furthermore, wideband direct-sequence code-division multiple-access (DS-CDMA) technology has emerged as one of the most promising candidates for future wireless systems (e.g., third generation systems [1, 2]). It is therefore of great interest to investigate the performance of these systems and its viability for higher data rates envisioned in the future. In DS-CDMA systems, in general, crosscorrelations between signature (spreading) sequences are nonzero. This results in the near-far e#ect where the multiple-access interference (MAI) can disrupt reception of a highly attenuated desired user signal [3]. Baseband signal processing techniques such as multiuser detection and interference cancellation have the potential to combat this problem and provide higher performance at the cost of increasing complexity of the receiver. Rapid progress in the area of semiconductor technology has resulted in a significant increase in the processing speeds of core technologies (DSP, FPGA and ASIC device). Advances in VLSI technology, and design of the algorithms that are optimized with respect to a specific implementation platform, are further narrowing the gap between the complexity of the algorithms and processing speeds (e.g., solutions that are presented in [4, 5]). These and other developments suggest that the transceivers in future wireless systems will employ some form of interference mitigation. Several multiuser receivers have been proposed (for example, see [6-9]). These receivers are denoted as centralized because they require knowledge of parameters (signature sequences, amplitudes and timing) for all users in the system. Therefore, they are more suitable for processing at the base station. For the downlink, it is desirable to devise decentralized receivers that exploit the knowledge of the desired user parameters only. The use of short signature sequences simplify the task of multiuser detection and interference cancellation, since a receiver can adaptively learn (estimate) the structure of the MAI [10]. Decentralized receivers may be further classified into data aided and nondata aided receivers. Data aided adaptive multiuser detection is an approach which does not require a prior knowledge of the interference parameters. But, it requires a training data sequence for every active user. For example, adaptive receivers in [7,11,12] are based on the MMSE criterion, and the one in [13] is based on minimizing probability of bit-error. More recently, decision feedback detectors using the MMSE criterion have been proposed [14,15]. Unlike data aided receivers, blind (or nondata aided) multiuser detectors require no training data sequence, but only knowledge of the desired user signature sequence and its timing. The receivers treat MAI and background noise as a random process, whose statistics must be estimated. Majority of blind multiuser detectors are based on estimation of second order statistics of the received signal. In [16], a blind adaptive MMSE multiuser detector is introduced (proven to be equivalent to the minimum output energy (MOE) detector). A subspace approach for blind multiuser detection is presented in [17]; where both the decorrelating and the MMSE detector are obtained blindly. Further, adaptive and blind solutions are analyzed in [18], with an overview in [10]. A blind successive interference cancellation (SIC) scheme, which uses second order statistics, is proposed in [19, 20]. In this paper we propose a novel blind interference cancellation receiver, which assumes knowledge of only the desired user's signature sequence. The receiver is based on determining that component of the received signal that has significant mean energy and low variability in the energy. It applies the minimum variance of energy and maximum mean energy criterion (MVE-MME), which is described in Section 3. Furthermore, we analyze a relationship between the above criterion and Godard's dispersion function [21] and constant modulus (CM) criterion [22]. In Section 4, using the MVE-MME criterion, we derive a nonlinear multistage blind interference cancellation receiver. The structure of the NL-MS-BIC receiver is multidimensional and can be viewed as a matrix of IC stages. Each row in the matrix consists of IC stages that perform the blind (hard decisions) successive interference cancellation. The columns of the matrix essentially resemble multistage receivers that iteratively refine performance from earlier stages. This particular multi-stage structure of the receiver allows concurrent (parallel) execution of the IC stages which makes it very suitable for implementation using multiprocessor DSP and/or FPGA (or ASIC) platform. Simulation results are presented in Section 5, and we conclude in Section 6. Background The received baseband signal, r(t), in a K-user asynchronous DS-CDMA additive white Gaussian noise (AWGN) system is where A k is the received amplitude, b k (i) # {-1, +1} is binary, independent and equiprobable data, is the signature sequence which is assumed to have unit energy, # k is the relative time o#set, all for the k th user. T is the symbol period and n(t) is AWGN with unit power spectral density, with # being square root of the noise power. is the number of data symbols per user per frame. It is well known that an asynchronous system with independent users can be analyzed as synchronous if equivalent synchronous users are introduced, which are e#ectively additional interferers [3]. In this paper we consider the received signal r(t) over only one symbol period that is synchronous to the desired user 1). The discrete representation for the received signal in (1) can be written in vector form as where the number of the interferers doubled due to the equivalent synchronous user analysis. r, s k and n are vectors in # M , where M is the number of chips per bit. Consider the nonlinear centralized SIC scheme which is presented in [5, 8]. We now present a brief outline of the above scheme because its approach to nonlinear interference cancellation is generalized in this paper and later applied in a blind interference cancellation scheme (Section 4). In the nonlinear centralized SIC scheme [5, 8] it is assumed that the signature sequences are perfectly known (centralized approach). The basic operations of the SIC algorithm are (see Figure 1): 1. Detect one user with the conventional detector, i.e., matched filter (MF). 2. Regenerate the baseband signal (vector) for this user. 3. Cancel the regenerated signal (vector) from the received baseband signal. Then, this operation is repeated successively for all the users in the system. The idea is that successive cancellations result in reduced MAI for the remaining users. The received vector r j+1 after stage j of the cancellation is given by where r j is the received vector, - A j and - b j are the corresponding estimates of the amplitude and the bit, respectively, all for stage j 1 . The above implementation of the SIC algorithm is nonlinear in that it uses hard decisions ( - b j # {-1, 1}) in successive stages. A primary reason why the nonlinear centralized SIC cannot achieve performance of the single user lower bound (SULB) is due to erroneous estimate of bit decision (i.e., - b j #= b j ). When an error happens, it causes the SIC scheme to double the interference, which is, of course, undesirable. Furthermore, the doubled interference propagates through the following IC stages, which degrades the overall performance of the receiver. For the same reason, this receiver also is not near-far resistant [3]. Further, imperfections in amplitude and delay estimates can lead to the non ideal regeneration and cancellation. Accordingly, to obtain best results, the user with the highest signal to interference ratio (SIR) should be cancelled first. This condition is usually relaxed and the user with highest received power is cancelled first, followed by the second strongest, and so forth [8, 9]. Thus, it is desirable to identify users (or signature sequences) that have significant power (energy). Note that the SIC scheme requires amplitude estimates for the users, which implicitly requires low variability of the amplitude estimates for perfect cancellation. Let us now generalize the nonlinear cancellation given by (3). In equation (3), let us replace s j with a vector v j (not necessarily a signature sequence). Furthermore, we replace - A j with the square root of the estimate of # Thus, the nonlinear cancellation in the j th stage is executed as In the following, we propose favorable characteristics of the vector v j to be successfully applied in the above scheme. We now analyze the estimate of the energy # j of the received signal in the z denotes an estimate of z direction of the vector v j . To estimate # j we use sample statistics as where N is the size of the averaging window (number of samples), and n and m are time indices (will be omitted in the following). It is well known that the error of the estimate in (5) is directly related to the variance of x . Using the Chebyshev inequality [23] it can be shown that as the variance of x j gets lower, the accuracy (mean square error) of the energy estimate is improved: We can say that for the vector v j that corresponds to x j with lowest variance (among all vectors in # M ), the estimate of the energy is the most reliable, i.e., the mean square error of the energy estimate is the lowest. Note that the variance of x j is the variance of the energy of the received vector r in the direction of the vector v j (i.e., variance of squared projection of the vector r onto the vector v j ). The above analysis leads us to believe that the vector v j which corresponds to the low variability of the energy and significant mean energy of the vector r in the direction of v j , is desirable for the nonlinear cancellation given by (4). These characteristics of the vector v j o#er reliable estimates of the corresponding energy # j and sign of r # v j . In the following we present a scheme that blindly determines (estimates) the vector v j and further applies this vector to realize a multistage nonlinear interference cancellation scheme. 3 MVE-MME Optimization Criterion We now present an optimization criterion which is used in deriving a nonlinear blind adaptive interference cancellation scheme. According to the analysis in Section 2, the goal of the optimization approach is to determine a component of the received vector r that has low variability in the energy and significant mean energy. We consider the squared output of the projection of r onto a vector . The vector v is obtained from the following nonlinear procedure which is where is subject to u # 1. The function # 1 (u) denotes the variance of the squared output r # u and is given as The function # 2 (u) in (7) denotes the square mean energy given as Consider the function # 1 (u). We now present the following proposition that gives an intuitive description of the minimum variance of energy criterion, which is obtained by minimizing the expression in (8). Proposition 1 For the synchronous antipodal DS-CDMA system (described in (2)), with zero linearly independent signature sequences {s i } L , the solutions for arg min u constrained as u # are classified in two groups: (a) k=1,k #=i and s # i d i #= 0. Actually, d i is the modified matched filter that corresponds to decorrelating detector for user i [6]. (b) w is any vector from the noise subspace. Further, the above solutions correspond to the absolute minimum of # 1 (u) where it is zero. We present a proof of the above proposition in Appendix A. Let us now compare # 1 (u) with the well known, Godard's dispersion function [21]: Where # is a real constant, and p is an integer. For 2, the cost function in (10) is directly proportional to # 1 (u). In other words, # 1 (u) penalizes dispersions of the squared output (r # u) 2 away from the constant E h (r # u) 2 . Furthermore, the well studied constant modulus (CM) cost function is defined as a special form of the function in equation (10), where 2. The CM cost function is widely used for blind equalization (see [22] and references therein). Later in this paper, # 1 (u), which may be viewed as a slightly modified form of the CM cost function, is applied for blind interference cancellation in DS-CDMA systems. Let us now consider the function # 2 (u). It can be shown that the vector v constrained as u # is equal to the vector that also maximizes the mean energy E h (r # u) 2 It is shown in [19, 20] that v max is the eigenvector that corresponds to the largest eigenvalue of the input covariance matrix R Instead of the mean energy E h (r # u) 2 is applied in (7) such that both terms are of the same order (i.e., fourth order). Based on the above, the vector v, which is defined in the equation (7), corresponds to that component of the received signal r that has low variability in the energy and significant mean energy. As discussed in Section 2, these characteristics are favorable for application of the vector v in a nonlinear interference cancellation scheme. The parameter - is used to control which of these two characteristics (low variability of the energy or significant mean energy) is dominant. For example, if the optimization in (7) is equivalent to minimum variance of energy (MVE), and for equivalent to maximum mean energy (MME) optimization criterion. Therefore, we refer to (7) as the minimum variance of energy and maximum mean energy (MVE-MME) optimization criterion. Note that in Subsection 3.2 we revisit issues related to the parameter - and propose its design. 3.1 Adaptive Solution We now present an adaptive algorithm that solves (7). We exploit some properties of the functions given in (8) and (9). Let us assume that the input process r is wide sense stationary (WSS) and also that where n and m are time indices, and n #= m. In other words, we assume that the energy of r in direction of the vector u is uncorrelated in di#erent symbol (bit) intervals. Using the properties of WSS processes and (11) we can show that (8) can be written as for all integer n and m, n #= m. Similarly, the expression (9) can be written as According to (12) and (13), and using sample statistics, the function f(u) is defined as an approximation of #(u) as f(u, n) =F F where F is a number of consecutive symbols used for the approximation. Gradient of f(u, n) is defined as F We can use a stochastic gradient algorithm [24] that solves (7) as where l is the index of the iteration step, and 0 < # < 1 is a certain scalar which defines the length of adaptation step. The constraint |-v l+1 forced after every iteration, where - v l stands for estimate of v in l th iteration step. 3.2 Choice of Parameter - As addressed earlier, the parameter - is used to control which of the two characteristics of v (low variability of the energy or significant mean energy) is dominant. We choose - as Note that the above definition is similar to the inverse of the normalized kurtosis [23]), but further analysis of this relationship is beyond the scope of this paper. Furthermore, as an approximation of the above definition, we set in equation (15). Considering characteristics of the parameter - that is defined by (17), it can be shown that 1. If r # u is a real-valued Gaussian random process, - is 1/3. 2. Let -M denote - corresponding to r # u, which is a uniform discrete real-valued M-ary random process, i.e., r # u # {a i | a A is the maximum absolute value of r # u. Based on the above definition, it can be shown that Figure 2 depicts the parameter - as a function of the alphabet size of a uniform, real-valued M-ary random process. As a reference, we present - that corresponds to a continuous uniformly distributed random process (denoted as CU), and a Gaussian random process (denoted as GP). Note that the function is decreasing with alphabet size M , or in other words, Furthermore, we may note that - is maximum at real-valued bipolar random process. In addition, we note -M in equation (19) converges towards - that corresponds to the continuous uniformly distributed random process (CU in Figure 2). From the above properties of the parameter -, we may draw the following conclusions. When the received signal of the output of the correlator, r # u, is a real-valued Gaussian random process (i.e., u lies in the noise subspace of the received vector r), then - takes a value close to its minimum thereby steering the MVE-MME criterion towards minimizing variance of energy (MVE). On the other hand, when the output r # u is a close to a discrete-valued random process (as in the case when MAI dominates), - approaches its maximum value thus steering the MVE-MME criterion towards maximizing mean energy (MME). In the course of adaptation, the value of - given in equation (18) changes according to the projection r # u, i.e. u being in the noise (Gaussian) part of the signal subspace or the interference (discrete-valued random process) subspace. 4 Application of the MVE-MME Criterion in the Multi-stage Nonlinear Blind IC Receiver We now present a multistage nonlinear blind interference canceler, denoted as MS-NL-BIC. The structure of the receiver is multidimensional and can be viewed as a matrix of receivers (i.e., matrix of IC stages). The MS-NL-BIC receiver consists of P rows and Q columns, where each entry of the matrix corresponds to an interference cancellation stage denoted as IC ij The following steps are executed in the IC ij stage (where r ij is the input vector to that stage): 1. Add back x (i-1)j as where x (i-1)j is a portion of the received signal that is cancelled in the IC i-1j stage. Note that the IC i-1j stage is the same column, but earlier row of the matrix. For the first row (i = 1), because no cancellation is performed prior to this row. 2. Use adaptation rule in (16) (r # ij replaces r) to estimate v ij as - v ij (see Figure 3). Note that the vector further processed in the very same manner as an interferer signature sequence in the case of the nonlinear centralized SIC scheme (see Section 2). 3. Estimate the energy Note that the estimation should be reliable because as a component of the vector r # ij , has low variability in the energy (due to the term 4. Detect the sign of r # ij Note that detection should be reliable, because the component has significant mean energy (due to the term -# 2 (u) in (7)) and low variability. 5. Perform nonlinear cancellation as where (see Figure 4) The above procedure is executed successively (within the i th row of the matrix), where for the new stage IC ij+1 , the input vector is r ij+1 (see equation (22)). The structure of the i th row (i.e., horizontal topology) is depicted in Figure 5. From the above, each row may be viewed as a blind equivalent to the nonlinear centralized SIC scheme, where the components replace the actual signature sequence. After su#cient number Q of the stages in the i th row, cancellation is repeated in the (i th row (see Figure 6). The input vector r i+11 of the (i th row is r iQ+1 . The stage IC i+1j is used to iteratively refine the cancellation which is executed in the earlier stage IC ij appropriate delay, the vector x ij , that is canceled in the stage IC ij is added back (step 1), and within the stage IC i+1j processing is performed again (steps 2 to 5). In Section 5, Q is selected to be equal to the number of dominant interferers, but in the more general case, this number might not be known at the receiver. A number of di#erent schemes can be employed in order to determine the number of IC stages within each row of this receiver. Here, we propose the following simple scheme. In the first row the stage IC 1j may be determined as the last stage in the row if the estimate of the energy - # 1j drops below a certain threshold e . In other words This simple scheme assumes that - # ij+1 (i.e., the energy estimate is decreasing with column index j). In addition, the scheme is based on the assumption that the component that corresponds to the mean energy which is below the threshold T e , is not relevant for the cancellation. Furthermore, the number of the rows P is directly related to the performance of the receiver. Thus, the trade-o# in performance versus complexity can be controlled by the number P . After su#cient number P of the rows, detection of the desired user is performed using a linear detector (e.g., matched filter). Note that implicit in the above algorithm is the assumption that the interferers are stronger than the desired user. If the desired user is strong, then additional processing is required to ensure that the desired signal is not canceled out before the detection. Briefly, we propose a corresponding scheme which is based on a threshold rule. In last row, is projected onto the desired user signature sequence s 1 . The absolute value of the projection is compared against a predefined threshold T h (0 < T h < 1). If the absolute value exceeds the threshold T h , the vector x P j (defined in equation (23), where should be added back to r PQ+1 . Having inspected all the vectors - the addition is performed as follows where the corresponds to all vectors - that have met the criterion in (25). Further, the linear detection of the desired user is performed using r # PQ+1 as input signal. Note that a centralized multiuser detection scheme, which is proposed in [2,25], applies a similar iterative (recursive) refinement approach that is presented above. That particular scheme executes centralized SIC and iterative refinement in order to improve channel estimates for the users in the system. Unlike the MS-NL-BIC receiver, the scheme in [2,25] assumes the knowledge of all signature sequences of the users in the system (i.e., it is not blind). Further, the multistage structure of the receiver allows concurrent (parallel) execution of the IC stages. This inherent parallelism of the algorithm is a favorable characteristic for its implementation using multiprocessor DSP and/or FPGA (or ASIC) platform (see [4, 5] and references therein). 5 Simulation Results We consider a synchronous AWGN DS-CDMA system using randomly generated signature sequences with processing gain 8. The users are independent and the following cases are analyzed: 1. System with users (fully loaded), and equal-energy interferers: A 2 2. System with users, and equal-energy interferers: A 2 3. System with users (overloaded system); three strong equal-energy interferers: A 2 4, and eight interferers with the same energy as the desired user: A 2 The crosscorrelation profile of the users with respect to the desired user is depicted in Figure 7. Note that in this particular example the crosscorrelations are very high, except for users 5, 10 and 12 which happen to be orthogonal to the desired user. In the case 1, the system has users and in the case 2 only In all our results the input sample covariance matrix is estimated according to R r (i) =N where N is the size of the averaging window (number of samples), and i is the time index (will be omitted in the following text). Performance of the conventional matched filter (MF), the centralized MMSE receiver (denoted as MMSE), the blind MMSE receiver (BMMSE) (detector and the single user lower bound (SULB) are used as benchmarks for evaluation of the MS-NL- BIC receiver. The centralized MMSE assumes perfect knowledge of all the signature sequences, amplitudes and the variance of the AWGN. Performance of the MS-NL-BIC is evaluated for MF (MS-NL-BIC-(MF)) and the blind MMSE (MS-NL-BIC-(MMSE)); where these linear detectors are used for detection of the desired user after the cancellation (after P rows and Q IC stages within each row). The MS-NL-BIC-(MMSE) uses the sample covariance matrix of the output signal of the last IC stage (IC PQ ). Note that the desired user energy is set to be much lower than the energy of the interferers, and, as discussed in Section 4, the prevention of the excessive cancellation of the desired user is not performed. In each IC stage, the performance is measured after 1000 symbols used for the estimation in (16) and (27), and (18). Regarding the parameter -, we apply the approximation given by (18). We assume the knowledge of the number of dominant interferers Q, which is the number of columns of the receiver matrix. For the case 1, Figure 8.a depicts bit-error rate (BER) as a function of signal to background noise ratio (SNR) (with respect to the desired user). The results are obtained after a total of rows and which is where the BER reaches minimum. Additional IC stages do not introduce any improvement for this particular example. For versus total number of IC stages is presented in Figure 8.b. Note that in this example the MS-NL-BIC(MMSE) performs better than the MS-NL-BIC(MF). In this case, after the last IC stage (IC 47 ) MAI is still present, therefore, BMMSE detector can further improve the performance of the MS-NL-BIC receiver in the case 1. Equivalent results, for the case 2, with are shown in Figures 9.a and 9.b, respectively. In Figure 9.b, note that the MS-NL-BIC(MMSE) converges faster with respect to number of IC stages, but, at the end the MS-NL-BIC(MF) o#ers lower BER for this particular example. In this case, after the last IC stage (IC 43 ), MAI is almost completely removed. Introduction of the BMMSE as linear detector in the MS-NL-BIC receiver, may cause a drop in the performance due to estimation errors of the covariance matrix (in (27)) which is used to derive the BMMSE detector (this particular topic is analyzed in [20]). We consider the performance of our receiver in the case 3, which is an overloaded DS-CDMA system. Figure 10 depicts BER versus SNR (with respect to the desired user). The same figure presents the performance of the matched filter (denoted as MF-8) for the system without the strong interferers (only the desired user and eight equal-energy interferers, which is identical to ideal cancellation of the users 2, 3 and 4). The receiver with used. From the results in Figure 10, we note that the MS-NL-BIC completely cancels the strong users i.e, the MS- NL-BIC(MF) performance is identical to the MF-8 performance (in Figure 10 their characteristics overlap). From these results, it is seen that the MS-NL-BIC outperforms linear receivers (MF and BMMSE), significantly. The performance of the linear receivers is expected because it is well known that they do not perform well in the case of the systems with strong and highly correlated interferers (with respect to the desired user signature sequence) [3], as may be the case in overloaded systems. But, these results suggest that the MS-NL-BIC may be applied as a blind solution in the case of overloaded systems with strong interferers. Let us now study the characteristics of the estimates In all cases that we have observed, as the processing progresses from row to row, estimates each column of the receiver matrix, approach one of the actual signature sequences (with sign ambiguity). Each column corresponds to a di#erent signature sequence. For example, in the case 1, we observe how the estimates approach the actual signature sequences respectively. The absolute value of the crosscorrelation - l is depicted in Figure 11, where the abscissa represents index of the row 4). The results appear to be similar for all columns 7. Note that in the last row, the estimates are practically identical to the signature sequences i.e., the absolute value of the crosscorrelation is 1. We have consistently observed these results in our simulations, and a detailed mathematical analysis and explanation of the above phenomenon is of future interest. 6 Conclusion We have introduced the MVE-MME optimization criterion which is then used to implement the MS-NL-BIC receiver. The receiver is based on determining the component of the received vector that has significant mean energy and low variability in the energy. The MS-NL-BIC consists of multiple IC stages, and can be viewed as a matrix of IC stages. The columns of the matrix resemble multistage receivers that iteratively refine performance from earlier stages, while each row corresponds to a blind equivalent to the nonlinear centralized SIC scheme. The ability of the receiver to exceed the performance of the linear receivers is confirmed via the simulation results. It is seen that this scheme is particularly e#ective for systems with very strong interferers which are strongly correlated with the desired user signature sequence. Therefore, this may be a very viable solution for implementation in the case of overloaded systems with strong interferers. A Proof of Proposition 1 Consider a synchronous antipodal DS-CDMA system, with zero AWGN linearly independent signature sequences. Let us denote a component of the signature sequence s i as d i which is orthogonal to other users' signature sequences, or in other words, d i # k=1,k #=i and s # i d i #= 0, which can be written as where |c i | # 1 and c i #= 0, and # ij is the Kronecker delta function. Projection of the received vector r (see equation (2)) on d i yields (in the absence of additive background noise): where A i and b i are the amplitude and bit, respectively, all for user i. From (29), it follows that which results in Note that Therefore, the absolute minimum of # 1 (u) is zero. Based on (30) and (31), # 1 (u) reaches the absolute minimum for d i Using the above approach, the same result can be obtained for -d i This proves part (a) of Proposition 1. Further, if N denotes the noise subspace and by definition of the noise subspace [26] follows that Consequently which proves that for any vector u from the noise subspace, # 1 (u) reaches the absolute minimum of zero. This concludes proof for part (b) of Proposition 1. --R "An Overview of Air Interface Multiple Access for IMT- 2000/UMTS," "Wideband DS-CDMA for Next-Generation Mobile Communications Systems," Cambridge University Press "Software-Defined Radio Architectures for Interference Cancellation in DS-CDMA Systems," "Implementation Aspects for Successive Interference Cancellation in DS/CDMA Systems," "Linear Multiuser Detectors for Synchronous Code-Division Multiple-Access Channels," "MMSE Interference Suppression for Direct-Sequence Spread-Spectrum CDMA," "Analysis of a Simple Successive Interference Cancellation Scheme in DS/CDMA Systems," "A Family of Multiuser Decision-Feedback Detectors for Asynchronous Code-Division Multiple-Access Channels," "Blind Adaptive Interference Suppression for Direct-Sequence CDMA," "An Adaptive Direct-Sequence Code-Division Multiple-Access Receiver for Multiuser Interference Rejection," "Adaptive Receiver Structure for Asynchronous CDMA Systems," "Gradient Estimation for Sensitivity Analysis and Adaptive Multiuser Interference Rejection in Code Division Multiple Access Systems," "Multistage Multiuser Decision Feedback Detection for DS-CDMA," "Adaptive Multiuser Decision Feedback for Asynchronous Cellular DS-CDMA," "Blind Adaptive "Blind "A Blind Adaptive Decorrelating Detector for CDMA Systems," "Blind Interference Cancellation for the Downlink of CDMA Systems," "Blind Successive Interference Cancellation for DS-CDMA Systems," "Self-Recovering Equalization and Carrier Tracking in Two-Dimensional Communication Systems," Unsupervised Adaptive Filtering Random Signals and Systems. Adaptation and Learning in Automatic Systems. "Pilot Symbol-Aided Coherent Multistage Interference Canceller Using Recursive Channel Estimation for DS-CDMA Mobile Radio," "Subspace Based Estimation of the Signal to Interference Ratio for CDMA Cellular Systems," --TR
blind interference cancellation;successive interference cancellation;iterative refinement
598755
A Conceptual Model and Rule-Based Query Language for HTML.
Most documents available over the Web conform to the HTML specification. Such documents are hierarchically structured in nature. The existing data models for the Web either fail to capture the hierarchical structure within the documents or can only provide a very low level representation of such hierarchical structure. How to represent and query HTML documents at a higher level is an important issue. In this paper, we first propose a novel conceptual model for HTML. This conceptual model has only a few simple constructs but is able to represent the complex hierarchical structure within HTML documents at a level that is close to human conceptualization/visualization of the documents. We also describe how to convert HTML documents based on this conceptual model. Using the conceptual model and conversion method, one can capture the essence (i.e., semistructure) of HTML documents in a natural and simple way. Based on this conceptual model, we then present a rule-based language to query HTML documents over the Internet. This language provides a simple but very powerful way to query both intra-document structures and inter-document structures and allows the query results to be restructured. Being rule-based, it naturally supports negation and recursion and therefore is more expressive than SQL-based languages. A logical semantics is also provided.
Introduction Most documents available over the web conform to the HTML specication. They are intended to be human readable through a browser and thus are constructed following some common conventions and often exhibit some hierarchical structure. How to represent such documents at the conceptual level is an important issue. In the past several years, a number of data models have been developed in the database community in order to retrieve data from the web, such as UnQL [6], OEM [27], Strudel [9], etc. For a survey, see [12]. These proposals mainly use rela- tional, graph-based or tree-based data models to represent the web data. They focus on inter-document structures, with little attention to intra-document structures and thus fail to capture the hierarchically structure within HTML documents. For example, none of the existing data models can represent Michael Ley's DBLP bibliography HTML document at http://www.informatik.uni-trier.de/ley/db shown in Figure 1 in a natural and simple way. 50 MENGCHI LIU AND TOK WANG LING Because of the di-culties with HTML, XML [5] is fast emerging as the dominant standard for data representation and exchange over the web. It provides natural support for describing the hierarchical structure in web documents and allows specic markup to be created for specic data. The World Wide Web Consortium (W3C) has recently recommended the Document Object Model (DOM) as an application programming interface for HTML and XML documents [30]. DOM denes the logical structure of documents and the way a document is accessed and manipulated. It represents documents as a hierarchy of various node objects. With DOM, programmers can access, change, delete, add or build HTML or XML documents, and navigate their structure. Nev- ertheless, DOM is a very low level data model for HTML/XML documents as it is intended for programmers to write programs to access and manipulate HTML and XML documents, rather than for the user to nd the information within the documents. W3C has also recommended XPath [7] as a language for operating on the abstract, logical structure of an XML document, rather than its surface syntax. It models an XML document as a tree of various nodes at a level higher than DOM, such as element nodes, attribute nodes, text nodes, etc. However, how to describe the abstract, logical structure of an HTML document still remains an open problem. Another important issue is how to query large HTML documents and perform inference, not only based on their inter-document structures but also on their intra-document structures to obtain useful information. In the past few years, a number of query languages and systems have been developed in the database community to retrieve data from the web, such as W3QS [8], WebSQL [23], WebLog [16], UnQL [6], Lorel [2], WebQOL [3], Strudel [9] and Florid [14]. For surveys, see [1, 11, 24]. Because they are based on the data models that are limited as mentioned above, they fail to support queries over intra-document structures. For example, CIA World Factbook web site at http://www.odci.gov/cia/publications/factbook/ contains abundant detailed information about each country (and region) in the world in an HTML document, such as its location, geographic coordinates, area, land boundaries, coastline, popula- tion, age structure, birth rate, GDP, budget, etc. But there is no simple way to query such information, let alone to infer any useful information. The purpose of this paper is twofold. We rst propose a novel conceptual model for HTML, called HTML-CM, which stands for HTML Conceptual Model. This conceptual model has only a few simple constructs but is able to represent the complex hierarchical structure within HTML documents at a level that is close to human conceptualization/visualization of the documents. Based on this conceptual model, we then present a rule-based language to query HTML documents over the Internet, called HTML-QL, which stands for HTML Query Language. This language provides a simple but very powerful way to query both intra-document structures and inter-document structures and allows the query results to be restruc- tured. Being rule-based, it naturally supports negation and recursion and therefore is more expressive than SQL-based languages. A logical semantics for HTML-QL is also provided. A CONCEPTUAL MODEL AND RULE-BASED QUERY LANGUAGE FOR HTML 51 The rest of the paper is organized as follows. Section 2 proposes the conceptual model HTML-CM and shows how to automatically convert HTML documents into HTML-CM. Section 3 presents the rule-based query language HTML-QL, including its syntax, query examples, and logical semantics. Section 4 brie y describes the implementation of our web search and inference system that supports HTML-CM and HTML-QL. Section 5 summarizes and points out further research issues. This paper is a major revision of the two conference papers in [19, 21]. 2. HTML-CM: A Conceptual Model for HTML In this section, we rst introduce HTML-CM, our conceptual model for HTML. Then we discuss how to convert HTML documents into HTML-CM. We assume the existence of two kinds of symbols: a set U of URLs, and a set C of constants. Note that U is a subset of C. 2.1. Conceptual Model Each web document in HTML is considered structured in HTML-CM. They have a title and a body. Our purpose is to extract conceptual structures within HTML documents. To this end, we ignore the features that are used to enhance the visual aspects of HTML documents, such as fonts, colors, style, etc. Denition 1. The notion of objects is dened recursively as follows. 1 A constant c 2 C is a lexical object. be an object and u 2 U . Then ohui is a linking object, and o is called the label and u is called the anchor of the linking object. 3 Let a; o be objects. Then a ) o is an attributed object, and a is called the attribute and o is called the value of the attributed object. are objects with n > 1, then is a list object. In an object-relational database, we can have homogeneous tuples and sets. Tuple elements can be accessed using attribute names while set elements are directly accessed. In an HTML document, we may have attributed objects together with other objects. Thus, it is sometimes impossible to distinguish tuples from sets. In addition, HTML documents conceptually supports lists instead of sets as duplication is allowed and the order of elements exists. Thus, we use list objects for tuples, sets and lists in HTML-CM. The attribute names can be used to access components of list objects that matches them. 52 MENGCHI LIU AND TOK WANG LING Example 1 The following are examples of objects: Lexical objects: Computer Science, Database Systems Linking objects: F acultyhfaculty:htmli, Jim Carterh=faculty=carter=i Attributed objects: Title ) CS Department, Location ) Europe List object: fTitle ) CS Dept, Researchhresearch.htmlig A web document available over the Internet has an associated URL that is used to access the web document. Denition 2. Let u be a URL and t an object. Then is a web object. The web documents have many kinds, such as HTML, postscript, pdf, audio, video, etc. In this paper, we mainly focus on HTML documents. We model an HTML document as a list object. Example 2 The following is an example of web object that represents an HTML document at a given URL: Title )CSDept, Peoplehpeople.htmli)f Facultyhfaculty.htmli, Stahsta.htmli, Studentshstudents.html ig, Programs )f Ph.D Programhphd.htmli, M.Sc Programhmsc.htmli, B.Sc Programhbsc.htmlig, Researchhresearch.htmli Note that a linking object is dierent from a web object even though it is somewhat similar to a web object. A web object corresponds to a web document while a linking object is simply part of a web object that represents an HTML document. Example 3 Consider part of the latest DBLP bibliography server of Michael Ley at http://www.informatik.uni-trier.de/ley/db shown in Figure 1. It can be represented as a web object in HTML-CM as shown in Figure 2 with simplied URLs such as a 1 etc. to t in the paper. As the above examples show, HTML-CM provides an intuitive representation of the complex hierarchical structure within HTML documents at a high level that is close to human conceptualization/visualization of the documents. None of the other data models can do so in such a simple way. A CONCEPTUAL MODEL AND RULE-BASED QUERY LANGUAGE FOR HTML 53 Figure 1. DBLP Bibliography 2.2. Converting HTML Documents HTML documents are intended to be human readable though a browser. They are constructed following some common conventions and often exhibit some hierarchical structure. By examining a large number of HTML documents, we have discovered a set of general rules that can be used to convert HTML documents into web objects in HTML-CM. In this subsection, we present the conversion rules top-down and recursively using the operator C and give some examples. As HTML documents are not parsed, they may have syntactic errors. To make our presentation simple, we assume that HTML documents are syntactically correct, while the implementation can be fault-tolerant like most web browsers. We focus on HTML 4.01 [28], the latest version of HTML. 54 MENGCHI LIU AND TOK WANG LING Title )DBLP Bibliography, Search Bibliographies Books )fCollectionshb 51 i, DB Textbookhb 52 ig, By Subjectshb 4 i )fDatabase Systemshb 61 i, Logic Proghb 62 i, IRhb 63 igg, Full Text )ACM SIGMOD Anthologyhc 1 i, Reviews )ACM SIGMOD Digital Reviewhc 2 i, Links )f Research Groups )fDatabase Systemshd1i, Logic Programminghd2ig, Computer Science Organizationhe 1 i )f ACMhe IEEE Computer Societyhe 15 i(DLhe Related Services hf 1 i )f CoRRhf 11 i, Research Indexhf 12 i, NZ-DLhf 13 i, CS BibTexhf 14 i, HBPhf 15 i, Virtual Library hf Figure 2. DBLP Web Object with Simplied URLs Our conversion method is mainly based on the contents shown with a web browser and therefore we ignore the features that are used to enhance the visual aspects of the web documents, such as fonts, colors, style, etc. We assume that there is an HTML interpreter that can be used to parse the HTML les, remove optional tags and irrelevant components, and automatically identify the corresponding components for our denition below in HTML documents based on various tags, such as An HTML document starts with tag and ends with tag. It normally consists of two parts: head and body. The head mainly species the title of the document while the body species the contents of the HTML document. HTML documents can be classied into two kinds based on the kind of the contents: Frame-based documents whose body starts with and ends with , and regular documents whose body starts with and ends with . Frame-based documents The purpose of frame-based documents is to allow the visitor to see more than one page at a time, without completely cluttering up their screen. Frame-based documents have a number of frames in their body and each frame contains its own HTML document. We convert frame-based document as follows. A CONCEPTUAL MODEL AND RULE-BASED QUERY LANGUAGE FOR HTML 55 Rule 1 Let DF be a frame-based document with frames or nested framesets its body: <frameset and ] be list concatenation operator. Then DF is converted into a list of two attributed objects using the operator C as follows: "U"> be a frame, where N is the name and U is the URL of the frame. Then C(F Rule 3 Let F be a frame set, where each F i for 1 i n is a frame or a nested frameset. Then C(F In other words, we convert a possibly nested frameset into a list object and each frame in a frameset into a linking object in the list object. Regular documents Regular documents are the main ones that provide various information over the Internet. We convert them into list objects as follows. Rule 4 Let DR be a regular document with sections S 1 ; :::; Sn in its body: )g. Sections In HTML documents, there can be two kinds of sections: sections with a heading and sections without a heading. If a section has a heading, then we can convert it into an attributed objects with the heading as its attribute and the rest as its value. If it has no heading, we just convert its contents. Rule 5 Let be a section with a heading H and contents T and S section without a heading. Then Example 4 Consider the following HTML document: Computer Science Department History The department was founded in 1970. Programs The department offers B.Sc. M.Sc. and Ph.D degrees Facilities The department has up to date equipment and software This HTML document has 3 sections with headings. Using Rules 4 and 5, we can obtain the following list object: fTitle )Computer Science Department, History )The department was founded in 1970, Programs )The department oers B.Sc. M.Sc. and Ph.D degrees, Facilities )The department has up to date equipment and softwareg Within a section, there may be a sequence of paragraphs, lists, tables, etc. In what follows, we discuss how to convert them using the operator C. Paragraphs A paragraph in a section immediately follows the tag . Some paragraphs may have an emphasized beginning that is usually bold, italic, etc. or is followed by a colon ':'. We convert them into attributed objects as follows. Rule 6 Let R be a paragraph with an emphasized beginning and P a paragraph without an emphasized beginning, where t is either b, i, em, or strong. Then C(P C(R). If R has logical parts R 1 ; :::; Rn with n 1, then Each logical part R i for 1 i n is converted as a paragraph recursively. Example 5 The following is a section of CIA World Factbook page about Canada at http://www.odci.gov/cia/publications/factbook/. It consists of a sequence of paragraphs. Geographic coordinates: Map references: North America Area: total: 9,976,140 sq km land: 9,220,970 sq km Land use: arable land: 5% permanent crops: 0% permanent pastures: 3% forests and woodland: 54% other: 38% (1993 est.) A CONCEPTUAL MODEL AND RULE-BASED QUERY LANGUAGE FOR HTML 57 Using Rule 6, we obtain the following list object: fLocation )Northern North America, Geographic coordinates )60 00 N, 95 00 W Map references )North America, Area )f total )9,976,140 sq km, land )9,220,970 sq kmg Land use )f arable land )5%, permanent crops )0%, permanent pastures )3%, forests and woodland )54%, other )38% (1993 est.)gg Multimedia Features and Hypertexts HTML documents can contain multi-media features such as images, applets, video clips, sound clips, etc. In HTML-CM, we convert such features into attributed objects using keywords Image, Applet, Video, Sound, etc. as their attributes. In HTML, image les are referenced using image links. At the conceptual level, we only care about the information related to the images in the HTML document. Rule 7 Let I = <img alt="T"> be an image link, where U is a URL and T is a string. Then When the alt eld is missing, we treat it as alt="". The cases for other multimedia features are handled in a similar way. In HTML, hypertext links are used to link to other documents. We convert such links into linking objects as follows. Rule 8 Let be a hypertext link, where U is a URL and T is a string. Then Rule 9 Let S be a character string. Then Example 6 Consider the following paragraph without emphasized heading: <a href="dick.html">Dick likes <a href="jane.html">Jane It has three logical units and thus can be converted into the following object: fDickhdick.htmli, likes, Janehjane.htmlig Lists HTML supports three kinds of lists: ordered lists, unordered lists and de- nition lists. One can also nest one kind of list inside another. be an ordered or unordered list, where t is either ol or ul. Then Rule 11 Let be a deni- tion list. Then Rule 12 Let I = T T 1 . Tm be a nested ordered or unordered list item where t is either ol or ul. Then Example 7 Consider the following HTML document containing nested lists: CS Department Research Research Areas Artificial Intelligence Cognitive Science Linguistics Reasoning Database Systems Query Processing Data Models Active DB Research Groups and Labs Programming Languages Intelligent Systems Natural Language Lab Using Rules 4, 5, 10, and 12, we obtain the following list object: A CONCEPTUAL MODEL AND RULE-BASED QUERY LANGUAGE FOR HTML 59 fTitle )CS Department Research, Research Areas )f Articial Intelligence )f Cognitive Science, Linguistics, Reasoningg, Database Systems )f Query Processing, Data Models, Active DBgg, Research Groups and Labs )f Programming Languages, Intelligent Systems, Natural Language Labggg Example 8 Consider the following HTML document containing a denition list: Graduate Studies in CS General Information The department was established in 1970 Programs of Study It offers M.Sc, and Ph.D in Computer Science Financial Support A variety of scholarships are available Facilities The research labs have all kinds of state-of-the-art equipment Using Rules 4 and 11, we obtain the following list object: fTitle )Graduate Studies in CS, General Information )The department was established in 1970, Programs of Study )It oers M.Sc, and Ph.D in Computer Science, Financial Support )A variety of scholarships are available, Facilities )The research labs have all kinds of state-of-the-art equipmentgg Tables Tables in HTML are used to arrange data into rows and columns of cells. Tables may have caption and column/row headings. Tables can be used in two dierent ways: to present a list with a better layout or to present real tabular information. We convert tables as follows. Rule 13 Let be a table with a caption and T be a table without a caption, where H is the caption and TC is the table contents. Then Rn be rows other than the row for column headings in the table contents TC. Then )g. For each row R i with 1 i n: 1 if the table has column headings H 1 ; :::; Hn and each row R i has a row heading 2 if the table has column headings H 1 ; :::; Hn , but each row R i has no row 3 if the table does not have column headings but each row R i has a row heading: 4 if the table has neither column nor row headings, then for each row R Example 9 Consider the following table in an HTML document: <caption Babies Adults Total Becket 5 22 27 Worthington 7 5 12 Using Rule 13 Case 1, we can obtain the following attributed object: Bear Sightings )f Northampton)fBabies )2, Adults )4, Total )6 g, Becket )fBabies )5, Adults )22,Total )27g, Worthington )fBabies )7, Adults )5, Total )12gg In HTML documents, tables without column headings and row headings are often used to arrange items for visual eects. Consider the following portion of an HTML document: <h2 align="center"> Faculty Profiles <table border="0" cellpadding=3 cellspacing=3 align=center> A CONCEPTUAL MODEL AND RULE-BASED QUERY LANGUAGE FOR HTML 61 <td colspan=50% align=left> <a href="/faculty/bunt/">Rick Bunt <td colspan=50% align=left> <a href="/faculty/carter/">Jim Carter <td colspan=50% align=left> <a href="/faculty/cheston/">Grant Cheston <td colspan=50% align=left> <a href="/faculty/cooke/">John Cooke Using Rule 13 Case 4 and Rule 8, we can obtain the following attributed object: Faculty Proles )f Rick Bunth/faculty/bunt/i, Grant Chestonh/faculty/cheston/i, John Cookeh/faculty/cooke/i, Forms HTML forms enable visitors to communicate with the web server. There are two basic parts of a form: the structure that consists of text elds, text areas, buttons, and menus that the visitor sees and lls out on a page, and the processing part that process the information the visitor lls out using CGI script typically written in Perl or some other programming language. Conceptually, we are interested in the structure part; that is, what kind of information is presented and can be communicated with the web server. Each element on a form has a name and a value/type associated with it. The name identies the data that is being sent, the value is the data that is built-in the HTML document, the type species the kind of value that comes from the visitor. HTML supports two ways to send information to the web server: GET and POST. The GET method appends the name-value pairs to the end of the URL and is for small amount of data. The POST method sends a data le with the name-value pairs to the server's standard input without size limit. Using either GET or POST is mainly a physical level concern and does not have much conceptual value. A form normally has two special buttons: submit and reset. The submit button is used to send the information and the reset button is used to reset the form. Rule 14 Let F be a form as follows where are the elements in the form. )g. Note that we don't keep information about the submit and reset buttons in the result as we make Form a reserved attribute in HTML-CM to indicate that its value are used for communication with the web server and those two buttons are implied. We now discuss how to convert elements on forms. First, a text eld is a one line area that allow the user to input text. Rule 15 Let "> be a text eld, where L is the label visible to the user, T is the type for the input text, N is the name for the text eld that is not visible to the user, and V is the default value. Field )fLabel )L, Name )N , Type )T , Value )V g. Text areas in HTML are text elds that can span several lines. They are converted in a similar way. Radio buttons on forms are used to let the user make only one choice from a set of alternatives. Rule R be a group of radio buttons with the same name of the following form, where L is the label for the group, N is the name, V i is the value, and L i is the label visible to the user. Buttons )fLabel )L, Name )N , Options )ffLabel )L 1 , Value )V 1 g, fLabel )Ln ,Value )Vn gg While radio buttons can accept only one answer per set, check boxes allow the visitor to check as many check boxes as they like. It is converted in a similar way. Menus allow visitors of HTML document to enter information easily. It serves the same purpose as radio buttons or check boxes but takes up less space. Rule 17 Let M be a menu of the following form, where L is the label for the menu visible to the user, N is the name for the menu, V i is the value, and L i is the label visible to the user. <option <option Options )ffLabel )L 1 , Value )V 1 g, fLabel )Ln , Value )Vn gg A CONCEPTUAL MODEL AND RULE-BASED QUERY LANGUAGE FOR HTML 63 Example 11 Consider the following portion of an HTML document: <form method=post action="http://site.com/cgi-bin/get_menu"> Username:<input type="Text" name="Name" value="Enter a name here"> Age Category <select <option <option <option It is converted into the following object in HTML-CM: Text Field )f Label )Username, Name)Name, Type )Text, Value )Enter a name hereg, Label )Age Category, Name)Category, Options )f fLabel )13-19, Value )teenagerg, fLabel )20-60, Value )adultg, fLabel )over 60, Value )seniorgg Radio Button )f Label )Sex, Name )Gender, Options )f fLabel )Female, Value )femaleg, fLabel )Male, Value )maleggg 3. HTML-QL: A Rule-based Query Language for HTML In this section, we present a rule-based language called HTML-QL to query web objects, based on the conceptual model HTML-CM discussed above. First, we dene the syntax; then we give some examples; nally, we dene the semantics. To make our presentation simpler, we use sets instead of lists in HTML-QL, but the results can be extended to lists too. 3.1. Syntax of HTML-QL Besides the set U of URLs and the set C of constants, we also assume the existence of a set V of variables started with '$' followed by a string and `$' itself is an anonymous variable. Denition 3. The terms are dened recursively as follows: 1 A constant is a lexical term. If X is a constant or a variable, then Xhi is a label term. 3 If Y is a URL or a variable, then hY i is a anchor term. 4 If X is a constant or a variable, and Y is a URL or a variable, then XhY i is a linking term, and X is called the label and Y is called the anchor of the linking term. 5 If X and Y are terms, then X ) Y is an attributed term. are distinct terms with n 0, then is a set term. 7 A variable is either an lexical term, a linking term, a label, an anchor, an attributed term, or a set term depending on the context. Example 12 The following are several examples of terms: Lexical terms: CS Dept, John Smith, $Name Label terms: Facultyhi, Journalshi, $Labelhi Anchor terms: hfac.htmli, hjournals.htmli, h$URLi Linking terms: Facultyhfac.htmli, Facultyh$Ui, $Labelh$URLi Attributed terms: Title )CS Dept, Program )f$Dg, $A )$V, $A )$Lh$Ui, $Ah$Ui)$V Set terms f$Xg, f$X, Johng, fAuthorh$Uig A term is ground if it has no variables. Note that ground terms are simply objects. Denition 4. The expressions are dened as follows: U be a URL or a variable, and T a term. Then U : T is a positive expression. If P is a positive expression, then :P is a negative expression. 3 Arithmetic, string and set operation expressions are dened using terms in the usual way. For readers familiar with deductive databases or logic programming, the URL u in positive expression negative expression functions as a predicate and T in as a term. As we can use a variable in the place of u, HTML-QL is in fact a higher-order language. A CONCEPTUAL MODEL AND RULE-BASED QUERY LANGUAGE FOR HTML Example 13 The following are several examples of expressions where u stands for some constant URL: Positive expressions: Negative expressions: Arithmetic expressions: String expressions: Set expressions: John 2 $Faculty, An expression is ground if it contains no variables. A ground positive expression is a web object. Denition 5. A rule has the form A :{ L 1 ; :::; Ln , where A is a positive expression each L i is a positive expression, a negative expression, or an arithmetic, string or set operation expression dened using terms. A rule is safe if all variables in the head are covered or limited as dened in [4, 17, 18, 29]. For a negative expression with a set term in the body of a rule, we can move the negation sign into the set for convenience. For example, we can use f:Faculty)fJohngg to stand for fFaculty)fJohngg. We can also combine positive and negative expressions with the same URL for convenience. For example, we can use the expression to stand for in the body of a rule. Note that the anonymous variable $ may appear several times in a rule and their dierent occurrences in general stand for dierent variables. Thus, it cannot appear in the head of a safe rule. In deductive database languages, a query is normally dened as a rule with empty head. If the query contains no variables, the query result is either true or false. If the query contains variables, the query result is a set of bindings that make each ground query true. However, for the web queries, we want not only the set of bindings that make the query true but also proper restructuring of the query results. The head of the rule can be used for this purpose. Also, complex queries over the web objects may need more than one rule to express. Thus, we introduce our notion of query as follows. Denition 6. A query is a set of safe rules whose heads have the same URL. In order to make queries easier to express, we introduce the following shorthands for rules, terms and expressions appearing in rules: stands for X ) stands for 3 A :{ ::: n X::: stands for the following A :{ :::X::: A :{ :::$:X::: A :{ ::: $:::$ |{z} If there are several such dot notations in a rule, then it stands for their various combinations as outlined above. 4 A :{ ::: X::: stands for A :{ ::: c X::: for some xed number c. stands for A :{ 6 A :{ :::hXi:Y stands for A :{ In other words, n stands for 0 to n anonymous variables in the path. 3.2. Query Examples The following queries are based on the DBLP web object shown in Figure 2. To make them simple, we use u l to stand for the URL http://www.informatik.uni- trier.de/ley/db and u for the URL of the query result. the contents of the document at the given URL u l into a local le given by the URL Note that no matter what document pointed by u l is, such as HTML, XML, postscript, image, executable, etc., it is copied to the destination u processing. If we know that the document is in HTML and we want to convert it into HTML-CM, then we can use the following query instead: It says that every element denoted by $X in the set is also an element in the result set. The notion f$Xg in the body of the rule means that $X is an element in the corresponding set whereas the notion f$Xg in the head of the rule is used to group the result into a set. It corresponds to a partial set term in Relationlog [18]. List the objects under the attribute The result to this query based on the web object in Figure 2 is as follows: List the anchors (URLs) under the attribute The result is fAnswer )fa 1 ; a 2 ; a 3 ; a 4 gg List the labels under the attribute A CONCEPTUAL MODEL AND RULE-BASED QUERY LANGUAGE FOR HTML 67 The result is fAnswer )fAuthor, Title, Advanced, Home Page Searchgg. This query can also be represented equivalently using the dot notation in HTML-QL as follows: List all the attributes at the rst and second levels: The result is fAnswer )fTitle, Search, Bibliographies, .gg. This query can also be represented equivalently using the dot notation as follows: (Q 6 ). Obtain the URL of TODS: The result is fAnswer )b 22 g all the URLs in the page. all the URLs together with their labels. (Q 9 ). Get all the URLs reachable from the page. Note that this query involves multiple web objects and the rules are recursive since the result web object dened is used in the body of the second rule. all the URLs together with their labels reachable from the page. In order to demonstrate the expressive power of HTML-QL, let us consider the CIA world factbook 2000 at http://www.odci.gov/cia/publications/factbook. This web server contains detailed information about each country (and region) in the world in HTML format, such as its location, geographic coordinates, area, land boundaries, costline, population, age structure, birth rate, GDP, budget, etc. We can view the web server as a set of simplied web objects as shown in Figure 3 and therefore we can query them and infer useful information. Title )Canada, Title )USA, Body )f Body )f Geographic )f Geographic )f Land boudaries )f Land boudaries )f border countries )fUSg border countries )fCanada, Mexicog Title )Mexico, . Body )f Geographic )f franceURL: f . g Land boudaries )f . border countries )fUSA, .g Figure 3. CIA World Factbook Find countries that border both Germany and France. border country )fGermany, Francegg The result is fAnswer )fBelgium, Luxemburg, Switzerlandgg countries that border Germany but not France. border country )fGermanyg, The result is fAnswer )fAustria, Czech Republic, Denmark, Frence, Netherlands, Polandgg. Note that this query involves negation. Find pairs of countries/regions that border the same countries. countries )$Csg, countries )$Csg, The result to this query is as follows: A CONCEPTUAL MODEL AND RULE-BASED QUERY LANGUAGE FOR HTML 69 fAnswer )ffRegion1 )Bhutan, Region2 )Nepalg, )Holy See (Vatican City), Region2)San Marinog, fRegion1 )Hong Kong, Region2 )Macaug, )United Arab Emirates, Region2 )Yemengg Note that in this query, the construct fRegion1)$N1, Region2)$N2g in the hread is used to form a pair of countries (or regions) while the outside pair of brackets is used to group the result tuples into the set. Find all the countries that can be reached from Canada by land transportation means. countries )f$Cgg countries )f$Cgg Note that this is another recursive query. 3.3. Semantics of HTML-QL In this subsection, we dene the Herbrand-like logical semantics for HTML-QL. We rst dene terminology that is needed later in this subsection. Denition 7. The Herbrand universe UH of HTML-QL is the set of all ground terms that can be formed. In other words, UH is the domain of all possible objects. Denition 8. The Herbrand base BH of HTML-QL is the set of all ground positive expressions that can be formed using terms in UH . That is, BH is the set of all possible web objects that can be formed. Denition 9. A web database WDB is a subset of BH . In other words, a web database is a set of web objects. For example, the CIA world factbook shown in Figure 3 is a web database. Denition 10. A ground substitution is a mapping from the set of web variables V f$g to UH . The use of anonymous variables and dot notations in the body of rules allows us to express queries easier as demonstrated in the examples above. However, when dealing with the semantics, a ground substitution cannot map the anonymous variable to several dierent objects. To simplify our presentation, we assume that each occurrence of the anonymous variable is replaced by a non-anonymous variable that never occur in the query rules so we do not have to map anonymous variable to any object. We also assume that the rules here do not contain shorthands. Given a web database, the positive expressions in the body of a query rule is actually a query that is used to match part of one or more web objects. Thus, we introduce the following notions. Denition 11. An object o is part-of of an object denoted by only if one of the following hold: 1 both are constants and 2 both are linking objects such that one of the following holds: 3 both are attributed objects: such that a a 0 and 4 both are set objects such that for each that The part-of relationship between objects captures the fact that o is part of Example 14 The following are several examples: Faculty Faculty Faculty Facultyhfac.htmli Programs )fM.Sc Programg Programs )fPh.D Program, M.Sc Programg fTitle )CS Deptg fTitle )CS Dept, Facultyhfac.htmlig We extend the part-of relationship to web objects and web databases as follows. Denition 12. Let be two web objects. Then W is denoted by W W 0 , if and only if Denition 13. Let WDB and WDB 0 be two web databases. Then WDB is part-of denoted by WDB WDB 0 , if and only if for each W 2 WDB WDB 0 , there exists W 0 2 WDB 0 WDB such that W W 0 . Denition 14. Let WDB be a web database. The notion of satisfaction (denoted by j=) and its negation (denoted by 6j=) based on WDB are dened as follows. 1 For a ground positive expression only if there exists A CONCEPTUAL MODEL AND RULE-BASED QUERY LANGUAGE FOR HTML 71 2 For a ground negative expression only if WDB 6j= 3 For each ground arithmetic, string, or set operation expression , WDB if and only if is true in the usual sense. 4 For a rule r of the form A :{ only if for every ground substitution , WDB Example 15 Let WDB denote the web database containing the DBLP web object in Example 3. Then we have WDB WDB WDB WDB Denition 15. Let Q be a query. A model M of Q is a web database that satises Q. A model M of Q is minimal if and only if for each model N of Q, M N . As in deductive databases, we are interested in a minimal model of the query that can be computed bottom-up. We now continue to dene the bottom-up semantics. Denition 16. Let WDB be a web database and Q a set of rules. The immediate logical consequence operator TQ over WDB is dened as follows: there exists a ground substitution such that WDB Example Consider query Q 4 in the last subsection and the web database WDB the same as in Example 15, we have Note that the operator TQ does not perform grouping. Therefore, we introduce the following notions. Denition 17. Two objects are compatible if and only if one of the following holds: 1 both are constants and are equal; 72 MENGCHI LIU AND TOK WANG LING are compatible; 3 both are set objects. A set of objects are compatible if and only each pair in it is compatible. Example 17 The following pairs are compatible: Author and Author fAuthorg and fTitleg Answer )fAuthorg and Answer )fTitleg Denition 18. Two web object are compatible if and only if are compatible. A set of web objects are compatible if and only if each pair of them is compatible. Example The following set of web objects are compatible. Denition 19. Let S be a set of (web) objects and S 0 a compatible subset of S. Then S 0 is a maximal compatible set in S if there does not exist a (web) object that is compatible with each object in S 0 . Denition 20. Let S be a set of objects. The grouping operator G is dened recursively on S as follows: 1 If S is a singleton set 2 If S is a compatible set of attributed objects 3 S is a set of set objects, then is a maximal compatible set of objectsg It is extended to a set of web objects as follows: 1 If S is a compatible set of web objects of the form u 2 If S is divided into maximal compatible subsets S 1 ; :::; Sn such that A CONCEPTUAL MODEL AND RULE-BASED QUERY LANGUAGE FOR HTML 73 Denition 21. The powers of the operation TQ over the web database WDB are dened as follows: Example 19 Continuing with the Example 16, we have fAnswer )fAuthorgg, fAnswer )fTitlegg, fAnswer )fAdvancedgg, fAnswer )fHome Page Searchggg) Theorem 1 Let WDB be a web database and Q a query. Then G(TQ " !(WDB)) is a minimal model of Q. Proof: It is essentially the same as the proof in [18] Denition 22. Let WDB be a web database and Q a query. Then the semantics of Q under WDB is given by G(TQ " !(WDB)). 4. Implementation Based on the conceptual model HTML-CM and the rule-based query language HTML-QL presented in the previous sections, we have developed a prototype system for web search and inference. The system will soon be available from the web site http://www.scs.carleton.ca/mengchi/HTML-QL. In this section, we brie y describe the system. The high level architecture of the system is shown in Figure 4. The system is organized into four layers. The rst layer is the entire world-wide web on the Internet. Because HTML documents are not only generated automatically by specic application programs such as FrontPage and CoeeCup, but also written by human manually, it is quite common that some documents have syntactic errors. Like commercial web browsers such as Internet Explorer and Netscape, our system can tolerate syntactic errors. The second layer is the Intelligent Wrapper that implements HTML-CM. It accesses the world-wide web through the Internet, fetches HTML documents and Browser Interface Textual Interface Search and Inference Processor Intelligent Wrapper World Wide Web Local Data Repository Figure 4. High Level System Architecture converts them into web objects in HTML-CM. In order to speed-up query process- ing, the Intelligent Wrapper also caches web objects in the local data repository and builds proper indexes on these web objects. It allows the user to adjust web objects by adding, adjusting or deleting attributes or objects and it can also learn the pattern from the user's interaction and then process similar HTML documents accordingly. For these reasons, it is called the intelligent wrapper. The third layer of the system is the Search and Inference Processor that implements HTML-QL. It is mainly in charge of query processing. It obtains queries to be processed from the user interface layer and checks whether or not web objects involved are in the local data repository. If web objects involved are not in the local data repository, then it invokes the Intelligent Wrapper to fetch them. Then it uses semi-naive bottom-up x-point computation to generate the result and sends the query result to the user interface layer for proper display. The last layer is the User Interface. Two kinds of interfaces are supported: textual interface and browser interface. They provide dierent kinds of environment for the user to issue commands and express queries, perform syntactical analysis, and pass valid commands in internal format to the Search and Inference Processor. They also display query results generated by the Search and Inference Processor to the user in dierent format, the web objects generated by the Intelligent Wrapper, and original web document like lynx and Netscape respectively. 5. Conclusion The main contributions of the paper are the following. First, we have proposed a conceptual model HTML-CM for HTML documents. Unlike other data mod- A CONCEPTUAL MODEL AND RULE-BASED QUERY LANGUAGE FOR HTML 75 els that mainly focus on inter-document structures and hyperlink navigation, our conceptual model focuses on the complex hierarchical structure within the HTML documents (intra-document structure). It only has a few simple but powerful high level constructs that can be used to best describe the contents in HTML docu- ments. The HTML documents represented in this conceptual model are close to human conceptualization/visualization of the documents. We have also presented a set of generic rules to automatically convert HTML documents into this conceptual model. Discovering rules to structure the HTML documents has already been addressed in the literature such as [10, 13, 15, 25, 26]. However, the rules presented in this paper are more general and systematic. During the conversion, we ignore many features that are used to enhance the visual aspects of the web documents. In other words, we lose some information during conversion. Thus, we cannot convert web documents in our conceptual model back into HTML format. However, we can capture the essence of HTML documents in a natural and intuitive way. Second, we have presented HTML-QL, a rule-based language for querying HTML documents over the Internet based on HTML-CM. Unlike other web query lan- guages, HTML-QL provides a simple but very powerful way to query both the intra-document structures and inter-document structures and allows the query results to be restructured. Furthermore, HTML-QL has a rm logical foundation, which is lacking in most other web query languages. The prototype system that supports HTML-CM and HTML-QL have been implemented and will soon be available from the web site http://www.scs.carleton.ca/mengchi/HTML-QL. The query language and system can be easily extended to handle XML documents. We note that although the approach works well on many HTML documents, it is still the case that HTML pages can be found where it is di-cult to extract useful information. We would like to extend the functionality of HTML-QL by incorporating other useful features to make it a really useful tool for web search and inference and investigate the computability and complexity issues of HTML- QL queries. Using HTML-QL, we would also like to develop data extraction and data integration tools based on the method proposed in [22, 20]. Our objective is to build an intelligent web search engine on top of the search and inference system. Acknowledgments The research was partially supported by research and equipment grants from the Natural Sciences and Engineering Research Council of Canada (NSERC). The authors are also grateful to Yibin Su for implementing the system. --R Querying Semistructured Data. The Lorel Query Language for Semistructured Data. WebOQL: Restructuring Documents Set Construction in a Logic Database Language. Extensible Markup Language (XML) 1.0. A Query Language and Optimization Techniques for Unstructured Data. XML Path Language (XPath) Version 1.0. A Query Language for a Web-Site Management System Reasoning About Web-Site Structure Database Techniques for the World-Wide Web: A Survey Database Techniques for the World-Wide Web: A Survey Extracting Semistructured Information from the Web. On a declarative semantics for web queries. Modeling Web Sources for Information Integration. A Declarative Language for Querying and Restructuring the Web. ROL: A Deductive Object Base Language. Relationlog: A Typed Extension to Datalog with Sets and Tuples. A Conceptual Model for the Web. A Data Model for Semistructured Data with Partial and Inconsistent Information. Integration of Semistructured Data with Partial and Inconsistent Information. Querying the World Wide Web. Formal Models of Web Queries. Hierarchical Wrapper Induction for Semistructured Information Sources. Object Exchange across Heterogeneous Information. Principles of Database and Knowledge-Base Systems Document Object Model (DOM) Level 2 Speci --TR --CTR Mengchi Liu , Tok Wang Ling, Towards semistructured data integration, Web-enabled systems integration: practices and challenges, Idea Group Publishing, Hershey, PA,
HTML query language;rule-based query language;fixpoint logical semantics;data model for HTML;conceptual modeling
598838
Bijective and General Arithmetic Codings for Pisot Toral Automorphisms.
Let T be an algebraic automorphism of {\Bbb T}^m having the following property: the characteristic polynomial of its matrix is irreducible over \Bbb Q, and a Pisot number is one of its roots. We define the mapping &phiv;t acting from the two-sided -compactum onto {\Bbb T}^m as follows: \varphi_t is a fundamental homoclinic point for T, i.e., a point homoclinic to 0 such that the linear span of its orbit is the whole homoclinic group (provided that such a point exists). We call such a mapping an arithmetic coding of T. This paper aimed to show that under some natural hypothesis on (which is apparently satisfied for all Pisot units) the mapping &phiv;t is bijective a.e. with respect to the Haar measure on the torus. Moreover, we study the case of more general parameters t, not necessarily fundamental, and relate the number of preimages of &phiv;t to certain number-theoretic quantities. We also give several full criteria for T to admit a bijective arithmetic coding and consider some examples of arithmetic codings of Cartan actions. This work continues the study begun in &lsqb;25&rsqb; for the special case m &equals; 2.
Introduction Let T be an algebraic automorphism of the torus T m given by a matrix M 2 GL(m;Z) with the following property: the characteristic polynomial for M is irreducible over Q , and a Pisot number > 1 is one of its roots (we recall that an algebraic integer is called a Pisot number if it is greater than 1 and all its Galois conjugates are less than 1 in modulus). Since det i.e., an invertible element of the ring We will call such an automorphism a Pisot automorphism. Note that since none of the eigenvalues of M lies on the unit circle, T is hyperbolic. This denition is invariant in the following sense: if M is irreducible and one of its eigenvalues (, say) lies outside the unit disc in the complex plane and all the other lie inside it, then it is obvious that either or is a Pisot number. In the \inverse" situation (one eigenvalue is inside and the others are outside) it is either 1 or 1 . We will call T that falls into one of this categories a generalized Pisot automorphism. Our model will cover all generalized Pisot automorphisms { see Remark 21. Our goal is to present a symbolic coding of T which, roughly speaking, reveals not just the structure of T itself but the natural arithmetic of the torus as well. Let us give more precise denitions. Let X denote the two-sided -compactum, i.e., the space of all admissible two-sided sequences in the alphabet f0; []g. More precisely, a representation of an of the form is called the -expansion of x if the \digits" f" k g 1 are obtained by means of the greedy algorithm (similarly to the decimal expansions), i.e., " 1. The set of all possible sequences is called the (one-sided) -compactum and denoted by X . A sequence whose tail is 0 1 will be called nite. The -compactum can be described more explicitly. Let be the expansion of 1 dened as follows: d 0 2. If the sequence n g is not nite, we put d n d 0 n . Otherwise let k 1), where bar stands for the period of a purely periodic sequence. We will write fx n g 1 fy n g 1 fy n g 1 1 and x n < y n for the smallest such that x n 6= y n . Then by denition, (see [18]). Similarly, we dene the two-sided -compactum as Both compacta are naturally endowed with the weak topology, i.e. with the topology of coordinate-wise convergence, as well as with the natural shifts. Let the -shift act as follows: be the corresponding one-sided shift on X . For a Pisot the properties of the -shift are well-studied. Its main property is that it is soc, i.e., is a factor of a subshift of nite type. In fact this is equivalent to fd n g 1 being eventually periodic (see, e.g., the review [6]). We extend the -expansions to the nonnegative integers in the usual way (similarly to the decimal expansions). There is a natural operation of addition in X , namely, if both sequences " and " 0 are nite to the left (i.e., there exists N 2 Z such that " " 00 such that Later we will show that under some natural assumption on this operation can be extended to sequences which are not necessarily nite to the left. Lemma 1 (see [4], [21]) Any nonnegative element of the ring Z[] has an eventually periodic -expansion if is a Pisot number. Let F in() denote the set of nonnegative x's whose -expansions are nite. Ob- viously, F in() Z[] but the inverse inclusion does not hold for an arbitrary Pisot unit. Denition 2 A Pisot unit is called nitary if A large class of Pisot numbers considered in [11] is known to have this property. A practical algorithm for checking whether a given Pisot number is nitary was suggested in [1]. Here is a simple example showing that not every Pisot unit is nitary. Let r 3, and i.e., is not nitary. Denition 3 A Pisot unit is called weakly nitary if for any - > 0 and any there exists f 2 F in() \ [0; -) such that x When the present paper was in preparation, the author was told that this condition had in fact been considered in the recent work by Sh. Akiyama [3], in which the author shows that the boundary of the natural soc tiling generated by a weakly nitary Pisot has Lebesgue measure zero (moreover, these conditions are actually equivalent). The author is grateful to Sh. Akiyama for drawing his attention to this paper and for helpful discussions. A slightly weaker (but possibly equivalent) condition together with the niteness of fd 0 was used in the Ph.D. Thesis [13] to show that the spectrum of the Pisot substitutional dynamical system (where purely discrete. This claim is a generalization of the corresponding result for a nitary from [27] (see also [28]). Conjecture 4 Any Pisot unit is weakly nitary. To support this conjecture, we are going to explain how to verify that a particular Pisot unit is weakly nitary. Firstly, one needs to describe all the elements of the set has a purely periodic -expansiong: (2) Lemma 5 (see [3]). The set Z is nite. Proof. The sketch of the proof is as follows: basically, the claim will follow from (see below), which implies that the denominator of any 2 P in the standard basis of Q() is uniformly bounded, whence the period of the -expansion of is bounded as well. Therefore, we have a nite collection of numbers f qg to \check for periods" (here q is the denominator of 0 dened by (7) in the standard basis of the ring). Next, it is easy to see that if su-ces to check that Denition 3 holds for any x = 2 Z (see [3]). Moreover, we can conne ourselves to the case is the period of . Indeed, if such an f exists, do as well, and we will be able to make f arbitrarily small. As was shown in [3], there exists a \universal neutralizing word" f which will suit for all periods of Z . Note that all known examples of Pisot units prove to be weakly nitary. We will need the following technical result. Lemma 6 A Pisot unit is weakly nitary if and only if the following condition is there exists such that for any - > 0 and any x 2 Z[] there exists f 2 F in() \ [-) such that x Proof. It su-ces to show that if is weakly nitary, then in question does exist. Let be weakly nitary; then we know that there exists f 0 2 F in() such that for any 2 Z we have +f 0 2 F in(). Let has the -expansion loss of generality we may regard p to be greater than the the period of the sequence fd n g 1 (as p is not necessarily the smallest period of ). Since f 0 can be made arbitrarily small, we may x it such that for any 2 Z . Put := f 0 (provided (3) is satised). . By Lemma 1, the -expansion of x is eventually periodic, and splitting it into the pre-periodic and periodic parts, we have . Let for simplicity of notation whole picture is shift-invariant). It will now su-ce to check the condition for - The rst sum in brackets in (4) belongs to F in() and so does the second term. In view of (3) and the denition of X , the whole sum in (4) belongs to F in() as well, because by our choice of p we have necessarily 2 Formulation of the main result and rst steps of the proof We recall that the hyperbolicity of T implies that it has the stable and unstable foliation and consequently the set of homoclinic points. More precisely, a point t 2T m is called homoclinic to zero or simply homoclinic if T (as is well known, the convergence to 0 in this case will be at an exponential rate). In other terms, a homoclinic point t must belong to the intersection of the leaves of the stable foliation L s and the unstable foliation L u passing through 0. Let H(T ) denote the set of all homoclinic points for T ; obviously, H(T ) is a group under addition. In [30] it was shown that every homoclinic point can be obtained by applying the following procedure: take a point n project it onto L u along L s . Let s denote this projection; nally, project s onto the torus by taking the fractional parts of all its coordinates. The correspondence n known to be one-to-one. We will call -coordinate of a homoclinic point t and n the Z m -coordinate of t. Note that since T is a Pisot automorphism, we have dimL We wish to nd an arithmetic coding ' of T in the following sense: we choose X as a symbolic compact space and impose the following restrictions on a map 1. ' is continuous and bounded-to-one; 2. 3. any pair of sequences nite to the left. In [25] it was shown that if The proof for an arbitrary m is basically the same, and we will omit it. Our primary goal is to nd an arithmetic coding that is bijective a.e. Let us make some historic remarks. Note that the idea of using homoclinic points to \encode" ergodic toral automorphisms had been suggested by A. Vershik in [29] for and was later developed for a more general context in numerous works { see [30], [16], [24], [25], [22]. The choice of X as a \coding space" is special in the case in question; indeed, the topological entropy of the shift is known to be log and so is the entropy of T . In a more general context (for example, if M has two eigenvalues outside the unit disc) it is still unclear, which compactum might replace X . Indeed, since ' is bounded-to-one, the topological entropy of the subshift on this compactum must have the same topological entropy as T , i.e., log are the conjugates of , and there is apparently no natural subshift associated with which has this entropy. However, it is worth noting that the existence of such compacta in dierent settings has been shown in [30], [15], [22]. Note that if one allows to use slightly altered symbolic transformations (not necessarily shifts), then there is a hope to give a more explicit expression for the codings of non-Pisot automorphisms via coding of the higher-rank actions { see examples at the end of the paper. Return to our context. The mapping ' t dened by (5) is indeed well dened and continuous, as the series (5) converges at an exponential rate. Furthermore, since we have by continuity ' t does semiconjugate the shift and a given automorphism T . We will call ' t a general arithmetic coding for T (parameterized by a homoclinic point t). Lemma 7 For any choice of t the mapping ' t is bounded-to-one. Proof. Let kk denote the distance to the closest integer, s be the R m -coordinate of t and e T denote the linear transformation of R m dened by the matrix M . Let 'N;t be the mapping acting from X into R m by the formula s: Then by (5), where Therefore, it su-ces to show that the diameters of the sets N;t (X ) are uniformly bounded for all N . We have (recall that [] const is the maximum of the absolute values of the conjugates of that do not coincide with . This proves the lemma. Let the characteristic equation for be and T denote the toral automorphism given by the companion matrix M for , i.e., We rst assume the following conditions to be satised: 1. T is algebraically conjugate to T , i.e., there exists a matrix C 2 GL(m;Z) such that 2. A homoclinic point t is fundamental, i.e., hT n t 3. is weakly nitary. The notion of fundamental homoclinic point for general actions of expansive group automorphisms was introduced in [17] (see also [22]). Remark 8 Note that the second condition implies the rst one, as the mere existence of a fundamental homoclinic point means that T T (see Theorem Conversely, if T T , then there is always a fundamental homoclinic point for T . Indeed, let n be the Z m -coordinate of t 0 . Then t 0 is a fundamental for T and if Now we are ready to formulate the main theorem of the present paper. Theorem 9 Provided the above conditions are satised, the mapping ' t dened by (5) is bijective a.e. with respect to the Haar measure on the torus. Remark. In [25] the claim of the theorem was shown for 2. We wish to follow the line of exposition of that paper, though it is worth stressing that our approach will be completely dierent (rather arithmetic than geometric). In [22] this claim was shown for any nitary and it was conjectured that it holds for any Pisot automorphism satisfying conditions 1 and 2 above. We give further support for this conjecture, as Theorem 9 implies that we actually reduced it to a general conjecture veriable for any given Pisot unit (see Conjecture 4). The rest of the section as well as the next section will be devoted to the proof of Theorem 9; in the last section we will discuss the case when conditions 1 and 2 are not necessarily satised. We need the following number-theoretic claim. Let It is obvious that P is a group under addition. There exists Z[] such that Proof. By the well-known result, for any Pisot ; 2 P , 2 Q () and denotes the trace of an element & of the extension Q(), i.e., the sum of all its Galois conjugates) { see, e.g., [8]. Since is a unit, Thus, if we regard Z[] as a lattice over Z, then by (8), P is by denition the dual lattice for Z[]. Hence by the well known ramication theorem (see, e.g., [10, Chapter III]) the equality (7) follows with km . We are going to carry out the proof of the main theorem in several steps. (description of the homoclinic group). Lemma 11 Any homoclinic point t for T has the R m -coordinate where Proof. We have M As was mentioned above, the dimension of the unstable foliation L u is 1, whence since Now the claim of the lemma follows from (7). Let U denote the group of units (= invertible elements) of the ring Z[]. Lemma 12 There is a one-to-one correspondence between the group U and the set of fundamental homoclinic points for T . Namely, if t is fundamental, then u in is a unit and vice versa. Proof. Suppose t is fundamental. Then the homoclinic point t 0 whose R m - coordinate is s can be represented as a nite linear integral combination of the powers T k t, i.e., whence u Therefore, u is invertible in the ring Z[]. Conversely, if u 2 U , then using the same method, we show that the claim of the lemma follows from the fact that the equation always has the solution in Z[], namely, (reduction to To prove Theorem 9, we may without loss of generality assume Then there is a natural one-to-one correspondence between H(T ) and H(T ), namely, bijective a.e., then so is 'Ct , as be a general fundamental homoclinic point for T given by (9). In this case the formula (5) turns into the following one: Step 3 (the pre-image of 0). Let Z be dened by (2). Lemma 13 The preimage of 0 can be described as follows: O := ' 1 " is purely periodic andX" j j 2 Z g: Proof. By Lemma 7, O is nite and since it is shift-invariant, it must contain purely periodic sequences only. Let whence by (7), u 2 Z[], and 2 Z[], because u 2 U . Step 4 (description of the full preimage of any point of the torus). We are going to show that ' t is \linear" in the sense that for any two sequences "; their \dierence" will belong to O . More precisely, let " (N) denote the sequence its \value" e (N) := . There is an almost one-to-one correspondence between the set of sequences f" (N) g and R+ , namely Lemma 14 If ' t any N 1 there exists 2 Z such that Proof. Fix t (fxg) for some x 2 T m and let E denote the set of all partial limits (in X ) of the collection of sequences j" (N) is the sequence whose \value" is je (N) (e 0 ) (N) j. It su-ces to show that E O . Let by denition, there exists a sequence of positive integers fN k g such that - (N k and we are done. Therefore, if (fxg) for some x 2 T m , then we know that to obtain any t (fxg), one may take one of the partial limits of the sequence f" (N) for 2 Z ; perhaps, depending on N . We will write Conclusion. Thus, we reduced the proof of Theorem 9 to a certain claim about the two-sided -compactum. Roughly speaking, our goal now is to show that the procedure described above will not change an arbitrarily long tail of a generic sequence will not change " itself. 3 Final steps of the proof and examples Let denote the measure of maximal entropy for the shift (X ; ), and be its one-sided analog. We wish to prove that "g. Step 5 (estimation of the measure of the \bad" set). We will need some basic facts about the measure . For technical reasons we prefer to deal with its one-sided . Lemma 15 There exists a constant C such that for any n 2 and any (i 1 , Proof. Let the mapping and n (C n (")). The Garsia Separation Lemma [12] says that there exists a constant " and " 0 are two sequences in X and K n . Hence where L 1 denotes the Lebesgue measure on [0; 1]. Since for any > is equivalent to L 1 and the corresponding density is uniformly bounded away from 0 and 1 (see [19]), we have for some K 0 > 1, whence by the fact that is one-to-one except for a countable set of points, and the claim of the lemma holds with There is a natural arithmetic structure on X the sum of two sequences " and " 0 is dened as the sequence equal to the -expansion of the sum f g. denote the set of nite words of length n that are extendable to a sequence in by writing noughts at all places starting with n+1. We will sometimes identify with the set F in n () 1g. By the sum (" In [11] it was shown that there exists a natural L such that if F in n () and (). Recall that by Lemma 6 there exists such that the quantity f in Denition 3 can be chosen in (-) instead of (0; -). We set log and We can reformulate the hypothesis that is weakly nitary as follows ( denotes the -expansion of for any (" 1 there exists (" such that (13) A direct consequence of Lemma 15 is Corollary 16 For any (i 1 , Lemma 17 If (i and (j , then (i . Proof. The claim follows from the denition of X (see Introduction) and the fact that the positive root 0 of the equation x is the smallest Pisot number [9]. Indeed, 5 is a subshift of nite type, namely, Now the desired claim follows from [18, Lemma 3] asserting that if 0 < , then Let We will write n. The meaning of the above denitions consists in the fact that if for some n 1 and by the theorem from [11] mentioned above, (more precisely, the tail will stay unchanged starting with the (n+L+ 1)'th symbol). It is obvious that We wish to prove that 1. By the ergodicity of (X ), we have su-ces to show that Proposition There exists a constant Proof. We have Y Since Y we have Now by the formula (14), being weakly nitary (see (13)) and the denition of L we have for any k 1 and any (i . Hence and from (16) we nally obtain the estimate whence one can take As a by-product we obtain the following claim about the irrational rotations of the circle by the elements of Z[]. Let, as above, denote the -expansion of . Theorem 19 For a weakly nitary Pisot unit and any 2 Z[] \ [0; 1) we have -a.e. . Proof. We showed that Conclusion of the proof of Theorem 9. Fix k 2 N . To complete the proof of Theorem 9, it su-ces to show that the set has the full measure . By Proposition 18, for (D (k) Hence (D (D (k) and therefore \ which implies (12). We have thus shown that for -a.e. Let L denote the image of under ' t . Since is ergodic, so is L and since log as well. Hence is the Haar measure on the torus, as it is the unique ergodic measure of maximal entropy. So, we proved that which is the claim of Theorem 9. As a corollary we obtain the following claim about the arithmetic structure of X itself. Proposition 20 Let denote the equivalence relation on X dened by (11) and is a group isomorphic to T m . Thus, X is an almost group in the sense that it su-ces to \glue" some k-tuples (for k < 1) within the set of measure zero to turn the two-sided -compactum for a weakly nitary Pisot unit into a group (which will be isomorphic to the torus of the corresponding dimension). Note that in dimension 2 this factorization can be described more explicitly { see [25, Section 1]. Remark 21 In fact, we covered all generalized Pisot automorphisms (see the beginning of Introduction), i.e., Indeed, in the case the same coding ' will conjugate the inverse shift 1 and T . In the case the mapping conjugates 0 and T , where 0 it follows from Proposition 20 that the operation " 7! " is well dened a.e. on X . The following claim is a generalization of Theorem 4 from [26]. Let D(T ) denotes the centralizer for T , i.e., Proposition 22 For a Pisot automorphism whose matrix is algebraically conjugate to the corresponding companion matrix there is a one-to-one correspondence between the following sets: 1. the fundamental homoclinic points for T ; 2. the bijective arithmetic codings for 3. the units of the ring Z[]; 4. the centralizer for Proof. We already know that any bijective arithmetic coding is parameterized by a fundamental homoclinic point. Let t 0 be such a point for T ; then any other fundamental homoclinic point t satises us 0 , where s 0 and s are the corresponding R m -coordinates and u 2 U { the proof is essentially the same as in Lemma 12. On the other hand, if ' t is a bijective arithmetic coding for T , then as easy to see, is a toral automorphism commuting with T (this mapping is well dened almost everywhere on the torus, hence it can be dened everywhere by continuity). Finally, if u 2 U and belongs to GL(m;Z) and commutes with M and vice versa. Example 1. (see [24]) Let T be given by the matrix . Here is the golden ratio, p= 1+2and Any bijective arithmetic coding for T thus will be of the form For more two-dimensional examples see [25]. Example 2. Let T be given by the matrix M =@ Here is the real root of the \tribonacci" equation x as is well known, is nitary in this case (see, e.g., [11]). We have since Z[] is the maximal order in the eld Q () and both conjugates of are complex, again (recall that by Dirichlet's Theorem, U must be \one-dimensional", see, e.g., [7]). Hence any bijective arithmetic coding for T is of the form 22 n 2C AmodZ 3 ; Example 3. Let M =@ 3 4 1 Here is the positive root of x By the result from [2], is nitary (see Introduction for the denition), and it is easy to guess that the fundamental units of the ring are and 1 Besides, 2. Hence any bijective arithmetic coding is either or Example 4. Finally, let M =B B @ us show that is weakly nitary. A direct inspection shows that the only nonzero period for the positive elements of Z[] is 10000. Hence Z g. Let, for example, we have by periodicity 1. The other cases of 2 Z are similar. Hence is weakly nitary and we can apply Theorem 9. It su-ces to compute U ; by the Dirichlet Theorem, it must be \two-dimensional" and it is easy to guess that the second fundamental unit (besides itself) is 1+. Hence U Zg and the formula for a bijective arithmetic coding can be derived similarly to the previous examples in view of 4 General arithmetic codings and related algebraic results In this section we will present some results for the case when t is not necessarily fundamental or T is not algebraically conjugate to the companion matrix automorphism. We will still assume to be weakly nitary. Let us begin with the case general t. We recall that there exists a natural isomorphism between the homoclinic group H(T ) and the group P , i.e., t be dened as above: . The question is, what will be the value of #' 1 (x) for a The next assertion answers this question; it is a generalization of the corresponding result proven in [25] for and for a nitary in [23]. Let the discriminant of in the eld extension Q()=Q , i.e., the product are the Galois conjugates of . Theorem 23 For an a.e. x with respect to the Haar measure, where N() denotes the norm of an element of the extension Q()=Q . Proof. Let ' 0 denote the bijective arithmetic coding for T parameterized by then one can consider the mapping A := ' ' 1 will be well dened on the dense set and we can extend it to the whole torus. By the linearity of both maps, A is a toral endomorphism. Thus, we have Let A 0 is given by the formula A 0 . For the basis sequence f with the unity at the rst coordinate we have Therefore, by the linearity and continuity, we have A . As ' 0 is 1-to-1 a.e., ' will be K-to-1 a.e. with j. By denition, N(') is the determinant of the matrix of the multiplication operator x 7! 'x in the standard basis of Q (), whence given by the companion matrix. Finally, as by the result from [20, Section 2.7], N( 0 whenever 0 is as in formula (7). Note that historically the rst attempt to nd an arithmetic coding for a Pisot automorphism (actually, even for a Pisot endomorphism, i.e., an endomorphism of a torus with the same property as a Pisot automorphism) was undertaken in [5]. The author considered the case given by the R m -coordinate From the above theorem follows Corollary 24 The mapping is jDj-to-1 a.e. Suppose now T is not necessarily algebraically conjugate to T . Let M be, as usual, the matrix of T , and for n 2 Z m the matrix BM (n) be dened as follows (we Lemma 25 Any integral square matrix satisfying the relation Proof. Let B be written column-wise as follows: (18) and the denition of M , whence by the fact that Denition 26 The integral m-form of m variables dened by the formula will be called the form associated with T . Proposition such that for Lm -a.e. point x Proof. Let e is a certain bijective arithmetic coding for T . Then e B is a linear mapping from T m onto itself dened a.e.; let the same letter denote the corresponding toral endomorphism. Then e B. Therefore the matrix B of the endomorphism e by Lemma and we are done. As a consequence we obtain Theorem 28 The minimum of the number of pre-images for an arithmetic coding of a given automorphism T equals the arithmetic minimum of the associated form f M . Remark 29 It would be helpful to know whether there is any relationship between the n in the proposition and the Z m -coordinate of t. Theorem 30 The following conditions are equivalent: 1. A Pisot automorphism T admits a bijective arithmetic coding. 2. T is algebraically conjugate to T . 3. The equation has a solution in 4. There exists a homoclinic point t such that for its Z m -coordinate n, Proof. (2))(1): see Remark 8; (1))(2): see the Proposition 27; also follows from Proposition 27; (2),(4): it is obvious that M satises this property (take Hence so does any M which is conjugate to M . Recall that a matrix M 2 GL(m;Z) is called primitive if there is no matrix 2. Following [25], we ask the following question: can a Pisot toral automorphism given by a non-primitive matrix admit a bijective arithmetic coding? Note rst that one can simplify the formula for f M . Namely, since the determinant of a matrix stays unchanged if we multiply one column by some number and add to another column, we have Proposition There exists a sequence of integers N n () such that More precisely, a (1) a (1) a (1) (m 1)n where fa (j) are dened as the coe-cients of the equation derived from (6). Proof. By (19), the denition of a (j) n and the Hamilton-Cayley Theorem, a (j) a (j) Corollary non-primitive matrix M n 2 GL(m;Z) is algebraically conjugate to the corresponding companion matrix if and only if so is M , and N n Let us deduce some corollaries for smaller dimensions. Corollary 33 (see [25]) For the automorphism given by a non-primitive admits a bijective arithmetic coding if and only if Corollary 34 For the matrix algebraically conjugate to the corresponding companion matrix if and only if satises one of the following equations: 1. 2. 3. Proof. We have N 2 1. The case thus leads to subcases 1 and 3 and k subcase 2. Note that if M is the matrix for the \tribonacci automorphism" (see Example 2), then apparently the only power of M greater than 1 that is algebraically conjugate to the corresponding companion matrix, is the cube! Indeed, N 2 It seems to be an easy exercise to prove this rigorously; we leave it to the reader. Example 5. Let M =@ 1 1 0 and the form associated with M is (we write Obviously, the Diophantine equation f M (x; has a solution, namely, Hence by Theorem 30, M is algebraically conjugate to M ; for ex- conjugates them. To show that T admits a bijective arithmetic coding, it su-ces to check that is weakly nitary. A direct inspection shows that the set of periods for the elements of Z here is f0; the \universal neutralizing word" (see Introduction) is 13. The author would like to thank Sh. Akiyama for this computation. In [25] the author together with A. Vershik considered the case 2. Here if a b c d , then for and we related the problem of arithmetic codings to the classical theory of binary quadratic forms. In particular, T admits a bijective arithmetic coding if and only if the Diophantine equation is solvable. The theory of general m-forms of m variables does not seem to be well developed; nonetheless, we would like to mention a certain algebraic result which looks rele- vant. Recall that two integral forms are called equivalent if there exists a unimodular integral change of variables turning one form into another. Proposition in GL(m;Z) be algebraically conjugate, and is equivalent either to f M 2 or to f M 2 , and moreover where A 0 is the transpose of A (we identify a form with the symmetric matrix which denes it). Proof. Since M 1 and M 2 are conjugate, they have one and the same characteristic polynomial. By the denition of f M we have which is equivalent to (20). In the end of the paper we would like to present two examples of arithmetic codings for higher-rank actions on tori that can be obtained as a consequence of the main construction of this paper. We refer the reader to the recent work [14] for the necessary denitions and references. Let the automorphism T of T 3 is given by the matrix from Example 3, namely, denote the leading eigenvalue. Then the group of units for Z[] is generated by itself and (which is also a Pisot unit). Let T 0 be given by M it is also a Pisot matrix algebraically conjugate to the corresponding companion matrix. Then the (Cartan) action generated by M and M 0 can be encoded by a certain action on X ; namely, bijective arithmetic coding of T and 0 given by the formula It is easy to see that 0 is well dened for almost all the sequences in X { as is will be well dened for any sequence having the block of L zeroes innitely many times to the left, where L is large enough. Besides, ' conjugates the action ) on X and the Cartan action (T; T 0 ) on the 3-torus. It is worth noting that for this example the homoclinic groups for T and T 0 coincide or, in terms of the ring, One may argue that both generators of this action are both generalized Pisot automorphisms. This is true but let us give another example, this time of a Cartan action on T 4 . Namely, let M =B B @ Note M is a companion matrix, and its spectrum is purely real. Now take the action generated by M It is easy to check that they all belong to GL(4; Z) and that this will yield a Cartan action on T 4 as well as the fact that the dominant eigenvalue of M is indeed weakly nitary. We leave the details to the reader. Therefore, the usual encoding mapping ' conjugates the action ( ; id) on the compactum X and the Cartan action has two eigenvalues inside the unit disc and two outside. Perhaps, this is the rst ever explicit bijective a.e. encoding of a non-generalized Pisot automorphism (though not by means of a shift). We believe that the underlying ideas of these examples can be extended to more general Cartan actions; however, there are obvious problems that arise in doing so. They are as follows: 1. to show that any Pisot unit with the real conjugates is weakly nitary (see Introduction 2. to nd out whether a given Cartan action contains a Pisot automorphism whose matrix is conjugate to its companion matrix (of course, every Cartan action is known to contain some Pisot automorphism); 3. if so, nd it in such a way that a given element of is a linear integral combination of the powers of this Pisot automorphism. For instance, this is true if the ring Z[] is the maximal order of the eld Q (), where is, as usual, the dominant eigenvalue of the matrix of the Pisot automorphism in question { see [14]. We plan to develop this direction elsewhere. Acknowledgement . This research was supported by the EPSRC grant number GR/L98923. The author wishes to thank Anatoly Vershik for our fruitful collaboration in dimension 2 in [25] and numerous helpful suggestions. The author is grateful to A. Manning for stimulating discussions that led to the previous example. --R Number theory (Eger Cubic Pisot units with On the boundary of self-a-ne tiling generated by Number Theory An Introduction in Diophantine Approximation Dufresnoy and C. Theory Dynam. Arithmetic properties of Bernoulli convolutions Linear Numeration Systems Rigidity of measurable structure for Z d - actions by automorphisms of a torus Arithmetic construction of so Un codage so Homoclinic points of algebraic Z d Algebraic Theory of Numbers On periodic expansions of Algebraic codings of expansive group automorphisms and two-sided beta-shifts An arithmetic group associated with a Pisot unit Ergodic properties of Erd Bijective arithmetic codings of hyperbolic automorphisms of the 2-torus Bijective codings of automorphisms of the torus The simultaneous action of adic transformation and Markov shift on torus Arithmetic isomorphism of the toral hyperbolic automorphisms and so --TR
pisot automorphism;integral form;arithmetic coding;homoclinic point
599252
Interpolation models with multiple hyperparameters.
A traditional interpolation model is characterized by the choice of regularizer applied to the interpolant, and the choice of noise model. Typically, the regularizer has a single regularization constant , and the noise model has a single parameter . The ratio / alone is responsible for determining globally all these attributes of the interpolant: its complexity, flexibility, smoothness, characteristic scale length, and characteristic amplitude. We suggest that interpolation models should be able to capture more than just one flavour of simplicity and complexity. We describe Bayesian models in which the interpolant has a smoothness that varies spatially. We emphasize the importance, in practical implementation, of the concept of conditional convexity when designing models with many hyperparameters. We apply the new models to the interpolation of neuronal spike data and demonstrate a substantial improvement in generalization error.
Introduction In this paper our philosophy of generalization is as follows: the best generalization will be achieved by a Bayesian model that is well-matched to the problem and that is accurately implemented. The aim of obtaining the best generalization is thus subsumed under the aim of searching for good models. In this paper we expand the space of interpolation models by introducing additional hyperparameters, and demonstrate that the generalization performance on a real problem is substantially improved. A traditional linear interpolation model 'H 1 ' is characterized by the choice of the regularizer R, or prior probability distribution, that is applied to the interpolant; and the choice of noise model N . The choice of basis functions A used to represent the interpolant may also be important if only a small number of basis functions are used. Typically the regularizer is a quadratic functional of the interpolant and has a single associated regularization constant ff, and the noise model is also quadratic and has a single parameter fi. For example, the splines prior for the function y(x) (Kimeldorf and Wahba 1970) is: 1 log ff Z dx [y (p) where y (p) denotes the pth derivative of y. The probability of the data measurements assuming independent Gaussian noise is: log (The constants in equations (1) and (2) are functions of ff and fi respectively.) When we use these distributions with find the most probable y(x) we obtain the cubic splines interpolant. For any quadratic regularizer and quadratic 1 Strictly this prior is improper since addition of an arbitrary polynomial of degree y(x) is not constrained. It can be made proper by adding terms corresponding to boundary conditions to (1). In the present implementations of the models, we enforce the boundary conditions Figure 1: An inferred spike signal from a zebra finch neuron. Courtesy of M. Lewicki and A. Doupe, California Institute of Technology. log likelihood, the most probable interpolant depends linearly on the data values. This is the property by which we define a 'linear' interpolation model. Such models may be optimized and compared using Bayesian methods as reviewed in MacKay (1992). In such models, for fixed fi, the ratio ff=fi alone determines globally all the following attributes of the interpolant: its complexity, flexibility, smoothness, characteristic scale length, and characteristic amplitude. whilst some of these terms may be synonyms, surely others describe distinct properties. Should not our models be able to capture more than just one flavour of simplicity and complexity? And should not the interpolant's smooth- ness, for example, be able to vary spatially? 1.1 Example: Neural spike modelling An example of a function from a real system is shown in figure 1; this is the action potential of a neuron deduced from recordings of 40 distinct events (Lewicki 1994). The graph was created by fitting a simple spline model (with the data. This function has one 'spiky' region with large characteristic amplitude and short spatial scale. Elsewhere the true function is smooth. However the fitted function shown in figure 1, controlled by only one regularization constant ff, overfits the noise on the right, having a rough appearance where it should plausibly be smooth. The value of ff appropriate for fitting the spiky region is too small for the rest of the curve. It would be useful here to have a model capable of capturing the concepts of local smoothness, because such a model, having a prior better matched to the real world, would require less data to yield information of the same quality. Furthermore, when different hypotheses are compared, broad priors introduce a bias toward simpler hypotheses. For example, if we ask whether one or two distinct spike functions are present in a data set, the traditional model's prior with small ff will bias the conclusion in favour of the single spike function. Only with well-matched priors can the results of Bayesian hypothesis comparison be trusted. In this paper we discuss methods for introducing multiple flavours of simplicity and complexity into a hierarchical probabilistic model in a computationally tractable way, and demonstrate new interpolation models with multiple hyper-parameters that capture a spatially varying smoothness. Prior work making use of variable hyperparameters includes the modelling of data with non-Gaussian innovations or observation noise (see, e.g., (West 1984; Carter and Kohn 1994; Shephard 1994)). The interpolation models we propose might be viewed as Bayesian versions of the 'variable bandwidth' kernel regression technique (Muller and Stadtmuller 1987). The aim of our new model is also similar to the goal of inferring the locations of discontinuities in a function, studied by Blake and Zisserman (1987). Traditional interpolation models have difficulty with discontinuities: if the value of ff=fi is set high, then edges are blurred out in the model; if ff=fi is lowered the edge is captured, but ringing appears near the edge, and noise is overfitted everywhere. Blake and Zisserman introduce additional hyperparameters defining the locations of edges. The models they use are computationally non-convex, so that finding good representatives of the posterior distribution is challenging. They use 'graduated non-convexity' techniques to find good solutions. By contrast we attempt to create new hierarchical models that are, for practical purposes, convex. Tractable hierarchical modelling: Convexity Bayesian statistical inference is often implemented either by Gaussian approximations about modes of distributions, or by Markov Chain Monte Carlo methods (Smith 1991). Both methods clearly have a better chance of success if the posterior probability distribution over the model parameters and hyperparameters is not dominated by multiple distinct optima. If we know that most of the probability mass is in just one 'hump', then we know that we need not engage in a time-consuming search for the more probable optima, and we might hope that some approximating distribution (e.g., involving the mode of the distribution) might be able to capture the key properties of that hump. Furthermore, convex conditional distributions may be easier to sample from with, say, Gibbs sampling methods (Gilks and Wild 1992). It would be useful if all the conditional and marginal probability distributions of our models were log convex: probability distribution is log convex if there is a representation x of the variables such that the matrix M defined by log P (x) (3) is everywhere positive definite. It is hard, however, to make interesting hierarchical models such that all conditional and marginal distributions are log convex. We introduce a weaker criterion: model is conditionally convex if its variables can be divided into groups such that, for every group, their distribution conditioned on any values for the other variables is log convex. An example of a conditionally convex model is the traditional interpolation model with three groups of variables: D (data), w (parameters), and ff (one hyperparameter). The probability distribution P (Djw; convex over D (it is Gaussian). The distribution P (wjD; ff) is log convex over w (it is Gaussian). And the distribution P (ffjw; over ff (it is a Gamma distribution). That a model is conditionally convex does not guarantee that marginal distributions of all variables are unimodal. For example the traditional model's posterior marginals P (wjD) and P (ffjD) are not necessarily unimodal; but good unimodal approximations to them can often be made (MacKay 1996). So we conjecture that conditional convexity is a desirable property for a tractable model. We now generalize the spline model of equation (1) to a model with multiple hyperparameters that is conditionally convex, and demonstrate it on the neural spike data. We then discuss general principles for hierarchical modelling with multiple hyperparameters. 3 A new interpolation model We replace the regularizer of equation (1) by: log Z dx ff(x)[y (p) where ff(x) is written in terms of hyperparameters thus: and the constant of equation (4) is a function of ff(x; u) which becomes important when ff(x; u) is inferred. The exponentiated quantity has the form of a linear interpolant using basis functions / h (x). In the special case we obtain the traditional single alpha model. This representation is chosen because (1) it embodies our prior belief that ff(x) should be a smooth function of x, and (2) the model is conditionally convex (a partial proof is given in section 4). When implementing this model we optimize the hyperparameters u and fi by maximizing the marginal likelihood or 'evidence', Z where k is the dimensionality of our representation y of y(x). Some authors view this 'empirical Bayes' approach as controversial and inaccurate (Wolpert 1993), but it is widely used under various names such as 'ML-II', and is closely related to 'generalized maximum likelihood' (Gu and Wahba 1991). The ideal Bayesian method would put a proper prior on the hyperparameters and marginalize over them, but optimization of the hyperparameters is computationally more convenient and often gives predictive distributions that are indistinguishable (MacKay 1996). We use a discrete representation of y(x) and ff(x) on a finely spaced grid, y, ff(x; u) ! fff c j ff(x c ; u)g and / In this representation the Hessian of the log posterior is a sum of band-diagonal terms from the log prior and a diagonal matrix from the log likelihood, A j \Gammarr logP (yjD; fffg; fiI. The gradient of the log evi- dence, which we use for the optimization, is then: @ log @ log P (Djfff c g) (7) where @ log P (Djfff c Trace -2000 -2000 Figure 2: Traditional models: 2. The diamond-shaped points in the upper plots are the artifical data. The solid line shows the most probable interpolant found using the traditional single alpha model. The predictive error bars (dotted lines) are one-standard-deviation error bars. The lower row shows the errors between the interpolant and the original function to which the noise was added to make the artificial data. The predictive error bars are also shown. Contrast with figure 3. -2000 -2000 Figure 3: New models with multiple hyperparameters: 2. Top row: The diamond-shaped points are the artifical data. The solid line shows the most probable interpolant and the predictive error bars (dotted lines) are one-standard-deviation error bars. Second row: the inferred ff(x) on a log scale (contrast with the values of 5.9 \Theta10 \Gamma7 and 2:0 \Theta 10 \Gamma6 inferred for the traditional models). The third row shows the nine basis functions / used to represent ff(x). The bottom row shows the errors between the interpolant and the original function to which the noise was added to make the artificial data. The predictive error bars are also shown. The top and bottom graphs should be compared with those of figure 2. 9 Table 1: Comparison of models on artificial data. The first three columns give the evidence, the effective number of parameters, and the RMS error for each model when applied to the data shown in figures 2-3. The fourth column gives the RMS error averaged over four similar data sets. Model log fl RMS avg. RMS Evidence error error 3.1 Demonstration We made an artificial data set by adding Gaussian noise of standard deviation 1000 to the function depicted in figure 1. [This function plays the role, in these experiments, of a true underlying function; the presence of some actual roughness in this function is believed to be unimportant since our chosen noise level is substantially greater than the apparent size of the roughness.] Figure 2 shows the data, interpolated using the traditional single alpha models with 2. The hyperparameter ff was optimized by maximizing the evidence, as in Lewicki (1994). The noise level oe - was set to the known noise level. In order for the spiky part of the data to be fitted, ff has to be set to a small value, and the most probable interpolant is able in both models to go very close to all the data points. There is considerable overfitting everywhere, and the predictive error bars are large everywhere. We then interpolated the data with two new models defined by equations (4) and (5), with 2. We set the basis functions / to the hump-shaped functions shown in figure 3. These functions define a scale length on which the smoothness is permitted to vary. This scale length was optimized roughly by maximizing the evidence. The new models had nine hyperparameters u. These hyperparameters were set by maximizing the evidence using conjugate gradi- ents. Because the new models are conditionally convex, we had hoped that the maximization of the evidence would lead to a unique optimum uMP . However, there were multiple optima in the evidence as a function of the hyperparam- eters; but these did not cause insurmountable problems. We found different optima by using different initial conditions u for the optimization. The best evidence optima were found by initializing u in a way that corresponded to our prior knowledge that neuronal spike functions start and end with a smooth re- gion; we set u initially to fu h 0g. This prior knowledge was not formulated into an informative prior over u during the optimization, though doing so would probably be a good idea for practical purposes. Figure 3 shows the solutions found using the new interpolation models with 2. The inferred value of ff is small in the region of the spike, but elsewhere a larger value of ff is inferred, and the interpolant is correspondingly smoother. The log evidence for the four models is shown in table 1. The reported evidence values are log e P (Djff MP we were to make a proper model comparison we would integrate over the hyperparameters; this integration would introduce additional small subjective Occam factors penalizing the extra hyperparameters in H 2 , c.f. MacKay (1992). The root mean square errors between the interpolant and the original function to which the noise was added to make the artificial data are given in table 1, and the errors themselves are displayed at bottoms of figures 2-3. By both the evidence value and the RMS error values, the new models are significantly superior to the traditional model. Table 1 also displays the value of the 'effective number of well-determined parameters' (Gull 1989; MacKay 1992), fl, which, when the hyperparameters are optimized, is given by: Z dx ff(x)y (p) The smaller the effective number of parameters, the less overfitting of noise there is, and the smaller the error bars on the interpolant become. The total number of parameters used to represent the interpolant was in all cases 100. 3.2 Model criticism It is interesting to assess whether the observed errors with respect to the original function are compatible with the one-standard-deviation error bars that were obtained. These are shown together at the bottom of figure 3. The errors are only significantly larger than the error bars at the leftmost five data points, where the small amount of noise in the original function is incompatible with the assumed boundary conditions Omitting those five data points, we find for the new model that the other 95 errors have expectation 95 \Sigma 14), and for the of the 95 errors in either case exceed 2.5 standard deviations. We therefore see no significant evidence for the observed errors to be incompatible with the predictive error bars. 3.3 Discussion These new models offer two practical benefits. First, while the new models still fit the spiky region well (indeed the errors are slightly reduced there), they give a smoother interpolant elsewhere. This reduction in overfitting allows more information to be extracted from any given quantity of experimental data; neuronal spikes will be distinguishable given fewer samples. To quantify the potential savings in data we fitted the four models to fake data equivalent to independent observations of the function shown in figure 1, that is, data points with noise level oe (we we did this Traditional p=1 Traditional p=2 Figure 4: Average RMS error of the traditional and new models as a function of amount of data by decreasing the actual noise level in the artificial data). The figures and tables shown thus far correspond to the case of one observation, In figure 4 we show the RMS error of each model as a function of the number of data points, averaged over four runs with different artificial noise. To achieve the same performance (RMS error) as the new models, the traditional models require about three times as much data. Second, the new models have greater values of the evidence. This does not only mean that they are more probable models (assuming that the omitted Occam factors for the hyperparameters are smaller than these evidence differ- ences). It also means that model comparison questions can be answered in a more reliable way. For example, if we wish to ask 'are two distinct spike types present in several data sets or just one?' then we must compare two hypotheses: HB , which explains the data in terms of two spike functions, and HA , which just uses one function. In such model comparisons, the 'Occam factors' that penalize the extra parameters of HB are important. If we used the traditional interpolation model, we would obtain Occam factors about e 20 bigger than those obtained using the new interpolation model. Broad priors bias model comparisons toward simpler models. The new interpolation model, when optimized, produces a prior in which the effective number of degrees of freedom of the interpolant is reduced so that the prior is less broad. Of course, inference is open-ended, and we expect that these models will in turn be superceded by even better ones. Close inspection of figure 3 reveals that the smoothness assumption on the regularizer may be imperfect - we know from prior experience that the true function's spikiness is confined to a very small time interval, but the new model gives a jagged interpolant in the time interval before the spike too because the function ff(x) is assumed to vary smoothly. Future models might include a continuum of alternative values of p (non-integer values of p can be implemented in a Fourier representation). It might also make sense for the characteristic length scale of the basis functions / with which ff(x) is represented to be shorter where ff is small. The advantages conferred by the new models are not accompanied by a significant increase in computational cost. The optimization of the hyperparameters requires that the Hessian matrix be inverted a small number of times. Other approaches to the implementation of models with multiple hyperparameters could be considered. The confidence intervals in the present approach, in which the hyperparameters are optimized, are likely to be too small. One could use Markov chain Monte Carlo methods such as Gibbs sampling or hybrid Monte Carlo, both of which would involve a similar computational load (see Neal (1993) for an excellent review). We have used the Gibbs sampling software 'BUGS' (Thomas et al. 1992) to implement a similar interpolation model in which the Gaussian noise level is a spatially varying function fi(x) (MacKay 1995). 4 Some Generalizations 4.1 Strategies for making models with multiple hyperparameter We now discuss more generally the construction of hierarchical models with multiple hyperparameters. Consider a Gaussian prior on some parameters w, equivalent to the function y(x) in the earlier example. There are various ways of defining a model with multiple hyperparameters such that each hyperparameter controls a different flavour of simplicity or complexity in w. Sum Model Firstly, one might define the inverse covariance matrix as a sum: exp \Gamma2 where fC c g are arbitrary positive semi-definite matrices and ff c - 0; 8c. Covariance Sum Model Secondly, one might define the covariance matrix as a sum: Z exp@ \Gamma2 w T with hyperparameters ' c - 0; 8c. Exponential Sum Model Thirdly, we can take a sum model of the form (10) (though not necessarily using the same matrices fC c g) and rewrite the coefficients as an exponential sum: with hyperparameters u h 2 (\Gamma1; 1), so that exp \Gamma2 exp These models have very different capabilities. The sum model implements the paradigm of starting from a flexible distri- bution, then adding in extra terms ff c C c so as to kill degrees of freedom. This model has no way of introducing selective flexibility. If one hyperparameter ff c is large, there is no way that other hyperparameters can be set to undo the stiffness introduced. The covariance sum model uses an alternative paradigm, starting from a stiff distribution, and introducing lacunae of flexibility into it. The important difference between these two paradigms is that whereas the sum model is conditionally convex, the covariance sum model is not; it is possible for there to be multiple optima over the hyperparameters even in the limit of perfect data. This will be demonstrated and explained subsequently. The exponential sum model, of which the interpolation model of section 3 is an example, is intended to combine the best of both worlds. Consider the case where the matrix elements / ch are non-negative. As one hyperparameter u h is increased, it introduces selective stiffness, and as it is decreased, it introduces selective flexibility. The model, being a reparameterization of the sum model, is still conditionally convex (as long as / does not have pathological properties). 4.2 Convexity of the sum model We give a partial proof of conditional convexity for the sum model. It is straightforward to confirm that the conditional distributions P (Djw; fffg) and are log convex. The non-trivial property is that P (fffgjw; D) / (fffg)P (wjfffg) is convex. We assume that the prior over fffg is defined to be a) Sum model b) Covariance sum c) Exponential sum Figure 5: Toy problem probability contours. Each figure shows the likelihood of two hyperparameters given Hyperparameters ff a ; ca and ua are on the horizontal axes, and ff b ; cb and ub on the vertical axes. In all figures the top e 8 of the function is shown and the contours are equally spaced in log probability. convex and examine the second factor. Defining @ff c @ff d log This second derivative is negative definite. Proof For arbitrary x, c;d d 4.3 A toy illustration As an illustration, we examine the conditional convexity of a model that assigns a zero-mean Gaussian distribution to a three component vector w. This distribution is to be parameterized by two hyperparameters. For simplicity, we assume w is directly observed: This choice of w favours priors that give flexibility to component 2. Components 1 and 3 do not call for such flexibility. Sum model: We build M as a sum of two matrices, diag(1,1,0) and diag(0,1,1). Figure 5a shows the log probability log P (wjfffg) as a function of log ff a and log ff b . The function is convex. Covariance sum model: We now build M \Gamma1 as a sum of diag(1,1,0) and diag(0,1,1), letting: diag c a Figure 5b shows the log probability log P (wjfcg) as a function of log c a and log c b . The function is not convex. The two alternative flavours of flexibility compete with each other to give the required variance for component 2 of w. Either we may switch on c a to a large value, or we may switch on c b - but we may not switch on both to an intermediate degree. Exponential sum model: We build M as a sum of three matrices, diag(1,0,0), diag(0,1,0). and diag(0,0,1), with the aid of basis functions / diag This model has the same number of hyperparameters as the previous two models but uses them differently. Figure 5c shows the log probability log P (wjfug) as a function of u a and u b . The function is convex. Two alternative flavours of flexibility are embodied, but (just) do not compete with each other destructively. The sum model starts from flexibility and adds in constraints of stiffness that kill degrees of freedom in w. The covariance sum representation starts from stiffness and adds in selective flexibility to create required degrees of freedom. The covariance sum model is not convex because different forms of flexibility compete to account for the data. There is a struggle for existence, because any potential piece of flexibility is penalized by Occam factors in the det M term, encouraging it to stay switched off. In contrast, alternative ways of introducing stiffness (as in the sum model and the exponential sum model) do not compete. If two sorts of stiffness are compatible with the data, they can both be switched on without incurring any penalty. This is why the sum model is convex. The exponential sum model, we conjecture, pushes flexibility to the limits of convexity. We believe these ideas may be relevant to the design of computationally tractable Gaussian process models for non-linear regression (Williams and Rasmussen 1996). 4.4 How to represent a covariance matrix In this paper we have used interpolation of neural spike data as a test bed for the new models. We now discuss another task to which the general principles we have discussed may apply. Imagine that we wish to model correlations between k variables that are assumed to be Gaussian with a covariance matrix V that varies with other variables x. How should this varying covariance matrix V(x) be param- eterized? We assume that a representation V(U(x)) is to be used. We would like the parameterization V(U) to satisfy the following desiderata. 1. Any setting of the parameters U should produce a valid positive definite matrix V. 2. Any positive definite matrix V should be realizable by a unique value of the parameters U. 3. The parameterization and its inverse should be continuous and differentiable 4. The representation should treat all indices of the covariance matrix sym- for example, the first row of V should not be treated differently from the second row. 5. U should have k(k degrees of freedom, that being the number of independent elements in the symmetric matrix V. 6. Finally we would like the representation to be conditionally convex; that is, given one or more vectors y, the conditional probability of U should be log convex. These desiderata rule out most obvious representations of V. The raw matrix V is not permitted because it violates desideratum 1. A triangular decomposition violates 4. An eigenvector / eigenvalue representation violates 2,3,5. The 'variance component model' representation used for example in Gu and Wahba (1991) is a covariance sum representation and violates desiderata 5 and 6. The ideas of this paper motivate the following representation, which is conditionally convex. Let y be k dimensional, and let R k\Gamma1 be the unit spherical surface, with v being a unit vector in that space. As parameters we introduce a symmetric matrix U that is not constrained to be positive definite. Then we as the inverse of a sum of outer products thus: d This representation satisfies all the desiderata. Since this may not be self- evident, we include a sketch of a proof of half of property 2, namely, that the mapping from U to V is one to one. We first transform into the eigenvector basis of U (by an orthogonal transformation that leaves R k\Gamma1 invariant) and prove that the eigenvectors feg of U are also eigenvectors of V. Let fw i g be the components of v in the eigenvector basis so that where the eigenvectors and eigenvalues of U satisfy Ue . Then from equation (20) we can write Z d The integrand, for i 6= j, is antisymmetric in w i and w j , so the integral is zero in these cases. Thus e (i) e T Z d that is, V has the same eigenvectors as U, and its eigenvalues are given by: Z d Then the mapping from U to V is one to one if the above mapping from the eigenvalues of U, f- U g, to the eigenvalues of V, f- V g, is one to one. We differentiate equation (23) to obtain the Jacobian; if the Jacobian is full-rank then the mapping is one to one. @- U Z d This Jacobian is a sum of outer products of positive vectors z given by z so it either defines a positive semi-definite or a positive definite matrix. The matrix can only be positive semi-definite if there is some direction h such that having non-zero measure under the integral over R k\Gamma1 . Because the integral is over all of R k\Gamma1 , there is no such vector h. Thus the matrix is full rank, and the mapping from U to V is one to one. The only problem with this representation is that it involves a high-dimensional integral. We propose for practical purposes the following approximation: "C exp(v T c where fv c g C are fixed unit vectors lying in R k\Gamma1 , selected either at random or systematically. This representation is conditionally convex and is able to in the limit C !1. Conclusions This work builds on a data modelling philosophy previously illustrated by work on the 'Automatic Relevance Determination' model for neural networks (MacKay 1994; Neal 1996): use a huge, flexible model with an essentially infinite number of parameters; and control the complexity of the model with sophisticated regularizers. Models with large numbers of hyperparameters can, if carefully designed, be practically implemented. The hyperparameters reduce the effective number of degrees of freedom of the model in a manner appropriate to the the properties of the data, leading to substantial improvements in generalization error. Acknowledgements D.J.C.M. thanks the Isaac Newton Institute and T. Matsumoto, Waseda Uni- versity, for hospitality, and Radford Neal, Mike Lewicki, David Mumford and Brian Ripley for helpful discussions. R.T. thanks T. Matsumoto for his support. We also thank the referees for helpful feedback. --R Visual Reconstruction. On Gibbs sampling for state-space models Applied Statistics 41: Minimizing GCV/GML scores with multiple smoothing parameters via the Newton method. Developments in maximum entropy data analysis. A correspondence between Bayesian estimation of stochastic processes and smoothing by splines. Bayesian modeling and classification of neural signals. Neural Computation 6 (5): Bayesian interpolation. Bayesian non-linear modelling for the prediction competition Probabilistic networks: New models and new meth- ods Hyperparameters: Optimize Variable bandwidth kernel estimators of regression-curves Bayesian Learning for Neural Networks. Partial non-Gaussian state-space Bayesian computational methods. BUGS: A program to perform Bayesian inference using Gibbs sampling. Outlier models and prior distributions in Bayesian linear- regression Gaussian processes for regression. On the use of evidence in neural networks. --TR
convexity;regularizer;bayesian inference;neuronal spike;spline;regression
599262
Inference in model-based cluster analysis.
A new approach to cluster analysis has been introduced based on parsimonious geometric modelling of the within-group covariance matrices in a mixture of multivariate normal distributions, using hierarchical agglomeration and iterative relocation. It works well and is widely used via the MCLUST software available in S-PLUS and StatLib. However, it has several limitations: there is no assessment of the uncertainty about the classification, the partition can be suboptimal, parameter estimates are biased, the shape matrix has to be specified by the user, prior group probabilities are assumed to be equal, the method for choosing the number of groups is based on a crude approximation, and no formal way of choosing between the various possible models is included. Here, we propose a new approach which overcomes all these difficulties. It consists of exact Bayesian inference via Gibbs sampling, and the calculation of Bayes factors (for choosing the model and the number of groups) from the output using the LaplaceMetropolis estimator. It works well in several real and simulated examples.
Introduction Banfield and Raftery (1993) - hereafter BR - building on work of Murtagh and Raftery (1984), introduced a new approach to cluster analysis based on a mixture of multivariate normal distributions, where the covariance matrices are modeled parsimoniously in a geometrically interpretable way. The general finite normal mixture distribution for n data points dimensions with K groups is Y where OE(\Deltaj-; \Sigma) is the multivariate normal density with mean - and covariance matrix \Sigma, a vector of group mixing proportions such that - k - 0 and The BR approach is based on a variant of the standard spectral decomposition of \Sigma k , namely where - k is a scalar, A an orthogonal matrix for each Each factor in equation (2) has a geometric controls the volume of the kth group, A k its shape and D k its orientation. By imposing constraints such as - (i.e. each group has the same volume and shape, but they have different orientations), one obtains different models, which lead in turn to different clustering algorithms. The models considered here, including parsimonious spherically shaped ones, are listed in Table 1. BR developed algorithms aimed at maximizing the classification likelihood Y as a function of both ' and -, where - is the vector of group memberships, namely - belongs to the kth group. These algorithms use hierarchical agglomeration and iterative relocation. They worked well on several real and simulated data sets and are now fairly widely used. They are implemented in the software MCLUST, which is both an S-PLUS function and a Fortran program available from StatLib. 1 However, the BR algorithms have limitations, several of which are common to all agglomerative hierarchical clustering methods: To obtain the Fortran version, send the e-mail message "send mclust from general" to the address [email protected]. Table 1: Clustering models. The entries indicate whether the feature of interest (shape, orientation or volume) is the same for each group or not. Model \Sigma k Shape Orientation Volume 1. -I Spherical None Same 2. - k I Spherical None Different 3. \Sigma Same Same Same 4. - k \Sigma Same Same Different 5. -D k AD t k Same Different Same k Same Different Different 7. - k DA k D t Different Same Different 8. \Sigma k Different Different Different (a) They give only point classifications of each individual and produce no assessment of the associated uncertainty. (b) They tend to yield partitions that are suboptimal (even if often good). This is due to the use of hierarchical agglomeration. (c) Estimates of the model parameters ' based on the estimated partition tend to be biased (Marriott, 1975). (d) They assume the mixing proportions - k in equation (1) to be equal. (e) The algorithms based on models 5 and 6 in Table 1 require the shape matrix A to be specified in advance by the user. This is a drawback in general, although it can sometimes be useful. (f) To choose K, the number of groups, BR proposed an approximation to the posterior probabilities based on a quantity called the AWE (Approximate Weight of Evidence). While this has worked fairly well in practice, it is quite crude. (g) BR proposed no formal way of choosing among the possible models; this must be done by the user. We know of no way of fully overcoming limitations (a), (f) and (g) other than the fully Bayesian analysis that we develop here. Other possible ways of overcoming (b)-(e) are discussed in Section 4. Here we present a new approach to clustering based on the models in Table 1; it consists of fully Bayesian inference for these models via Gibbs sampling. This overcomes all the limitations mentioned. A recently proposed way of calculating Bayes factors from posterior simulation output, the Laplace-Metropolis estimator (Raftery 1995; Lewis and Raftery 1994), is used to choose the model and determine the number of groups in one step. In Section 2.1 we describe Bayesian estimation for the models of Table 1 using Markov Chain Monte Carlo methods. In Section 2.2 we outline how Bayes factors can be calculated from the MCMC output and used to determine the appropriate model and the number of groups. In Section 3 we show the methods at work on real and simulated data sets. Bayesian Inference for the Banfield-Raftery Clustering Models Using the Gibbs Sampler 2.1 Estimation We assume that the data to be classified, x , arise from a random vector with density (1) and that the corresponding classification variables - i are unobserved. We are concerned with Bayesian inference about the model parameters ', - and the classification indicators - i . MCMC methods provide a general recipe for the Bayesian analysis of mixtures. For instance, Lavine and West (1992) and Soubiran, Celeux, Diebolt, and Robert (1991) have used the Gibbs Sampler for estimating the parameters of a multivariate Gaussian mixture without assuming any specific characteristics for the component variance matrices. Diebolt and Robert (1994) have considered the Gibbs sampler and the Data Augmentation method of Tanner and Wong (1987) for general univariate Gaussian mixtures and proved that both algorithms converge in distribution to the true posterior distribution of the mixture parameters. Like these authors, we use conjugate priors for the parameters - and ' of the mixture model. The prior distribution of the mixing proportions is a Dirichlet distribution and the prior distributions of the means - k of the mixture components conditionally on the variance matrices \Sigma k are Gaussian: - k j\Sigma k - N (- prior distribution of the variance matrices depends on the model, and will be given for each model in turn. We estimate the eight models in Table 1 by simulating from the joint posterior distribution of -, ' and - using the Gibbs sampler (Smith and Roberts 1993). In our case, this consists of the following steps: 1 Simulate the classification variables - i according to their posterior probabilities namely 2 Simulate the vector - of mixing proportions according to its posterior distribution conditional on the - i 's. 3 Simulate the parameters ' of the model according to their posterior distributions conditional on the - i 's. The validity of this procedure, namely the fact that the Markov chain associated with the algorithm converges in distribution to the true posterior distribution of ', was shown by Diebolt and Robert (1990) in the context of one-dimensional normal mixtures. Their proof is based on a duality principle, which uses the finite space nature of the chain associated with the - i 's. This chain is ergodic with state space Kg and is thus geometrically convergent and even '-mixing. These properties transfer automatically to the sequence of values of ' and -, and important properties such the Central Limit Theorem or the Law of the Iterated Logarithm are then satisfied (Diebolt and Robert 1994; Robert 1993). The same results also apply here, the only difference being the more complex simulation structure imposed by the variance assumptions. Steps 1 and 2 do not depend on the considered model. Step 1 is straightforward, and Step 2 consists of simulating - from its conditional posterior distribution, namely - D (ff 1 3 is not the same for the different models of Table 1, and is described in the Appendix for each model in turn. 2.2 Choosing the Number of Groups and the Model by Bayes Factors BR left the choice of model to the user, while noting that model 6 of Table 1 (corresponding to their S criterion) gives good results in many situations. They based the choice of number of clusters on the AWE criterion, which is a crude approximation to twice the log Bayes factor for that number of clusters versus just one cluster. Here we develop a way of choosing both the model and the number of groups at the same time, using a more accurate approximation to the Bayes factor than that of BR. We compute approximate Bayes factors from the Gibbs sampler output using the Laplace- Metropolis estimator of Raftery (1995). This was shown to give accurate results by Lewis and Raftery (1994). In what follows, the word "model" refers to a combination of one of the models in Table 1 with a specified number of clusters. The Bayes against another model M 0 given data D is the ratio of posterior to prior odds, namely In equation (4), Z is the vector of parameters of M k , and pr(' k jM k ) is its prior density this is called the integrated likelihood of model M k . For a review of Bayes factors, their calculation and interpretation, see Kass and Raftery (1995). Bayesian model selection is based on Bayes factors, whose key ingredient is the integrated likelihood of a model. Our main computational challenge is thus to approximate the integrated likelihood using the Gibbs sampler output. We do this using the Laplace-Metropolis estimator of the integrated likelihood (Raftery 1995; Lewis and Raftery 1994). The Laplace method for integrals is based on a Taylor series expansion of the real-valued function f(u) of the d-dimensional vector u, and yields the approximation Z where u is the value of u at which f attains its maximum, and A is minus the inverse Hessian of f evaluated at u . When applied to equation (5) it yields where d is the dimension of ', ~ ' is the posterior mode of ', and \Psi is minus the inverse Hessian of logfpr(Dj')pr(')g, evaluated at '. Arguments similar to those in the Appendix of Tierney and Kadane (1986) show that in regular statistical models the relative error in equation (7), and hence in the resulting approximation to is sample size. While the Laplace method is often very accurate, it is not directly applicable here because the derivatives it requires are not easily available. The idea of the Laplace-Metropolis estimator is to get around the limitations of the Laplace method by using posterior simulation to estimate the quantities it needs. The Laplace method requires the posterior mode, (~-; ~ '), and j\Psij. The Laplace-Metropolis estimator estimates these from the Gibbs sampler output using robust location and scale estimators. The likelihood at the approximate posterior mode is pr(Dj ~ Y These quantities are then substituted into equation (7) to obtain the integrated likelihood, and Bayes factors are computed by taking ratios of integrated likelihoods, as in equation (4). 3 Examples We now present three examples to illustrate the ability of our methods to overcome the limitations (a)-(g) of other methods described in Section 1. The first example uses simulated data, while the second and third examples are based on real data sets. For each example, we consider only the models [-I]; [- k I]; [\Sigma]; and [- k \Sigma]. Models [-I] and are probably the most used Gaussian mixture models for clustering data (e.g. McLachlan and Basford 1988), and the generalizations of these, [- k I] ands [- k \Sigma], to allow for different volumes have proved to be powerful in several practical situations (Celeux and Govaert 1994). Our priors are chosen from among the conjugate priors of Section 2.1 so as to be fairly flat in the region where the likelihood is substantial and not much greater elsewhere. Thus they satisfy the "Principle of Stable Estimation" (Edwards, Lindman and Savage 1963), and so it could be expected that the results would be relatively insensitive to reasonable changes in the prior; we also checked this empirically for each example. We used - x and S are the empirical mean vector and variance matrix of the whole data set, and - oe 2 is the greatest eigenvalue of S. (The other notation used is defined in the Appendix ). The amount of information contained in this prior is similar to that contained in a typical single observation. Thus the prior may be viewed as comparable to the true prior of a person with some, but rather little, information. Similar priors have been used for generalized linear models by Raftery (1993) and for linear regression models by Raftery, Madigan and Hoeting (1994). In each example we assessed the sensivity of the results to changes in this prior and found it to be small; some of the sensitivity results for the first example are included below. Gauss Figure Example 1: Simulated data. 3.1 Example 1: Simulated Data We simulated 200 points from a bivariate two-component Gaussian mixture with equal pro- portions, mean vectors - t the data are shown in Figure 1. The first 600 iterations from the Gibbs sampler output for the model [- k I] with two groups are shown in Figure 2. Convergence was almost immediate and successive draws were almost independent; similar results were obtained from other starting values. We used 1,500 iterations, estimated by the gibbsit program to be enough to estimate the cumulative distribution function at the .025 and .975 quantiles to within \Sigma:01 for all the parameters (Raftery and Lewis 1993, 1995); the first 10 iterations were discarded. The model comparison results are shown in Table 2. The correct model, [- k I], and the correct number of groups, 2, are strongly favored. The posterior means of the parameters for the preferred model are - are close to the true values. The marginal posterior distribution is summarized in Figure 3, which shows the posterior distribution of the principal circles of the two groups. Sensitivity to the prior distribution is investigated in Table 3. A new Gibbs sampler Figure 2: Example 1: Time series plot of the first 600 Gibbs sampler iterations: (a) volume parameters; (b) mean for group 1; (c) mean for group 2. Table 2: Example 1: Approximate Log Integrated Likelihoods. No. of groups [-I] [- k I] [\Sigma] [- k \Sigma] Figure 3: Example 1: Posterior Distribution of Principal Circles for the [- k I] model with two groups. There is one circle for each Gibbs sampler iteration and each group, with center Table 3: Example 1: Sensitivity of selected results to changes in the prior hyperparameters for 1500 simulations for the selected model. Prior parameters log B 23 Pr[- is the log Bayes factor for two groups against three groups. D denotes the data. - x is the overall mean of the data - denotes the means of the two optimal partitions, namely - run was done for each choice of prior parameters, and so the differences in Table 3 are due to both true sensitivity and Monte Carlo variation; the true sensitivity is thus likely to be smaller. The estimation results are quite insensitive. The testing results are somewhat more sensitive, which is to be expected (Kass and Raftery 1995), but the overall conclusions remain the same over all combinations of prior parameters considered. Perhaps the greatest advantage of the present approach is that it fully assesses uncertainty about group membership, rather than merely giving a single "best" partition. In Figure 4, this is summarized by showing the uncertainty for each point, measured by . When it is clear that x i belongs to the k-th group, then is small, and so U i is also small. In these data, U i is large for only one point, no. 55, the one that lies on the boundary of the two groups, for which 3.2 Example 2: Butterfly Classification Figure 3.2 shows four wing measurements of a butterfly. Here we analyze data on two of these measurements, z 3 and z 4 , for 23 butterflies, shown in Figure 6, from Celeux and Robert (1993). The aim is to decide how many species are represented in this group of insects, and to classify them. Table 4 shows that model [- k \Sigma] with four groups is favored quite strongly over the alternatives. The posterior means of the parameters are: - Figure 4: Example 1: Uncertainty plot. At each point a vertical line of length proportional to U is plotted. The longest line is of length 0.5. Figure 5: Example 2: Butterfly Measurements. z3 z4 20 22 24 26 282030246810121315171921 22 23 Figure Example 2: Butterfly Data. Values of (z 3 ; z 4 ) for 23 butterflies. Table 4: Example 2: Approximate Log Integrated Likelihoods. No. of groups [-I] [- k I] [\Sigma] [- k \Sigma] 0:13. The most likely group memberships a posteriori are shown in Figure 7, along with the associated uncertainties. All the butterflies are classified with confidence except numbers 4 and 15 which are close to the boundary between groups 1 and 3. Group 4 consists of just one butterfly, which is clearly out on its own. The correct classification is known, and there are indeed four groups. In addition, the correct classification is exactly equal to the optimal classification found by our methods (Celeux and Robert, 1993). Figure 7: Example 2: Estimated Group Memberships and Uncertainty Plot for the Butterfly 3.3 Example 3: Kinematic Stellar Data Until fairly recently, it was believed that the Galaxy consists of two stellar populations, the disk and the halo. More recently, it has been hypothesized that there are in fact three stellar populations, the old (or thin) disk, the thick disk, and the halo, distinguished by their spatial distributions, their velocities, and their metallicities. These hypotheses have different implications for theories of the formation of the Galaxy. Some of the evidence for deciding whether there are two or three populations is shown in Figure 8, which shows radial and rotational velocities for stars, from Soubiran (1993). Table 5 shows that model [- k \Sigma] is preferred and that there is strong evidence for three groups as against two. The balance of astronomical opinion has also tilted towards this conclusion, but based on much more information than just the velocities used here, including star positions and metallicities (Soubiran 1993). It is impressive that such a strong conclusion can be reached with the present methods using only a relatively small part of the total available information. The posterior means of the parameters for the preferred model are: - 552. The corresponding partition is shown in Figure 9. U Figure 8: Example 3: Kinematic Stellar Data. Radial (U) and rotational (V ) velocities for 2,370 stars in the Galaxy. Source: Soubiran (1993). Table 5: Example 3: Approximate Log Integrated Likelihoods. No. of groups [-I] [- k I] [\Sigma] [- k \Sigma] astr Figure 9: Example 3: Optimal partition for the model [- k \Sigma]. Figure 10: Example 3: Uncertainty plot. The uncertainty plot is shown in Figure 10. The areas of high uncertainty are those on the boundaries between any two of the three groups. The greatest uncertainty is in the two small areas where all three groups intersect. We have presented a fully Bayesian analysis of the model-based clustering methodolology of Banfield and Raftery (1993), which overcomes many of the limitations of that approach. It appears to work well in several examples. Alternative frequentist approaches, which might be easier to implement, consist of maximizing the likelihood using the EM algorithm or of maximizing the classification likelihood using the Classification EM (CEM) algorithm. Celeux and Govaert (1995) considered those approaches to the full range of clustering models derived from the eigenvalue decomposition of the group variance matrices, including those considered here. They have shown in particular how it is possible to find the maximum likelihood estimate of the shape matrix A. Both approaches could overcome limitations (b), (d) and (e) of section 1, and the maximum likelihood approach could also overcome limitation (c). They would ovecome difficulty (a) only partly: they do provide an estimate of the uncertainty about group membership, but this assessment is incomplete because it does not take account of uncertainty about - and '. They do not overcome limitations (f) and (g). In our examples, we explicitly considered only models 1-4 of Table 1; these were sufficient for the data we considered. However, more generally it would be useful to consider all eight models, proceeding in the same way and using the results of Section 2.1. Appendix Gibbs Sampling for the Clustering Models We now describe Step 3 of Gibbs sampling for each of the eight clustering models. Given a classification vector use the notation the component-wise statistics of location and scale In what follows, we denote a model by the eigenvalue decomposition of its variance matrix written between brackets. For instance, [-D k AD t denotes the mixture model with equal volumes, equal shapes and different orientations. (a) Model [-I ]. Here the scale parameter - is common to all components of the mixture. We assume that the prior distribution on the parameters is conjugate, namely that 2 ae) means that - has the inverted gamma distribution \Gamma[ 1r]ae \Gammar=2 The posterior distribution on (- is therefore a convolution of normal distributions on the - k 's and of an inverse gamma distribution on -. The Gibbs components of Step 3 are then: 3.1 For I p with - 3.2 Simulate (b) Model [- k I ]. When the variance scales are different, the prior distributions are similar for all components: We recover the case treated in Diebolt and Robert(1994), namely that in which the groups (- are generated separately: 3.1 For I p with - 3.2 Simulate (c) Model [\Sigma]. There is no need to consider the eigenvalue decomposition of the covariance matrix \Sigma, and the prior distribution is given by means that \Sigma has the inverse Wishart distribution pr(\Sigma) / j\Sigmaj \Gamma(m+p+1)=2 expftr(\Psi\Sigma \Gamma1 )=2g: Step 3 of Gibbs sampling is then decomposed as follows: 3.1 For with - 3.2 Simulate ae (d) Model [- k \Sigma 0 ]. The prior distribution has three components: We make the model identifiable by setting of Gibbs sampling is then decomposed as follows: 3.1 For with - 3.2 Simulate 3.3 Simulate ae Model [-D k AD t Here, the distinction between - and A is entirely geometric (volume versus shape), and we will therefore consider a single parameter A, where the first term of the diagonal a 1 is no longer constrained to be equal to 1. The prior distribution of the parameters - k and A of the model is then The distribution of the orthogonal matrix D k is more delicate to specify. We use the marginal of an inverse Wishart distribution W \Gamma1 analogy with the previous cases. The marginal distribution can then be derived explicitly, because of the choice of I p as a "scale" matrix in the Z Y (D k D t Y (D k D t where (D k D t denotes the t-th element of the diagonal matrix D k D t k . The posterior distribution of the whole set of parameters, fA; (D Y \Gamman k =2 Y Y a \Gammar t Y (D k D t and leads to the following Gibbs steps: 3.1 For 3.2 Simulate a t jD 3.3 We use the approximation to the distribution of the D k in (14), i.e. we assume that D k and A are the direction and shape components of an inverse Wishart random variable and that they are independent. This is true only asymptotically (i.e. as the number of degrees of freedom goes to infinity) (Anderson 1984, Theorem 13.5.1) but it considerably simplifies the simulation, with moderate effects (if any) on the resulting posterior distribution. If we thus assume that the couples (D are all distributed as W \Gamma1 we derive from the posterior distribution Y \Gamma2 tr A \Theta that exp A This is a condensed way of saying that the diagonal elements of A are distributed according to the inverted gamma distributions, a t j- Ig@ n A The D k 's are then distributed a posteriori as the principal direction vectors from the following inverse Wishart distribution, (f) Model [- k D k AD t k ]. The Gibbs simulations of the - k 's and D k 's are similar to those of Model replacing A in (15). The simulation of A is also quite close to the previous version since exp \Gammatr A If we assume - k - Ig(l k =2; ae k =2), the posterior distribution of - k in the Gibbs sampler is (g) Model [- k DA k D t ]. There is no need to isolate the volume, - k , and we will consider parameters A k , where the first term of diagonal a 1k is not constrained to be equal to 1. The prior distribution on the parameters - k , A k and D of the model is then a tk - Ig(r tk =2; ae tk =2) We have Z Y Y The posterior distribution of the whole set of parameters, (D; Y \Gamman k =2 Y Y a \Gammar tk tk ae tk =2 Y and leads to the followings Gibbs steps. 3.1 For 3.2 Simulate a tk jD; - Ig 3.3 Simulate and use a Metropolis step to recover exp \Gamma2 tr A Model [\Sigma k ]. This is the standard Gaussian mixture model considered by Lavine and West (1992) and by Soubiran et al. (1991). In this case, there is no need to make use of the eigenvalue decomposition of \Sigma k . The prior distribution on (- k ; \Sigma k ) is then and the corresponding Gibbs step is, for --R An Introduction to Multivariate Statistical Analysis "Model-based Gaussian and non Gaussian Clustering," "Gaussian parsimonious clustering models," " Bayesian estimation of finite mixture distributions," " Bayesian estimation of finite mixture distributions Part II: sampling implementation," "Bayesian statistical inference for psychological research," "Bayes factors," " A Bayesian method for classification and discrimination," "Estimating Bayes factors via posterior simulation with the Laplace-Metropolis estimator," "Separating mixtures of normal distributions," Mixture Models "Fitting straight lines to point patterns," "Approximate Bayes factors and accounting for model uncertainty in generalized linear models," "How many iterations in the Gibbs sampler?" "The number of iterations, convergence diagnostics, and generic Metropolis algorithms." "Acounting for model uncertainty in linear regression," "Bayesian computation via the Gibbs sampler and related Markov chain Monte Carlo methods," "Kinematics of the Galaxy's stellar population from a proper motion survey," "Analyse de m'elanges gaussiens pour de petits 'echantillons : application `a la cin'ematique stellaire," --TR --CTR Mario A. T. Figueiredo , Anil K. Jain, Unsupervised Learning of Finite Mixture Models, IEEE Transactions on Pattern Analysis and Machine Intelligence, v.24 n.3, p.381-396, March 2002 Zhihua Zhang , Kap Luk Chan , Yiming Wu , Chibiao Chen, Learning a multivariate Gaussian mixture model with the reversible jump MCMC algorithm, Statistics and Computing, v.14 n.4, p.343-355, October 2004
bayes factor;gaussian mixture;eigenvalue decomposition;gibbs sampler
599292
Bayesian MARS.
A Bayesian approach to multivariate adaptive regression spline (MARS) fitting (Friedman, 1991) is proposed. This takes the form of a probability distribution over the space of possible MARS models which is explored using reversible jump Markov chain Monte Carlo methods (Green, 1995). The generated sample of MARS models produced is shown to have good predictive power when averaged and allows easy interpretation of the relative importance of predictors to the overall fit.
Introduction A common problem in statistics, and other disciplines, is to approximate adequately a function of several variables. In a statistical setting this is known as multiple regression and the task can be performed either parametrically by global modelling (e.g. linear regression), or nonparametrically (see below for examples of these methods). The aim is to model the dependence of a response variable Y on one or more predictor variables the data is given by The data is assumed to come from a relationship described by where f is an unknown regression function that we wish to estimate, ffl is a zero-mean error distribution, most commonly assumed to be Gaus- sian, and D is the domain of interest, usually taken to be the convex hull defined by the predictor variables. The regression function f gives the predictive relationship of Y on X, i.e. the conditional expectation of Y given X. Thus we may use f to predict future values of Y at previously unseen points in the domain D. The aim of the regression analysis is to use the data to construct an estimate b f (X) to the true regression function which can serve as a reasonable approximation over the domain of interest, D. Many methods exist to model the function of interest f [e.g. Additive models, Hastie and Tibshirani (1990); CART, Breiman et al. (1984); Projection pursuit regression, Friedman and Stuetzle (1981); Alternating conditional expectation, Breiman and Friedman (1985)]. We, however, concentrate on the multivariate adaptive regression spline (MARS) methodology proposed by Friedman (1991). This method seems to be both highly flexible and easily interpretable. It was motivated by the recursive partitioning approach to regression (Morgan and Sonquist, 1963; Breiman et al., 1984) but produces a continuous model which can be made to have continuous derivatives and has greater flexibility to model relationships that are nearly additive or involve at most a few variables. The model can be represented in such a way that the additive contributions of each predictor variable and the interactions between variables can be easily identified which helps to identify variables which are important in the model. To highlight the progression from recursive partition regression to MARS we start by giving the partition regression model, and the a i are the suitably chosen coefficients of the basis functions B i and k is the number of basis functions in the model. These basis functions are such that B i I is the indicator function which is one where the argument is true, zero elsewhere and the R i a partition of D. The usual MARS model is the same as that given in (1) except that the basis functions are different. Instead the B i are given by (2) is the degree of the interaction of basis B i , the s ji , which we shall call the sign indicators, equal \Sigma1, the v(j; i) give the index of the predictor variable which is being split on and the t ji (known as knot points) give the position of the splits. The v(j; \Delta) (j = are constrained to be distinct so each predictor only appears once in each interaction term. See Section 3, Friedman (1991) for a comprehensive illustration of the model. To illustrate the initially confusing notation we present an example. Suppose a MARS model contains the basis function B i given by We can immediately see that there are two factors in the interaction term so 2. The sign indictors are s with the knot points given by t \Gamma3:7 and the labels for the predictors split on are The MARS model is continuous in D and can be made to have continuous first derivatives by replacing the truncated linear basis functions B i by truncated cubic basis functions. This has the effect of "rounding" the basis function at the split points. The MARS algorithm proceeds as follows. A forward stepwise search for basis functions takes place with the constant basis function the only one present initially. At each step the split which minimises some "lack-of-fit" criterion from all the possible splits on each basis function is chosen. Splits are only permissable at the marginal predictor values. If the split was on predictor x at t this corresponds to the two new basis func- tions, henceforth referred to as a . Note that unlike the recursive partitioning algorithm the basis function with which the split was made is not removed. This continues until the model reaches some predetermined maximum number of basis functions, which should be about twice the number expected in the model to aid the subsequent backwards stepwise deletion of basis functions. This just involves removing basis functions one at a time until the lack-of-fit criterion is at a minimum. The basis which improves the fit the most or degrades it the least is removed at each step. Finally the resulting model can be made to have a continuous first derivative by "rounding" at the split points as mentioned above. The lack-of-fit measure used by Friedman (1991) is the generalised cross-validation criterion which was originally proposed by Craven and Wahba (1979). The aim of this paper is to provide a Bayesian algorithm which mimics the MARS procedure. This is done by considering the number of basis functions, along with their type (see Section 2.1), their coefficients and their form (the positions of the split points and the sign indicators) random. We treat these as additional parameters in the problem and make inference about them using the data. The problem of routine calculation of the posterior distribution of the models is addressed by designing a suitable Markov chain Monte Carlo (MCMC) reversible jump simulation algorithm as set out by Green (1995). The simulated sample contains many different MARS models with corresponding posterior weights but if a estimate for f with high predictive power is all that is required then pointwise averaging over all the models in the sample is suggested. This work is an extension to the Bayesian approach to curve fitting in one dimension given by Denison et al. (1998b) and is related to the Bayesian CART algorithms proposed by Denison et al. (1998a) and Chipman et al. (1998). In Section 2 we outline the Bayesian MARS method and show examples using the method on simulated data in Section 3 and real data in Section 4. Section 5 contains a discussion of the proposed methodology. 2 The Bayesian MARS Method 2.1 Basic Ideas We must first define what we mean by the type of a basis function. Using the notation in (1) and (2), we consider basis functions to be of the same type if is identical to some permutation of Hence with m predictor variables there are N different types of basis function where N is given by Note that the sum does not include the constant basis function term [for which i would equal 0 in (3)] as this basis B 1 is always the sole constant basis function in the model so it cannot be chosen as a candidate basis. Frequently some maximum order of interaction I is assigned to the model such that J i - I in which case the sum in (3) only runs from 1 up to I. We let the type of basis function B i thus T i , in effect, just tells us which predictor variables we are splitting on, ie what the values of v(1; are. As an example suppose we have a problem with just two predictors 2). Then the types of basis functions that could be in the model (not including the constant one) are [\Sigma(x (say type 2) and [\Sigma(x (say type 3). So for all those basis functions which split only on predictor x 2 their types T i are all equal to 2. We propose a model which can be used to set up a probability distribution over the space of possible MARS structures. Any MARS model can be uniquely defined by the number of basis functions present, the coefficients and the types of the basis functions, together with the knot points and the sign indicators associated with each interaction term. This means that we make the k; a random with the J i uniquely defined via the T i . We change the dimension of the model when we change k and so, for Bayesian computation, we use a reversible jump MCMC approach (Green, 1995; Richardson and Green, 1997) when we are considering changes in the number of basis functions in the model. Inference is carried out assuming that the "true" model is unknown but comes from the class of models denotes the model with exactly k basis functions. The overall parameter space \Theta can then be written as a countable union of subspaces is a subspace of the Euclidean space R n(k) , where R n(k) denotes the dimensional parameter space corresponding to model M k . Here ' where each B i is the 2(1+J i )-dimensional vector (a which corresponds to basis function B i . There is a natural hierarchical structure to this setup, which, denoting a generic element of \Theta k by ' (k) and the data vector by y, we formalise by modelling the joint distribution of (k; ' that is, as the product of model probability, parameter prior and likelihood. Bayesian inference about k and ' (k) will be based on the joint posterior which we shall explore and summarise by regarding it as the target distribution for tailored MCMC computations. It will often be useful to consider this in the factorised form We will generate samples from the joint posterior of (k; ' (k) ) by using a class of reversible jump Metropolis-Hastings algorithms (Green, 1995). Full details of the method can be found in the reference cited. Here, we focus on the essence of the methodology and the particular forms of the algorithms in our current context. 2.2 The Bayesian Model We assume ffl in (1) follows a N(0; oe 2 ) distribution where oe 2 is unknown. As a result we extend the parameter vector ' to include this new unknown. This leads to the log-likelihood of the model, l k ('jy), being given by l k \Gamman log oe \Gamma2oe 2 f is of the form given in (1) and (2). We use a vague, but proper, prior for the variance of the error distribution ie -(oe \Gamma2 and the T i are assumed to be uniformly distributed on Ng. The sign indicators s ji and knot points t ji are also assumed uniform on the sets f\Gamma1; 1g and ng respectively. We use another vague, but proper prior, for the coefficients of basis functions so that we assume the a i - N(0; - 2 ) where we take the variance - These priors may be chosen differently but this formulation is used to let the data dictate the form of the model and leads to a proper posterior distribution as all the priors are themselves proper. In particular, the prior on the type of the basis functions could be chosen more carefully so that, a priori, main effects are favoured over interaction terms. This could be useful when interpretation of the model, rather than prediction, is more important. This refinement is used in Mallick et al. (1997, 1998) which concentrate on situations where interpretability of the model is of great interest. A Poisson distribution (with parameter -) is used to specify the prior probabilities for the number of basis functions, giving In practice, a Poisson distribution truncated to k ! k max , for a suitable choice of k max , is adopted. However, to help the sampler to mix better and to limit prior influence we put a gamma hyperprior (with both parameters equal to 10) over -. This reflects knowledge that we expect just a few basis functions will fit the data well which controls overfitting. 2.3 Computational Strategy Our aim is to simulate samples from the joint posterior distribution of p(' since analytic or numerical analyses are totally intractable in this situation. For this purpose we design a reversible jump algorithm of the general type discussed by Green (1995), to which the reader is referred for details. In the context of our problem, with multiple parameter subspaces of different dimensionality, it will be necessary to devise different types of moves between the subspaces. These will be combined to form what Tierney (1994) calls a hybrid sampler, making random choice between available moves at each transition, in order to traverse freely around the combined parameter space. We use the following move types: (a) a change in a knot location; (b) the addition of a basis function; (c) the deletion of a basis function. Note that in steps (b) and (c) we are changing the dimension of the model and that we do not add basis functions in pairs as in the standard MARS forward-stepwise procedure: in fact, we depart completely from the any sort of recursive partitioning approach. We have found that adding basis functions singly makes our procedure more flexible and the reversibility condition easier to satisfy. When we change the MARS structures, as described below, the coefficients of the basis functions a in the new model have little relationship to those in the current model so inference about them is difficult and can lead to labelling problems, as in Richardson and Green (1997). Instead we choose to integrate out the coefficients a i and the error variance oe 2 from the parameter vector ' (k) , which now only contains the model param- eters. This is straightforward because we chose to use conjugate priors for both the coefficients and the error variance. However, to make predictions using the generated sample of models we draw coefficients for each model in the sample from their full conditional distributions given the other model parameters. Given the current model step (a) is straight-forward. First we pick a basis uniformly at random and then we pick one of the factors we alter the current knot location t ji and with probability 1reverse the sign indicator. We choose a new knot location from the marginal predictor values of variable x v(j;i) and set this to the new t ji . This move type is then undertaken using a Metropolis step (Metropolis et al., 1953; Hastings, 1970) to accept or reject the proposed new state. The addition of a basis function (BIRTH), step (b), is carried out by choosing uniformly a type of basis function, say T i , to add to the model. Then we uniformly choose a knot location and sign indicator for each of the factors in this new basis. Step (c) (DEATH), the deletion of a basis function is constructed in such a way as to make the jump step reversible. This is easily done by choosing a basis function uniformly from those present (except the constant basis removing it. At the end of each iteration after the move step has been performed we use Gibbs steps (Gelfand and Smith, 1990) to generate a new -. This is straightforward as its full conditional is simple to calculate and is given by at each full cycle of the algorithm we obtain a sample of (k; ' (k) ). 2.4 Algorithm In the reversible jump algorithm we use the three move types described above so that we can write the set of moves as refers to changing a knot location and refers to increasing the number of terminal nodes from m to m+1 or decreasing it from m+1 to m. Independent move types are randomly chosen with probabilities ae k and d k for k. In this problem we took b with the constant c, a parameter of the sampler, taken to be 0.4. For We find that by marginalising over the coefficients and the error variance the acceptance probability given in Green (1995) simplifies to where ' denotes the current model parameters, ' 0 the proposed model pa- rameters, the probability of proposing a move to ' 0 from ' and D the data. Thus the acceptance probability is just a Bayes factor (Kass and multiplied by prior and proposal odds terms. This approach is common in many fixed dimensional parameter inference problems and has recently been used in other contexts where there are an unknown number of parameters (Chipman et al., 1998; Holmes and Mallick, 1997). The use of conjugate prior distributions allows simple evaluation of the integrals in the Bayes factor term as demonstrated in O'Hagan (1994). This leads to the Bayes factor being given by d where 0 refers to the proposed model, I is the identity matrix, a a. Note that X and Y refer to the usual design and data matrices of the current regression with b a being the Bayesian least squares regression estimates of the coefficients. The constants are the parameters of the gamma prior distribution over oe \Gamma2 and so, from Section 2.2, were both taken to be 0.01. Note that an ordinary least squares approach to estimating the regression coefficients was undertaken in Denison et al. (1998a,b) and this is equivalent to the above method when using reference priors for the coefficients and error variance. We now show how the prior and proposal odds terms are calculated using the birth step as an example. A birth step (b) adds basis B k+1 when there are currently k basis functions in the model. The prior odds are given by prior for the functions and ' (k+1) prior for the k basis functions and ' (k) where the terms in the numerator of (6) are given by the prior for the number of basis functions, the prior for the type of the basis functions and the priors for the knot positions and sign indicators: similarly for the denominator. The prior probability for the set of bases, when there are k in the model, can be thought of as the probability of choosing items from a set of N where the ordering does not matter. The constant basis function is fixed so it does not need to be chosen. The prior for the model parameters is the product of the probability of each factor having a certain sign indicator (i.e.2 ) and a certain knot point ) to the power of the number of factor terms in the model ( The corresponding proposal odds is given by p(propose death ' p(propose birth ' d k+1 =k where we propose a death by randomly choosing one of the basis functions not including the constant one, and a birth by randomly choosing a type of basis function, with probability 1=N , together with a sign indicator and knot point for each factor in the new basis fN(2n)g \GammaJ k+1 . Hence, using equations (4-5) and (7-8), we can find the acceptance probability for a birth step. The acceptance probability for a death step is worked out similarly. The algorithm we use is straightforward and works quickly. The BIRTH step is described in detail in the appendix and the other steps are very similar. Algorithm 1. Start with just the constant basis function present. 2. Set k equal to the number of basis function in the current structure. 3. Generate u uniformly on [0,1]. 4. Goto move type determined by u. ffl else if (b ffl else goto CHANGE step. 5. Draw - using Gibbs steps. 6. Repeat 2 for a suitable number of iterations once there is evidence of convergence. 3 Simulated Examples 3.1 Bivariate Predictors We first of all test our methodology on the examples given by Hwang et al. (1994) and studied by Roosen and Hastie (1994). Following their approaches we generate 225 pairs of predictors uniformly on the unit square and the response is f(x is the true value of the test function and the ffl i are drawn from a N(0; 0:25 2 ) distribution. The test functions are ffl Simple interaction function ffl Radial function f (2) ffl Harmonic function ffl Additive function ffl Complicated interaction function These functions are scaled and translated to have a standard deviation of one and a non-negative range. We use the fraction of variance unexplained to test the fits of the models to the data, given by where f(x i ) is the true value of the function, b is the fitted value and - f is the mean of the true values. We use FVU as it is helpful in comparing fits of the model with differently generated datasets. To evaluate the FVU for a fit we replace the expectations by averages over a test set of 10,000 points. For these bivariate examples this is simply a 100 by 100 grid on the unit square ie (1=200; 199=200). For the higher dimensional examples which follows the test set is composed of 10,000 random uniform values over the domain of interest D. For the training set we calculate the FVU over the training sample treating the observed y values as f(x). We took the results from the last 30,000 iterations of the sampler after an initial burn-in period which was long enough for convergence to have occurred by the end of it. Convergence was assumed when the mean squared error of the fit had been settled for some time, as in the similar curve fitting algorithm of Denison et al. (1998b). In Table 1 we display the FVU for the training set of data and the test set for the standard MARS algorithm together with the number of basis functions it found. For the BMARS model we give the average FVU for the posterior mean model (obtained by pointwise averaging) from 10 runs of the algorithm and we display the average number of basis functions in the samples produced by the 10 repetitions of the algorithm. The standard MARS models are referred to as LMARS (piecewise-linear MARS) and CMARS (piecewise- cubic MARS) and we give results for both these MARS models. Table 1 shows that the BMARS model gives comparable, and often better, results than both LMARS and CMARS for this wide variety of examples. Also, the average number of basis functions found by BMARS is commonly less than the number found using standard MARS. The true surfaces for these examples are shown in Fig. 1 and the corresponding BMARS estimates are given in Fig. 2. Figs. 1 and 2 about here Table about here 3.2 High Dimensional Predictors We take this example from Friedman et al. (1983). The basic function is Following Friedman et al. we generate 200 random uniform predictors from the six-dimensional unit hypercube and take the response to be f(x where the ffl i are independent and identically distributed N(0; 1) random variables. The extra predictor is spurious and does not affect the response. Friedman (1991) also uses this function but in this paper a ten-dimensional predictor is used (five being spurious) and the sample size is reduced to 100. As is commonly the case in Friedman (1991) we do not allow more than two-way interactions in the MARS models we use. Higher-order interaction terms do not generally improve the fit and make the model unnecessarily complex even though they could be incorporated if required. In Table 2 we display the FVU for the training and test set for these examples using the standard MARS and BMARS methods. As before we took the results from the last 30,000 iterations of 10 runs of the algorithm after an initial burn-in period. The results shown demonstrate how the BMARS model parsimoniously fits the data when compared to the standard MARS fits. Table about here 4 Real Data Example We now illustrate our methodolgy using a real dataset. We use data from a study by Bruntz et al. (1974) of the dependence of ozone on some meteorological variables on 111 days from May to September 1973 at sites in the New York metropolitan area. As in Cleveland et al. (1988) we work with the cube root of ozone. This dataset is known as air and is available in Splus (Becker et al., 1988). There are three predictor variables, radiation, temperature and wind speed but because of the vastly differing ranges of the response and predictors we standardised the data beforehand, i.e. we linearly transformed each variable so that it had zero mean and unit variance. Again we allow only main-effect and two-way interaction terms in the MARS models. The MARS fit had 6 basis functions and the residual sum of squares (RSS) given by was 18.41 with the linear approximation and 20.19 with the cubic one. The final model was of the form f(wind)+f(temperature)+f(wind; temperature)+ f(radiation; temperature) with one basis function for each of these terms except the final one for which two basis functions existed. Over 5 runs of the algorithm, using the same priors as in the previous section, the average RSS given by the BMARS model was 18.32 with 4.06 basis functions. This is lower than both the RSS's given by the MARS model with fewer basis functions. As shown by Fig. 3 the BMARS estimate in the (temperature, wind) plane is smooth whereas the piecewise-linear estimate using MARS is not (Fig. 4). The BMARS estimate also has a smaller RSS with less degrees of freedom. In Table 3 we display the estimated posterior probabilities of the possible terms in the models, the RSS and the average number of basis functions in each of the 5 runs. Immediately it can be seen that they each produced similar results which suggests that convergence had occurred by the end of the burn-in period. Also, it appears that the most important basis functions in the fit were the main effect terms for radiation and temperature and the (wind,temperature) interaction term. This is borne out by the fact that the model which included only the terms just referred to had easily the largest posterior probability and made up well over 50% of the generated samples. The use of BMARS as a tool for performing a stochastic search for variable selection comes "for free" when performing the analysis for prediction. Variable selection, itself, is a difficult problem and one that has received much attention in the literature. The BMARS method could be used in a similar way to the Gibbs sampling-based method outlined in George and McCulloch (1993) which is shown to identify good models using a stochastic search procedure. Figs. 3 and 4 about here Table 3 about here We have presented a Bayesian approach to finding regression surfaces which uses truncated linear basis functions to build up the surface. We use the data to find the knot points, the main effect and/or interaction terms and the number of basis functions that are required to adequately approximate the required surface. We simulate a random sample of models using the reversible jump MCMC approach of Green (1995). This Bayesian approach to multiple regression produces a model with high predictive power due to the posterior averaging over all the models. This not only leads to a good overall fit for the data but can also help to combat overfitting problems. We can however choose a single model as our estimate by picking out single models from the sample by various criteria. These models have less predictive power but have more interpretability as we can easily produce their ANOVA decompositions. We can only produce expected numbers and posterior probabilities of basis functions for the posterior mean estimate but this too can be used to identify variables that are important to the fit. In some applications we may not wish to draw the coefficients but use the mean of their sampling distributions instead. If identifying good models, and not prediction, is the main aim then not drawing the coefficients is slightly quicker and produces models with smaller (squared) error. This may be useful in the related BMARS algorithms for analysing financial time series (Denison, 1997) and failure time data (Mallick et al., 1997). This is the approach Denison et al. (1998a) undertake to find "good" CART models via a stochastic search as in this example prediction using the posterior mean is not helpful. The structure of the algorithm which allows the sampler to move fluidly about the probability space means that Bayesian MARS does not inherit the problems of Bayesian CART algorithms (Denison et al., 1998a; Chipman et al., 1998) by only searching restricted portions of the entire space. This is greatly helped by not "splitting" on current basis functions thus inducing no hierarchical structure to the form of the bases. This point is demonstrated in full in Chapter 5 of Denison (1997). If the space of predictor variables is substantial (over 50, say) then convergence of the sampler would seem to be unlikely but still the BMARS approach should yield "good" models. The BMARS algorithm we used in this paper was written in ANSI C and is available, together with the datasets, from the World Wide Wed address http://ma.ic.ac.uk/-dgtd/. The algorithm takes around 5 minutes to run on a DEC Alpha workstation when there are 200 datapoints. Acknowledgements The work of the first author was supported by an EPSRC research stu- dentship. We acknowledge the helpful comments made by the anonymous referees, the associate editor and Mr C.C. Holmes. Appendix The move types CHANGE, BIRTH and DEATH given in the algorithm in Section 2.3 are undertaken similarly so we just describe the BIRTH step in pseudo-code.The notation follows that in Section 2. 1. Uniformly choose a type of basis function T i to add from the N possible ones. 2. Uniformly choose the knot positions, predictors to split on and the sign indicators in this new basis remembering that each predictor may only occur once in each basis function. 3. Generate u uniformly on [0,1]. 4. Work out the acceptance probability, ff. 5. IF accept the proposed model. ELSE keep the current model. 6. Return to main algorithm. --R The New S Language Estimating optimal transformations for multiple regression and correlation (with discussion). Classification and Regression Trees The dependence of ambient ozone on solar radiation Bayesian CART model search (with discussion). Smoothing noisy data with spline func- tions Simulation based Bayesian nonparametric regression methods. Multivariate adaptive regression splines (with dis- cussion) Multidimensional additive spline approximation. Projection pursuit regression. Variable selection via Gibbs sam- pling Reversible jump Markov chain Monte Carlo computation and Bayesian model determination. Generalized additive models Monte Carlo sampling methods using Markov chains and their applications. Bayesian wavelet networks for non-parametric regression Regression modeling in back-propagation and projection pursuit learn- ing Bayes factors. In Generalized Linear Models: A Bayesian Perpective Equations of state calculations by fast computing machines. Problems in the analysis of survey data and a proposal. Bayesian analysis of mixtures with an unknown number of components (with discussion). Automatic smoothing spline projection pursuit. Markov chains for exploring posterior distributions (with discussion). Figure 2 Hwang Figure 4 Linear-piecewise (left) and cubic-piecewise (right) MARS estimates in the (temperature --TR --CTR C. C. Holmes , B. K. Mallick, Bayesian radial basis functions of variable dimension, Neural Computation, v.10 n.5, p.1217-1233, July 1, 1998 David J. Nott , Anthony Y. Kuk , Hiep Duc, Efficient sampling schemes for Bayesian MARS models with many predictors, Statistics and Computing, v.15 n.2, p.93-101, April 2005 Christophe Andrieu , Nando De Freitas , Arnaud Doucet, Robust Full Bayesian Learning for Radial Basis Networks, Neural Computation, v.13 n.10, p.2359-2407, October 2001
multivariate adaptive regression splines;reversible jump Markov Chain Monte Carlo;bayesian methods;multiple regression
599361
Bayesian parameter estimation via variational methods.
We consider a logistic regression model with a Gaussian prior distribution over the parameters. We show that an accurate variational transformation can be used to obtain a closed form approximation to the posterior distribution of the parameters thereby yielding an approximate posterior predictive model. This approach is readily extended to binary graphical model with complete observations. For graphical models with incomplete observations we utilize an additional variational transformation and again obtain a closed form approximation to the posterior. Finally, we show that the dual of the regression problem gives a latent variable density model, the variational formulation of which leads to exactly solvable EM updates.
Introduction Bayesian methods have a number of virtues, particularly their uniform treatment of uncertainty at all levels of the modeling process. The formalism also allows ready incorporation of prior knowledge and the seamless combination of such knowledge with observed data (Bernardo & Smith 1994, Gelman 1995, Heckerman et al. 1995). The elegant semantics, however, often comes at a sizable computational cost|posterior distributions resulting from the incorporation of observed data must be represented and updated, and this generally involves high-dimensional integra- tion. The computational cost involved in carrying out these operations can call into question the viability of Bayesian methods even in relatively simple settings, such as generalized linear models (McCullagh & Nelder 1983). We concern ourselves in this paper with a particular generalized linear model|logistic regression|and we focus on Bayesian calculations that are computationally tractable. In particular we describe a exible deterministic approximation procedure that allows the posterior distribution in logistic regression to be represented and updated e-ciently. We also show how our methods permit a Bayesian treatment of a more complex model|a directed graphical model (a \belief network") in which each node is a logistic regression model. The deterministic approximation methods that we develop in this paper are known generically as variational methods. Variational techniques have been used extensively in the physics literature (see, e.g., Parisi 1988, Sakurai 1985) and have also found applications in statistics (Rustagi 1976). Roughly speaking, the objective of these methods is to transform the problem of interest into an optimization problem via the introduction of extra degrees of freedom known as variational parameters. For xed values of the variational parameters the transformed problem often has a closed form solution, providing an approximate solution to the original problem. The variational parameters are adjusted via an optimization algorithm to yield an improving sequence of approximations. For an introduction to variational methods in the context of graphical models see Jordan et al. (1999). Let us brie y sketch the variational method that we develop in this paper. We study a logistic regression model with a Gaussian prior on the parameter vector. Our variational transformation replaces the logistic function with an adjustable lower bound that has a Gaussian form; that is, an exponential of a quadratic function of the parameters. The product of the prior and the variationally transformed likelihood thus yields a Gaussian expression for the posterior (conjugacy), which we optimize variationally. This procedure is iterated for each successive data point. Our methods can be compared to the Laplace approximation for logistic regression (cf. Spiegelhalter & Lauritzen 1990), a closely related method which also utilizes a Gaussian approximation to the posterior. To anticipate the discussion in following sections, we will see that the variational approach has an advantage over the Laplace approximation; in particular, the use of variational parameters gives the variational approach greater exibility. We will show that this exibility translates into improved accuracy of the approximation. Variational methods can also be contrasted with sampling techniques, which have become the method of choice in Bayesian statistics (Thomas et al. 1992, Neal 1993, Gilks et al. 1996). Sampling techniques enjoy wide applicability and can be powerful in evaluating multi-dimensional integrals and representing posterior distributions. They do not, however, yield closed form solutions nor do they guarantee monotonically improving approximations. It is precisely these features that characterize variational methods. The paper is organized as follows. First we describe in some detail a variational approximation method for Bayesian logistic regression. This is followed by an evaluation of the accuracy of the method and a comparison to Laplace approximation. We then extend the framework to belief networks, considering both complete data and incomplete data. Finally, we consider the dual of the regression problem and show that our techniques lead to exactly solvable EM updates. Bayesian logistic regression We begin with a logistic regression model given by: is the logistic function, S the binary response variable, and the set of explanatory variables. We represent the uncertainty in the parameter values via a prior distribution P () which we assume to be a Gaussian with possibly full covariance structure. Our predictive distribution is therefore: Z In order to utilize this distribution we need to be able to compute the posterior parameter distribution assume that each D r g is a complete observation. This calculation is intractable for large n or T , thus we consider a variational approximation. Our approach involves nding a variational transformation of the logistic function and using this transformed function as an approximate likelihood. In particular we wish to consider transformations that combine readily with a Gaussian prior in the sense that the Gaussian prior becomes the conjugate prior to the transformed likelihood. We begin by introducing the type of variational transformations we will use for this purpose. 2.1 A brief introduction to variational methods Consider any continuously dierentiable convex function f(z). Figure 1 provides an example of a convex function that we will make use of later on. Convexity of this function guarantees by denition that any tangent line always remains below the function itself. We may thus interpret the collection of all the tangent lines as a parameterized family of lower bounds for this convex function (cf. convex duality, Rockafellar 1976). The tangents in this family are naturally parameterized by their locations. From the point of view of approximating the convex non-linear function f , it seems natural to use one of the simpler tangent lines as a lower bound. To formulate this a little more precisely, let L(z; z 0 ) be the tangent line at @z then it follows that f(z) L(z; z 0 ) for all z; z 0 and f(z 0 In the terminology of variational methods, L(z; z 0 ) is a variational lower bound of f(z) where the parameter z 0 is known as the variational parameter. Since the lower bound L(z; z 0 ) is considerably simpler (linear in this case) than the non-linear function f(z), it may be attractive to substitute the lower bound for f . Note that we are free to adjust the variational parameter z 0 , the location of the tangent, so as to make L(z; z 0 ) as accurate an approximation of f(z) as possible around the point of interest, i.e., when z z 0 . The quality of this approximation degrades as z receeds from z 0 ; the rate at which this happens depends on the curvature of f(z). Whenever the function f has relatively low curvature as is the case in Figure 1, the adjustable linear approximation seems quite attractive. -5 Figure 1: A convex function f and its two tangent lines. The locations of the tangents are indicated with short vertical line segments. 2.2 Variational methods in Bayesian logistic regression Here we illustrate how variational methods, of the type described above, can be used to transform the logistic likelihood function into a form that readily combines with the Gaussian prior (conjugacy). More precisely, the transformed logistic function should depend on the parameters at most quadratically in the exponent. We begin by symmetrizing the log logistic function: log and noting that function in the variable x 2 . (This is readily veried by taking second derivatives; the behavior of f(x) as a function of x 2 is shown in Figure 1). As discussed above, a tangent surface to a convex function is a global lower bound for the function and thus we can bound f(x) globally with a rst order Taylor expansion in the variable x Note that this lower bound is exact whenever . Combining this result with Eq. (4) and exponentiating yields the desired variational transformation of the logistic where tanh(=2)=(4). We also introduce the following that is, P denotes the variational lower bound on the logistic function As a lower bound it is no longer normalized. We refer to eq. (8) as a - transformation of the conditional probability. For each xed value of H S we can in fact recover the exact value of the logistic function via a particular choice of the variational parameter. Indeed, maximizing the lower bound with respect to yields substituting this value back into the lower bound recovers the original conditional probability. For all other values of we obtain a lower bound. The true posterior P (jD) can be computed by normalizing P (SjX; )P (). Given that this calculation is not feasible in general, we instead form the bound: and normalize the variational approximation P (SjX; ; )P (). Given that P () is Gaussian and given our choice of a Gaussian variational form for P (SjX; ; ), the normalized variational distribution is a Gaussian. Note that although P a lower bound on the true conditional probability, our variational posterior approximation is a proper density and thus no longer a bound. This approximate Bayesian update amounts to updating the prior mean and the prior covariance matrix into the posterior mean and the posterior covariance matrix. Omitting the algebra we nd that the updates take the following form: for a single observation (S; X), where Successive observations can be incorporated into the posterior by applying these updates recursively. Our work is not nished, however, because the posterior covariance matrix depends on the variational parameter through () and we have yet to specify . We choose via an optimization procedure; in particular, we nd a value of that yields a tight lower bound in eq. (9). The fact that the variational expression in eq. (9) is a lower bound is important|it allows us to use the EM algorithm to perform the optimization. We derive such an EM algorithm in Appendix A; the result is the following (closed form) update equation for : post where the expectation is taken with respect to P (jD; old ), the variational posterior distribution based on the previous value of . Owing to the EM formulation, each update for corresponds to a monotone improvement to the posterior approximation. Empirically we nd that this procedure converges rapidly; only a few iterations are needed. The accuracy of the approximation is considered in the following two sections. To summarize, the variational approach allows us to obtain a closed form expression for the posterior predictive distribution in logistic regression: Z where the posterior distribution P (jD) comes from making a single pass through the data set applying the updates in eq. (10) and eq. (11) after optimizing the associated variational parameters at each step. The predictive lower bound P (S t jX t ; D) takes the form: log for any complete observation D t , where and signify the parameters in P (jD) and the subscript t refers to the posterior P (jD; D t ) found by augmenting the data set to include the point D t . We note nally that the variational Bayesian calculations presented above need not be carried out sequentially. We could compute a variational approximation to the posterior probability P (jD) by introducing (separate) transformations for each of the logistic functions in Y Y The resulting variational parameters would have to be optimized jointly rather than one at a time. We believe the sequential approach provides a cleaner solution. 3 Accuracy of the variational method The logistic function is shown in Figure 2(a), along with a variational approximation for 2. As we have noted, for each value of the variational parameter , there is a particular point x where the approximation is exact; for the remaining values of x the approximation is a lower bound. a) -4 -2 0 2 40.20.61 Figure 2: a) The logistic function (solid line) and its variational form (dashed line) for 2. b) The dierence between the predictive likelihood and its variational approximation as a function of g( 0 ), as described in the text. Integrating eq. (9) over the parameters we obtain a lower bound on the predictive probability of an observation. The tightness of this lower bound is a measure of accuracy of the approximation. To assess the variational approximation according to this measure, we compared the lower bound to the true predictive likelihood that was evaluated numerically. Note that for a single observation, the evaluation of the predictive likelihood can be reduced to a one-dimensional integration problem: Z Z where the eective prior P Gaussian with mean where the actual prior distribution P () has mean and covariance . This reduction has no eect on the accuracy of the variational transformation and thus it can be used in evaluating the overall accuracy. Figure 2(b) shows the dierence between the true predictive probability and the variational lower bound for various settings of the eective mean 0 and variance 2 , with optimized separately for each dierent values of 0 and 2 . The fact that the variational approximation is a lower bound means that the dierence in the predictive likelihood is always positive. We emphasize that the tightness of the lower bound is not the only relevant measure of accuracy. Indeed, while a tight lower bound on the predictive probability assures us that the associated posterior distribution is highly accurate, the converse is not true in general. In other words, a poor lower bound does not necessarily imply a poor approximation to the posterior distribution at the point of interest, only that we no longer have any guarantees of good accuracy. In practice, we expect the accuracy of the posterior to be more important than that of the predictive probability since errors in the posterior run the risk of accumulating in the course of the sequential estimation procedure. We defer the evaluation of the posterior accuracy to the following section where comparisons are made to related methods. 4 Comparison to other methods There are other sequential approximation methods that yield closed form posterior parameter distributions in logistic regression models. The method most closely related to ours is that of Spiegelhalter and Lauritzen (1990), which we refer to as the S-L approximation in this paper. Their method is based on the Laplace ap- proximation; that is, they utilize a local quadratic approximation to the complete log-likelihood centered at the prior mean . The parameter updates that implement this approximation are similar in spirit to the variational updates of eq. (10) and eq. post post X (18) X). Since there are no additional adjustable parameters in this approximation, it is simpler than the variational method; however, we would expect this lack of exibility to translate into less accurate posterior estimates. We compared the accuracy of the posterior estimates for the two methods in the context of a single observation. To simplify the comparison we utilized the reduction described in the previous section. Since the accuracy of neither method is aected by this reduction, it su-ces for our purposes here to carry out the comparison in this simpler setting. 1 The posterior probability of interest was therefore P ( 0 jD) / computed for various choices of values for the prior mean 0 and the prior standard deviation . The correct posterior mean and standard deviations were obtained numerically. Figures 3 and 4 present the results. We plot signed dierences in comparing the obtained posterior means to the correct ones; relative errors were used for the posterior standard deviations. The error measures were left signed to reveal any systematic biases. Note that the posterior mean from the variational method is not guaranteed to be a lower bound on the true mean. Such guarantees can be given only for the predictive likelihood. As can be seen in Figures 3(a) and 4(a) the variational method yields signicantly more accurate estimates of the posterior means, for both values of the prior variance. For the posterior variance, the S-L estimate and the variational estimate appear to yield roughly comparable accuracy for the small value of the prior variance (Figure 3(b)); however, for the larger prior variance, the variational approximation is superior (Figure 4(b)). We note that the variational method consistently underestimates the true posterior variance; a fact that could be used to rene the approximation. Finally, in terms of the KL-divergences between the approximate and true posteriors, the variational method and the S-L approximation are roughly equivalent for the small prior variance; and again the 1 Note that the true posterior distribution over can be always recovered from the posterior computed for the one-dimensional reduced parameter variational method is superior for the larger value of the prior variance. This is shown in Figure 5. a) error in mean S-L approximation Variational -0.020.02relative error in stdv S-L approximation Variational Figure 3: a) The errors in the posterior means as a function of g( 0 ), where 0 is the prior mean. Here for the prior. b) The relative errors in the posterior standard deviations as a function of g( 0 ). Again for the prior distribution. a) -0.4 error in mean S-L approximation Variational -0.2 -0.10.1relative error in stdv S-L approximation Variational Figure 4: The plots are the same as in Figure 3, but now for the prior distribution. 5 Extension to belief networks A belief network is a probabilistic model over a set of variables fS i g that are identied with the nodes in an acyclic directed graph. Letting (i) denote the set of parents of node S i in the graph, we dene the joint distribution associated with the belief network as the following product: Y KL-divergence S-L approximation Variational KL-divergence S-L approximation Variational Figure 5: KL-divergences between the approximate and the true posterior distribution as a function of g( 0 ). a) for the prior. b) 3. The two approximation methods have (visually) identical curves for We refer to the conditional probabilities P (S i jS (i) ) as the \local probabilities" associated with the belief network. In this section we extend our earlier work in this paper and consider belief networks in which logistic regression is used to dene the local probabilities (such models have been studied in a non-Bayesian setting by Neal 1992 and by Saul, Jaakkola, & Jordan 1994). Thus we introduce parameter vectors i , one for each binary variable consider models in which each local probability P (S i jS (i) ; i ) is a logistic regression of node S i on its parents S (i) . To simplify the arguments in the following sections, we will consider augmented belief networks in which the parameters themselves are treated as nodes in the belief network (see Figure 6). This is a standard device in the belief network literature and is of course natural within the Bayesian formalism. 5.1 Complete cases A \complete case" refers to a data point in which all of the variables fS i g are observed. If all of the data points are complete cases, then the methods that we developed in the previous section apply immediately to belief networks. This can be seen as follows. Consider the Markov blankets associated with each of the parameters Figure 6(a)). For complete cases each of the nodes within the Markov blanket for each of the parameters is observed (shaded in the diagram). By the independence semantics of belief networks, this implies that the posterior distributions for the parameters are independent of one another (conditioned on the observed data). Thus the problem of estimating the posterior distributions for the parameters reduces to a set of n independent subproblems, each of which is a Bayesian logistic regression problem. We apply the methods developed in the previous sections directly. SS SS Figure a) A complete observation (shaded variables) and the Markov blanket (dashed line) associated with the parameters 4 . b) An observation where the value of S 4 is missing (unshaded in the gure). 5.2 Incomplete cases The situation is substantially more complex when there are incomplete cases in the data set. Incomplete cases imply that we no longer have all the Markov blankets for the parameters in the network. Thus dependencies can arise between the parameter distributions in dierent conditional models. Let us consider this situation in some detail. A missing value implies that the observations arise from a marginal distribution obtained by summing over the missing values of the unobserved variables. The marginal distribution is thus a mixture distribution, where each mixture component corresponds to a particular conguration of the missing variables. The weight assigned to that component is essentially the posterior probability of the associated conguration (Spiegelhalter & Lauritzen 1990). Note that the dependencies arising from the missing values in the observations can make the network quite densely connected (a missing value for a node eectively connects all of the neighboring nodes in the graph). The dense connectivity leaves little structure to be exploited in the exact probabilistic computations in these networks and tends to make exact probabilistic calculations intractable. Our approach to developing Bayesian methods for belief networks with missing variables combines two variational techniques. In particular, we augment the - transformation introduced earlier with a second variational transformation that we refer to as a q-transformation. While the purpose of the -transformation is to convert a local conditional probability into a form that can be integrated analytically, the purpose of the q-transformation is to approximate the eect of marginalizing across missing values associated with one or more parents. 2 Intuitively, the q-transformation 2 Treating the parameter as a parent node helps to emphasize the similarity between these two variational transformations. The principal dierence is that a parameter node has only a single \lls in" the missing values, allowing the variational transformation for complete data to be invoked. The overall result is a closed-form approximation to the marginal posterior. The correct marginalization across missing variables is a global operation that aects all of the conditional models that depend on the variables being marginalized over. Under the variational approximation that we describe below, marginalization is a local operation that acts individually on the relevant conditional models. 5.2.1 Approximate marginalization Consider the problem of marginalizing over a set of variables S 0 under a joint distribution: Y If we performed the marginalization exactly, then the resulting distribution would not retain the same factorization as the original joint (assuming S 0 is involved in more than one of the conditionals); this can be seen from: Y Y where we have partitioned the product into the set of factors that depend on S 0 (indexed by i 0 ) and those that do not (indexed by i 00 ). Marginalization is not generally a local operation on the individual node probabilities P such locality, a desirable goal for computational reasons, can be achieved if we forgo exact marginalization and instead consider approximations. In particular, we describe a variational approximation that preserves locality at the expense of providing a lower bound on the marginal probability instead of an exact result. To obtain the desired variational transformation, we again exploit a convexity property. In particular, for a given sequence consider the geometric average probability distribution. It is well known that the geometric average is less than or equal to the arithmetic average (This can be easily established via an invocation of Jensen's inequality). We can exploit this fact as follows. Consider an arbitrary distribution q(S 0 ), and rewrite the marginalization operation in the following way: child, while in general parents have multiple children. Y Y where the inequality comes from transforming the average over the bracketed term (with respect to the distribution q) into a geometric average. The third line follows from plugging in the form of the joint distribution and exchanging the order of the products. The logarithm of the multiplicative constant C(q) is the entropy of the variational distribution q: Y and therefore log Let us now make a few observations about the result in Eq. (24). First, note that the lower bound in this equation has the same factored form as the original joint probability. In particular, we dene the q-transformation of the ith local conditional probability as follows: ~ Y the lower bound in Eq. (24) is then a product of these q-transformations. Second, note that all the conditionals are transformed by the same distribution q. A change in q can thus aect all the transformed conditionals. This means that the dependencies between variables S that would have resulted from exact marginalization over S 0 have been replaced with \eective dependencies" through a shared variational distribution q. While the bound in Eq. (24) holds for an arbitrary variational distribution q(S 0 ), to obtain a tight bound we need to optimize across q(S 0 ). In practice this involves choosing a constrained class of distributions and optimizing across the class. The simplest form of variational distribution is the completely factorized distribution: Y which yields a variational bound which is traditionally referred to as the \mean eld approximation." This simplied approximation is appropriate in dense models with a relatively large number of missing values. More generally, one can consider structured variational distributions involving partial factorizations that correspond to tractable substructures in the graphical model (cf. Saul & Jordan, 1996). We consider this topic further in the following two sections. Although the main constraint on the choice of q(S 0 ) is the computational one associated with evaluation and optimization, there is one additional constraint that must be borne in mind. In particular, the q-transformed conditional probabilities must be in a form such that a subsequent -transformation can be invoked, yielding as a result a tractable Bayesian integral. A simple way to meet this constraint is to require that the variational distribution q(S 0 ) should not depend on the parameters . As we discuss in the following section, in this case all of the q-transformations simply involve products of logistic functions, which behave well under the -transformation. 5.2.2 Bayesian parameter updates The derivation presented in the previous section shows that approximate variational marginalization across a set of variables S 0 can be viewed as a geometric average of the local conditional probabilities: Y where q(S 0 ) is the variational distribution over the missing values. Note that while the -transformations are carried out separately for each relevant conditional model, the variational distribution q associated with the missing values is the same across all the q-transformations. Given the transformation in eq. (28), the approximate Bayesian updates are obtained readily. In particular, when conditioning on a data point that has missing components we rst apply the q-transformation. This eectively lls in the missing values, resulting in a transformed joint distribution that factorizes as in the case of complete observations. The posterior parameter distributions therefore can be obtained independently for the parameters associated with the transformed local probabilities. Two issues need to be considered. First, the transformed conditional probabilities (cf. Eq. (28)) are products of logistic functions and therefore more complicated than before. The -transformation method, however, transforms each logistic function into an exponential with quadratic dependence on the parameters. Products of such transforms are also exponential with quadratic dependence on the parameters. Thus the approximate likelihood will again be Gaussian and if the prior is a multivariate Gaussian the approximate posterior will also be Gaussian. The second issue is the dependence of the posterior parameter distributions on the variational distribution q. Once again we have to optimize the variational parameters (a distribution in this case) to make our bounds as tight as possible; in particular, we set q to the distribution that maximizes our lower bound. This optimization is carried out in conjunction with the optimization of the parameters for the transformations of the logistic functions, which are also lower bounds. As we show in Appendix B.1, the fact that all of our approximations are lower bounds implies that we can again devise an EM algorithm to perform the maximization. The updates that are derived in the Appendix are as follows: pos i where S (i) is the vector of parents of S i , and the expectations are taken with respect to the variational distribution q. 5.2.3 Numerical evaluation In this section, we provide a numerical evaluation of our proposed combination of q-transformation and -transformation. We study a simple graph that consists of a single node S and its parents S . In contrast to the simple logistic regression case analyzed earlier, the parents S are not observed but instead are distributed according to a distribution P (S ). This distribution, which we manipulate directly in our experiments, essentially provides a surrogate for the eects of a pattern of evidence in the ancestral graph associated with node S (cf. Spiegelhalter & Lauritzen 1990). Our interest is in the posterior probability over the parameters associated with the conditional probability P (SjS ; ). Suppose now that we observe 1. The exact posterior probability over the parameters in this case is given by Our variational method focuses on lower bounding the evidence term in brackets. It is natural to evaluate the overall accuracy of the approximation by evaluating the accuracy of the marginal data likelihood: We consider two dierent variational approximations. In the rst approximation the variational distribution q is left unconstrained; in the second we use an approximation that factorizes across the parents S (the \mean eld" approximation). We emphasize that in both cases the variational posterior approximation over the parameters is a single Gaussian. The results of our experiment are shown in Figures 7 and 8. Each gure displays three curves, corresponding to the exact evaluation of the data likelihood P (D) and the two variational lower bounds. The number of parents in S was 5 and the prior distribution P () was taken to be a zero mean Gaussian with a variable covariance matrix. By the symmetry of the Gaussian distribution and the sigmoid function, the exact value of P (D) was 0:5 in all cases. We considered several choices of P (S ) and P (). In the rst case, the P (S ) were assumed to factorize across the parents and for each leaving a single parameter p that species the stochasticity of P (S ). A similar setting would arise when applying the mean eld approximation in the context of a more general graph. Figure 7 shows the accuracy of the variational lower bounds as a function of p where in Figure 7(a) P i.e., the covariance matrix is diagonal with diagonal components set to 1=5, and in Figure is a sample covariance matrix of 5 Gaussian random vectors distributed according to N(0; I=5). The results of Figure 7(b) are averaged over 5 independent runs. The choice of scaling in N(0; I=5) is made to insure that j gures indicate that the variational approximations are reasonably accurate and that there is little dierence between the two methods. In Figure 8 we see how the mean eld approximation (which is unimodal) deteriorates as the distribution P (S ) changes from a factorized distribution toward a mixture distribution. More specically, let P f (S jp) be the (uniform) factorized distribution discussed above with parameter p and let Pm (S ) be a pure mixture distribution that assigns a probability mass 1=3 to three dierent (randomly chosen) congurations of the parents S . We let P (S where the parameter p m controls the extent to which P (S ) resembles a (pure) mixture distribution. Figure 8 illustrates the accuracy of the two variational methods as a function of p m where in Figure 8(a) As expected, the mean eld approximation deteriorates with an increasing p m whereas our rst variational approximation remains accurate. 6 The dual problem In the logistic regression formulation (eq. (1)), the parameters and the explanatory variables X play a dual or symmetric role (cf. Nadal and Parga 1994). In the Bayesian logistic regression setting, the symmetry is broken by associating the same parameter vector with multiple occurences of the explanatory variables X as shown in Figure 9. Alternatively, we may break the symmetry by associating a single instance of the explanatory variable X with multiple realizations of . In this sense the explanatory variables X play the role of parameters while functions as a continuous latent variable. The dual of the Bayesian regression model is thus a latent a) likelihood likelihood Figure 7: Exact data likelihood (solid line), variational lower bound 1 (dashed line), and variational lower 2 (dotted line) as a function of the stochasticity parameter p of P (S ). In (a) P and in (b) P is a sample covariance of 5 random vectors distributed according to N(0; I=5). a) likelihood likelihood Figure 8: Exact data likelihood (solid line) and the two variational lower bounds (dashed and dotted lines respectively) as a function of the mixture parameter p m . In 0:1 and in (b) variable density model over a binary response variable S. Graphically, in the dual interpretation we have a single \parameter" node for X whereas separate nodes are required for dierent realizations of (illustrated as (i) in the gure) to explain successive observations S (i) . While a latent variable density model over a single binary variable is not particularly interesting, we can generalize the response variable S to a vector of binary variables each component S i has a distinct set of \parameters" associated with it. The latent variables , however, remain in this dual interpretation the same for all S i . We note that strictly speaking the dual interpretation would require us to assign a prior distribution over the new \parameters" vectors X i . For simplicity, however, we omit this consideration and treat X i simply as adjustable parameters. The resulting latent variable (1) (2) (3) (1) (2) (3) (1) (2) (3) x (1) (2) (3) a) b) Figure 9: a) Bayesian regression problem. b) The dual problem. density model over binary vectors is akin to the standard factor analysis model (see e.g. Everitt 1984). This model has already been used to facilitate visualization of high dimensional binary vectors (Tipping 1999). We now turn to a more technical treatment of this latent variable model. The joint distribution is given by where the conditional probabilities for the binary observables are logistic regression models We would like to use the EM- algorithm for parameter estimation. To achieve this we again exploit the variational transformations. The transformations can be introduced for each of the conditional probability in the joint distribution and optimized separately for every observation D n g in the database consisting only of the values of the binary output variables. As in the logistic regression case, the transformations change the unwieldy conditional models into simpler ones that depend on the parameters only quadratically in the exponent. The variational ev- idence, which is a product of the transformed conditional probabilities, retains the same property. Consequently, under the variational approximation, we can compute the posterior distribution over the latent variables in closed form. The mean and the covariance of this posterior can be obtained analogously to the regression case giving The variational parameters t associated with each observation and the conditional model can be updated using eq. (12) where X is replaced with X i , now the vector of parameters associated with the i th conditional model. We can solve the M-step of the EM-algorithm by accumulating su-cient statistics for the parameters X based on the closed form posterior distributions corresponding to the observations in the data set. Omitting the algebra, we obtain the following explicit updates for the parameters: where and the subscript t denotes the quantities pertaining to the observation D t . Note that since the variational transformations that we expoited to arrive at these updates are all lower bounds, the M-step necessarily results in a monotonically increasing lower bound on the log-probability of the observations. This desirable monotonicity property is unlikely to arise with other types of approximation methods, such as the Laplace approximation. We have exemplied the use of variational techniques in the setting of Bayesian parameter estimation. We found that variational methods can be exploited to yield closed form expressions that approximate the posterior distributions for the parameters in logistic regression. The methods apply immediately to a Bayesian treatment of logistic belief networks with complete data. We also showed how to combine mean eld theory with our variational transformation and thereby treat belief networks with missing data. Finally, our variational techniques lead to an exactly solvable EM algorithm for a latent variable density model|the dual of the logistic regression problem. It is also of interest to note that our variational method provides an alternative to the standard iterative Newton-Raphson method for maximum likelihood estimation in logistic regression (an algorithm known as \iterative reweighted least squares" or \IRLS"). The advantage of the variational approach is that it guarantees monotone improvement in likelihood. We present the derivation of this algorithm in Appendix C. Finally, for an alternative perspective on the application of variational methods to Bayesian inference, see Hinton and van Camp (1993) and MacKay (1997). These authors have developed a variational method known as \ensemble learning," which can be viewed as a mean eld approximation to the marginal likelihood. --R Bayesian Theory. Learning Bayesian networks: the combination of knowledge and statistical data. An Introduction to Latent Variable Models. Bayesian Data Analysis. Markov Chain Monte Carlo in Practice. Keeping neural networks simple by minimizing the description length of the weights. An introduction to variational methods in graphical models. Generalized Linear Models. Ensemble learning for hidden Markov models. Duality between learning machines: A bridge between supervised and unsupervised learning. Technical report CRG-TR-93-1 Convex Analysis. Variational Methods in Statistics. Exploiting tractable substructures in intractable net- works Sequential updating of conditional probabilities on directed graphical structures. Probabilistic visualisation of high-dimensional binary data BUGS: A program to perform Bayesian inference using Gibbs sampling. A Optimization of the variational parameters To optimize the variational approximation of eq. The form of this posterior, however, remains at least as unwieldy as the Bayesian logistic regression problem considered earlier in the paper. Proceeding analogously, we transform the logistic functions as in Eq. (7) corresponding to each of the conditional probabilities in the product and obtain P The optimization of these parameters is shown in Appendix B. The metric for optimizing the parameters comes from the fact that the transformations associated with these parameters introduce a lower bound on the probability of the observations. Similarly to the case of the simple Bayesian logistic regression considered previously (see --TR --CTR Edward Snelson , Zoubin Ghahramani, Compact approximations to Bayesian predictive distributions, Proceedings of the 22nd international conference on Machine learning, p.840-847, August 07-11, 2005, Bonn, Germany R. Ksantini , D. Ziou , B. Colin , F. Dubeau, Weighted pseudo-metric for a fast CBIR method, Machine Graphics & Vision International Journal, v.15 n.3, p.471-480, January 2006 Aaron D'Souza , Sethu Vijayakumar , Stefan Schaal, The Bayesian backfitting relevance vector machine, Proceedings of the twenty-first international conference on Machine learning, p.31, July 04-08, 2004, Banff, Alberta, Canada Dmitry Kropotov , Dmitry Vetrov, On one method of non-diagonal regularization in sparse Bayesian learning, Proceedings of the 24th international conference on Machine learning, p.457-464, June 20-24, 2007, Corvalis, Oregon Wang , D. M. Titterington, Lack of Consistency of Mean Field and Variational break Bayes Approximations for State Space Models, Neural Processing Letters, v.20 n.3, p.151-170, November 2004 Stephen Roberts , Evangelos Roussos , Rizwan Choudrey, Hierarchy, priors and wavelets: structure and signal modelling using ICA, Signal Processing, v.84 n.2, p.283-297, February 2004 Shinichi Nakajima , Sumio Watanabe, Variational Bayes Solution of Linear Neural Networks and Its Generalization Performance, Neural Computation, v.19 n.4, p.1112-1153, April 2007 R. A. Choudrey , S. J. Roberts, Variational mixture of Bayesian independent component analyzers, Neural Computation, v.15 n.1, p.213-252, January Perlich , Foster Provost , Jeffrey S. Simonoff, Tree induction vs. logistic regression: a learning-curve analysis, The Journal of Machine Learning Research, 4, p.211-255, 12/1/2003
variational methods;logistic regression;graphical models;incomplete data;belief networks;bayesian estimation
599401
Annealed importance sampling.
Simulated annealingmoving from a tractable distribution to a distribution of interest via a sequence of intermediate distributionshas traditionally been used as an inexact method of handling isolated modes in Markov chain samplers. Here, it is shown how one can use the Markov chain transitions for such an annealing sequence to define an importance sampler. The Markov chain aspect allows this method to perform acceptably even for high-dimensional problems, where finding good importance sampling distributions would otherwise be very difficult, while the use of importance weights ensures that the estimates found converge to the correct values as the number of annealing runs increases. This annealed importance sampling procedure resembles the second half of the previously-studied tempered transitions, and can be seen as a generalization of a recently-proposed variant of sequential importance sampling. It is also related to thermodynamic integration methods for estimating ratios of normalizing constants. Annealed importance sampling is most attractive when isolated modes are present, or when estimates of normalizing constants are required, but it may also be more generally useful, since its independent sampling allows one to bypass some of the problems of assessing convergence and autocorrelation in Markov chain samplers.
Introduction In Bayesian statistics and statistical physics, expectations of various quantities with respect to complex distributions must often be computed. For simple distributions, we can estimate expectations by sample averages based on points drawn independently from the distribution of interest. This simple Monte Carlo approach cannot be used when the distribution is too complex to allow easy generation of independent points. We might instead generate independent points from some simpler approximating distribution, and then use an importance sampling estimate, in which the points are weighted to compensate for use of the wrong distribution. Alternatively, we could use a sample of dependent points obtained by simulating a Markov chain that converges to the correct distribution. I show in this paper how these two approaches can be combined, by using an importance sampling distribution defined by a series of Markov chains. This method is inspired by the idea of "annealing" as a way of coping with isolated modes, which leads me to call it annealed importance sampling. The method is especially suitable when multimodality may be a problem, but may be attractive even when it is not, since it allows one to bypass some of the problems of convergence assessment. Annealed importance sampling also supplies an estimate for the normalizing constant of the distribution sampled from. In statistical physics, minus the log of the normalizing constant for a canonical distribution is known as the "free energy", and its estimation is a long-standing problem. In independent work, Jarzynski (1997a,b) has described a method primarily aimed at free energy estimation that is essentially the same as the annealed importance sampling method described here. I will focus instead on statistical applications, and will discuss use of the method for estimating expectations of functions of state, as well as the normalizing constant. Importance sampling works as follows (see, for example, Geweke 1989). Suppose that we are interested in a distribution for some quantity, x, with probabilities or probability densities that are proportional to the function f(x). Suppose also that computing f(x) for any x is feasible, but that we are not able to directly sample from the distribution it defines. However, we are able to sample from some other distribution that approximates the one defined by f(x), whose probabilities or probability densities are proportional to the function g(x), which we are also able to evaluate. We base our estimates on a sample of N independent points, x from the distribution defined by g(x). For each x (i) , we compute an importance weight as follows: We can then estimate the expectation of a(x) with respect to the distribution defined by f(x) by . N Provided g(x) 6= 0 whenever f(x) 6= 0, it is easy to see that N \Gamma1 as R f(x) dx and Z R g(x) dx are the normalizing constants for f(x) and g(x). One can also see that - a will converge to the expectation of a(x) with respect to the distribution defined by f(x). The accuracy of - a depends on the variability of the importance weights. When these weights vary widely, the estimate will effectively be based on only the few points with the largest weights. For importance sampling to work well, the distribution defined by must therefore be a fairly good approximation to that defined by f(x), so that the ratio f(x)=g(x) does not vary wildly. When x is high-dimensional, and f(x) is complex, and perhaps multimodal, finding a good importance sampling distribution can be very difficult, limiting the applicability of the method. An alternative is to obtain a sample of dependent points by simulating a Markov chain that converges to the distribution of interest, as in the Metropolis-Hastings algorithm (Metropolis, et al 1953; Hastings 1970). Such Markov chain methods have long been used in statistical physics, and are now widely applied to statistical problems, as illustrated by the papers in the book edited by Gilks, Richardson, and Spiegelhalter (1996). Markov chains used to sample from complex distributions must usually proceed by making only small changes to the state variables. This causes problems when the distribution contains several widely-separated modes, which are nearly isolated from each other with respect to these transitions. Because such a chain will move between modes only rarely, it will take a long time to reach equilibrium, and will exhibit high autocorrelations for functions of the state variables out to long time lags. The method of simulated annealing was introduced by Kirkpatrick, Gelatt, and Vecchi (1983) as a way of handling multiple modes in an optimization context. It employs a sequence of distributions, with probabilities or probability densities given by p 0 (x) to in which each p j differs only slightly from p j+1 . The distribution p 0 is the one of interest. The distribution p n is designed so that the Markov chain used to sample from it allows movement between all regions of the state space. A traditional scheme is to set An annealing run is started at some initial state, from which we first simulate a Markov chain designed to converge to p n , for some number of iterations, which are not necessarily enough to actually approach equilibrium. We next simulate some number of iterations of a Markov chain designed to converge to p n\Gamma1 , starting from the final state of the previous simulation. We continue in this fashion, using the final state of the simulation for p j as the initial state of the simulation for finally simulate the chain designed to converge to p 0 . We hope that the distribution of the final state produced by this process is close to p 0 . Note that if p 0 contains isolated modes, simply simulating the Markov chain designed to converge to p 0 starting from some arbitrary point could give very poor results, as it might become stuck in whatever mode is closest to the starting point, even if that mode has little of the total probability mass. The annealing process is a heuristic for avoiding this, by taking advantage of the freer movement possible under the other distributions, while gradually approaching the desired p 0 . Unfortunately, there is no reason to think that annealing will give the precisely correct result, in which each mode of p 0 is found with exactly the right probability. This is of little consequence in an optimization context, where the final distribution is degenerate (at the maximum), but it is a serious flaw for the many applications in statistics and statistical physics that require a sample from a non-degenerate distribution. The annealed importance sampling method I present in this paper is essentially a way of assigning weights to the states found by multiple simulated annealing runs, so as to produce estimates that converge to the correct value as the number of runs increases. This is done by viewing the annealing process as defining an importance sampling dis- tribution, as explained below in Section 2. After discussing the accuracy of importance sampling in general in Section 3, I analyse the efficiency of annealed importance sampling in Section 4, and find that good results can be obtained by using a sufficient number of interpolating distributions, provided that these vary smoothly. Demonstrations on simple distributions in Section 5 and on a statistical problem in Section 6 confirm this. Annealed importance sampling is related to tempered transitions (Neal 1996), which are another way of modifying the annealing procedure so as to produce correct results. As discussed in Section 7, annealed importance sampling will sometimes be preferable to using tempered transitions. When tempered transitions are still used, the relationship to annealed importance sampling allows one to find estimates for ratios of normalizing constants that were previously unavailable. Section 8 shows how one can also view a form of sequential importance sampling due to MacEachern, Clyde, and Liu (1998) as an instance of annealed importance sampling. Finally, in Section 9, I discuss the general utility of annealed importance sampling, as a way of handling multimodal distributions, as a way of calculating normalizing constants, and as a way of combining the adaptivity of Markov chains with the advantages of independent sampling. 2 The annealed importance sampling procedure Suppose that we wish to find the expectation of some function of x with respect to a distribution with probabilities or probability densities given by p 0 (x). We have available a sequence of other distributions, given by p 1 (x) up to p n (x), which we hope will assist us in sampling from p 0 , and which satisfy p j (x) 6= 0 wherever For each distribution, we must be able to compute some function f j (x) that is proportional to We must also have some method for sampling from p n , preferably one that produces independent points. Finally, for each i from 1 to n \Gamma 1, we must be able to simulate some Markov chain transition, T j , that leaves p j invariant. The sequence of distributions used can be specially constructed to suit the problem, but the following scheme may be generally useful. We fix f 0 to give the distribution of interest, and fix f n to give the simple distribution we can sample from, and then let Note that the traditional simulated annealing scheme with f j would usually be less suitable, since it usually leads to a p n for which independent sampling is not easy. For applications in Bayesian statistics, f n would be the prior density, which is often easy to sample from, and f 0 would be the unnormalized posterior distribution (the product of f n and the likelihood). When only posterior expectations are of interest, neither the prior nor the likelihood need be normalized. When the normalizing constant for the posterior (the marginal likelihood) is of interest, the likelihood must be properly normalized, but the prior need not be, as discussed below. The Markov chain transitions are represented by functions T giving the probability or probability density of moving to x 0 when the current state is x. It will not be necessary to actually compute T j (x; x 0 ), only to generate an x 0 from a given x using T j . These transitions may be constructed in any of the usual ways (eg, Metropolis or Gibbs sampling updates), and may involve several scans or other iterations. For the annealed importance sampling scheme to be valid, each T j must leave the corresponding p j invari- ant, but it is not essential that each T j produce an ergodic Markov chain (though this would usually be desirable). Annealed importance sampling produces a sample of points, x corresponding weights, w An estimate for the expectation of some function, a(x), can then be found as in equation (2). To generate each point, x (i) , and associated weight, w (i) , we first generate a sequence of points, x Generate x n\Gamma1 from p n . Generate x n\Gamma2 from x using T Generate x 1 from x 2 using T 2 . Generate x 0 from x 1 using T 1 . We then let x f To avoid overflow problems, it may be best to do the computations in terms of log(w (i) ). To see that annealed importance sampling is valid, we can consider an extended state space, with points with the original state, so that any function of the original state can be considered a function of the extended state, by just looking at only this component. We define the distribution for by the following function proportional to the joint probability or probability density: Here, e T j is the reversal of the transition defined by T j . That is, e The invariance of p j with respect to T j ensures that these are valid transition probabili- ties, for which R e 1. This in turn guarantees that the marginal distribution for x 0 in (6) is the same as the original distribution of interest (since the joint probability there is the product of this marginal probability for x 0 and the conditional probabilities for each of the later components given the earlier components). For use below, we apply equation (7) to rewrite the function f as follows: e f e f We now look at the joint distribution for defined by the annealed importance sampling procedure (4). It is proportional to the following function: We regard this as an importance sampler for the distribution (6) on the extended state space. The appropriate importance weights are found using equations (1), (9), and (10). Dropping the superscript (i) on the right side to simplify notation, they are: f f These weights are the same as those of equation (5), showing that the annealed importance sampling procedure is valid. The above procedure produces a sample of single independent points x (i) for use in estimating expectations as in equation (2). In practice, better estimates will often be obtained if we use each such point as the initial state for a Markov chain that leaves p 0 invariant, which we simulate for some pre-determined number of iterations. We can then estimate the expectation of a(x) by the weighted average (using the w (i) ) of the simple average of a over the states of this Markov chain. This is valid because the expectation of a(x) with respect to p 0 (x) is the same as the expectation with respect to p 0 (x) of the average value of a along a Markov chain that leaves p 0 invariant and which is started in state x (since if the start state has distribution p 0 , all later states will also be from p 0 ). Annealed importance sampling also provides an estimate of the ratio of the normalizing constants for f 0 and f n . Such normalizing constants are important in statistical physics and for statistical problems such as Bayesian model comparison. The normalizing constant for f , as defined by equation (6), is the same as that for f 0 , and the normalizing constant for g in equation (10) is the same as that for f n . The average of the importance weights, converges to the ratio of these normalizing constants, Z 0 =Z n , where In a Bayesian application where f n is proportional to the prior and f 0 is the product of f n and the likelihood, the ratio Z 0 =Z n will be the marginal likelihood of the model - that is, the prior probability or probability density of the observed data. Note that the prior need not be normalized, since any constant factors there will cancel in this ratio, but the likelihood must include all constant factors for this estimate of the marginal likelihood to be correct. The data collected during annealed importance sampling runs from p n down to p 0 can also be used to estimate expectations with respect to any of the intermediate distribu- simply uses the states, x j , found after application of in (4), with weights found by omitting the factors in equation (5) that pertain to later states. Similarly, one can estimate the ratio of the normalizing constants for f j and f n by averaging these weights. Finally, although we would usually prefer to start annealing runs with a distribution p n from which we can generate independent points, annealed importance sampling is still valid even if the points x n\Gamma1 generated at the start of each run are not independent. In particular, these points could be generated using a Markov chain that samples from . The annealed importance sampling estimates will still converge to the correct values, provided the Markov chain used to sample from p n is ergodic. 3 Accuracy of importance sampling estimates Before discussing annealed importance sampling further, it is necessary to consider the accuracy of importance sampling estimates in general. These results will also be needed for the demonstrations in Sections 5 and 6. For reference, here again is the importance sampling estimate, - a, for E f [a], based on points x (i) drawn independently from the density proportional to g(x): . N where w are the importance weights. The accuracy of this importance sampling estimator is discussed by Geweke (1989). An estimator of the same form is also used with regenerative Markov chain methods (Mykland, Tierney, and Yu 1995; Ripley 1987), where the weights are the lengths of tours between regeneration points. In determining the accuracy of this estimator, we can assume without loss of generality that the normalizing constant for g is such that E g [w (i) since multiplying all the w (i) by a constant has no effect on - a. We can also assume that E f since adding a constant to a(x) simply shifts - a by that amount, without changing its variance. For large N , the numerator and denominator on the right side of equation (12) will converge to their expectations, which on these assumptions gives are the differences of the averages from their expectations. When N is large, we can discard all but the first term, e 1 . We can judge the accuracy of - a by its variance (assuming this is finite), which we can approximate as hi We now return to an actual situation, in which E g [w (i) ] may not be one, and E f [a] may not be zero, by modifying equation (14) suitably: hi Geweke (1989) estimates this from the same data used to compute - a, as follows: d . h N This is equivalent to the estimate discussed by Ripley (1987, Section 6.4) in the context of regenerative simulation. When N is small, Ripley recommends using a jacknife estimate instead. When w (i) and a(x (i) ) are independent under g, equation (15) simplifies to (w (i) The last step above uses the following: Equation (18) shows that when w (i) and a(x (i) ) are independent, the cost of using points drawn from g(x) rather than f(x) is given by one plus the variance of the normalized importance weights. We can estimate this using the sample variance of This gives us a rough indication of the factor by which the sample size is effectively reduced, without reference to any particular function whose expectation is to be estimated. Note that in many applications the expectations of several functions will be estimated from the same sample of x (i) . The variance of the w (i) is also intuitively attractive as an indicator of how accurate our estimates will be, since when it is large, the few points with the largest importance weights will dominate the estimates. It would be imprudent to trust an estimate when the adjusted sample size, )), is very small, even if equation (16) gives a small estimate for the variance of the estimator. One should note, however, that it is possible for the sample variance of the w (i) to be small even when the estimates are wildly inaccurate, since this sample variance could be a very bad estimate of the true variance of the normalized importance weights. This could happen, for example, if an important mode of f is almost never seen when sampling from g. Earlier, it was suggested that E f [a] might be estimated by the weighted average of the values of a over the states of a Markov chain that is started at each of the x (i) . The accuracy of such an estimate should be estimated by treating these average values for a as single data points. Treating the dependent states from along the chain as if they were independently drawn from g could lead to overestimation of the effective sample size. Finally, if the x (i) are not independently drawn from g, but are instead generated by a Markov chain sampler, assessing the accuracy of the estimates will be more difficult, as it will depend both on the variance of the normalized importance weights and on the autocorrelations produced by the Markov chain used. This is one reason for preferring a p n from which we can generate points independently at the start of each annealed importance sampling run. 4 Efficiency of annealed importance sampling The efficiency of annealed importance sampling depends on the normalized importance weights, w not having too large a variance. There are several sources of variability in the importance weights. First, different annealing runs may end up in different modes, which will be assigned different weights. The variation in weights due to this will be large if some important modes are found only rarely. There is no general guarantee that this will not happen, and if it does, one can only hope to find a more effective scheme for defining the annealing distributions, or use a radically different Markov chain that eliminates the isolated modes altogether. High variability in the importance weights can also result from using transitions for each of these distributions that do not bring the distribution close to equilibrium. The extreme case of this is when all the T j do nothing, in which case annealed importance sampling reduces to simple importance sampling based on p n , which will be very inefficient if p n is not close to p 0 . Variability from this source can reduced by increasing the number of iterations of the basic Markov chain update used. For example, if each consists of K Metropolis updates, the variance of the importance weights might be reduced by increasing K, so that T j brings the state closer to its equilibrium distribution, least within a local mode). Variability in the importance weights can also come from using a finite number of distributions to interpolate between p 0 and p n , We can analyse how this affects the variance of the w (i) when the sequence of distributions used comes from a smoothly- varying one-parameter family, as in equation (3). For this analysis, we will assume that each T j produces a state drawn from p j , independent of the previous state. This assumption is of course unrealistic, especially when there are isolated modes, but the purpose here is to understand effects unrelated to Markov chain convergence. It is convenient to look at log(w (i) ) rather than w (i) itself. As discussed in Section 3, we can measure the inefficiency of estimation by one plus the variance of the normalized importance weights. Using the fact that E[Y q and X is Gaussian with mean - and variance oe 2 , we see that if the log(w (i) ) are Gaussian with mean - and variance oe 2 , the sample size will be effectively reduced by the factor From equation (5), log(w (i) If the distributions used are as defined by equation (3), log(w (i) log(f If we further assume that the fi j are equally spaced (between 0 and 1), we have log(w (i) ) =n log(f Under the assumption that T j produces a state drawn independently from p j , and provided that log(f 0 is drawn from the Central Limit Theorem can be applied to conclude that log(w (i) ) will have an approximately Gaussian distribution for large n (keeping f 0 and f n fixed as n increases). The variance of log(w (i) ) will asymptotically have the form oe 2 and one plus the variance of the normalized weights will have the form exp(oe 2 we assume that each transition, T j , takes a fixed amount of time (regardless of n), the time required to produce an estimate of a given degree of accuracy will be proportional to n exp(oe 2 0 =n), which is minimized when 0 , at which point the variance of the logs of the importance weights will be one and the variance of the normalized importance weights will be e \Gamma 1. The same behaviour will occur when the fi j are not equally spaced, as long as they are chosen by a scheme that leads to going down approximately in inverse proportion to n. Over a range of fi values for which p j is close to Gaussian, and p 0 (x) is approximately constant in regions of high density under p j , an argument similar to that used for tempered transitions (Neal 1996, Section 4.2) shows that the best scheme uses a uniform spacing for log(fi j ) (ie, a geometric spacing of the fi j themselves). The results above also hold more generally for annealing schemes that are based on families of distributions for which the density at a given x varies smoothly with a parameter analogous to fi. We can get some idea of how the efficiency of annealed importance sampling will be affected by the dimensionality of the problem by supposing that under each p j , the K components of x are independent and identically distributed. Assuming as above that each T j produces an independent state drawn from p j , the quantities log(f 0 log(f n be composed of K identically distributed independent terms. The variance of each such quantity will increase in proportion to K, as will the variance of log(w (i) ), which will asymptotically have the form Koe 2 =n. The optimal choice of n will be Koe 2 0 , which makes the variance of the normalized importance weights e \Gamma 1, as above. Assuming that behaviour is similar for more interesting distributions, where the components are not independent, this analysis shows that increasing the dimensionality of the problem will slow down annealed importance sampling. However, this linear slowdown is much less severe than that for simple importance sampling, whose efficiency goes down exponentially with K. The above analysis assumes that each T j generates a state nearly independent of the previous state, which would presumably require many Metropolis or Gibbs sampling iterations. It is probably better in practice, however, to use transitions that do not come close to producing an independent state, and hence take much less time, while increasing the number of interpolating distributions to produce the same total computation time. The states generated would still come from close to their equilibrium distributions, since these distributions will change less from one annealing step to the next, and the increased number of distributions may help to reduce the variance of the importance weights, though perhaps not as much as in the above analysis, since the terms in equation (24) will no longer be independent. We therefore see that the variance of the importance weights can be reduced as needed by increasing the number of distributions used in the annealing scheme, provided that the transitions for each distribution are good enough at establishing equilibrium. When there are isolated modes, the latter provision will not be true in a global sense, but transitions that sample well within a local mode can be used. Whether the performance of annealed importance sampling is adequate will then depend on whether the annealing heuristic is in fact capable of finding all the modes of the distribution. In the absence of any theoretical information pointing to where the modes are located, reliance on some such heuristic is inevitable. 5 Demonstrations on simple distributions To illustrate the behaviour of annealed importance sampling, I will show how it works on a simple distribution with a single mode, using Markov chain transitions that sample well for all intermediate distributions, and on a distribution with two modes, which are isolated with respect to the Markov chain transitions for the distribution of interest. Both distributions are over R 6 . In the unimodal distribution, the six components of the state, x 1 to x 6 , are independent under with the distribution for each being Gaussian with mean 1 and standard deviation 0.1. This distribution was defined by f 0 normalizing constant is (2-0:1 2 sequence of annealing distributions was defined according to the scheme of equation (3). Under the distribution chosen for the components were independent, each being Gaussian with mean zero and standard deviation 1. The function f n used to define this distribution was chosen to be the corresponding Gaussian probability density, which was normalized. We can therefore estimate the normalizing constant for f 0 by the average of the importance weights. To use annealed importance sampling, we must choose a sequence of fi j that define the intermediate distributions. Both the number and the spacing of the fi j must be appropriate for the problem. As mentioned in the previous section, for a Gaussian p 0 , and a diffuse p n , we expect that a geometric spacing will be appropriate for the fi j that are not too far from one. I spaced the fi j near zero arithmetically. In detail, for the first test, I used 40 fi j spaced uniformly from 0 to 0.01, followed by 160 fi j spaced geometrically from 0.01 to 1, for a total of 200 distributions. In later tests, annealing sequences with twice as many and half as many distributions were also used, spaced according to the same scheme. We must also define Markov chain transitions, T j , for each of these distributions. In general, one might use different schemes for different distributions, but in these tests, I used Metropolis updates with the same proposal distributions for all T j (the transition probabilities themselves were of course different for each T j , since the Metropolis acceptance criterion changes). In detail, I used sequences of three Metropolis updates, with Gaussian proposal distributions centred on the current state having covariances of 0:05 2 I, 0:15 2 I, and 0:5 2 I. Used together, these three proposal distributions lead to adequate mixing for all of the intermediate distributions. For the first test, this sequence of three updates was repeated 10 times to give each T j ; in one later test, it was repeated only 5 times. For each test, 1000 annealing runs were done. In the first test, 200 states were produced in each run, as a result of applying each T j in succession, starting from a point generated independently from p 200 . I saved only every twentieth state, however, after applying etc. down to T 0 . Note that T 0 was applied at the end of each run in these tests, even though this is not required (this occurs naturally with the program used). Only the state after applying T 0 was used for the estimates, even though it is valid to use the state after T 1 as well. Figure 1 shows the results of this first test. The upper graphs show how the variance of the log of the importance weights increases during the course of a run. (Importance weights before the run is over are defined as in equation (5), but with the factors for the later distributions omitted.) When, as here, the transitions for all distributions are expected to mix well, the best strategy for minimizing the variance of the final weights is to space the fi j so that the variance of the log weights increases by an equal amount in each annealing step. The plot in the upper right shows that the spacing chosen for this test is close to optimal in this respect. Furthermore, according to the analysis of Section 4, the number of intermediate distributions used here is close to optimal, since the variance of the logs of the weights at the end of the annealing run is close to one. The lower two graphs in Figure 1 show the distribution of the value of the first component of the state (x 1 ) in this test. As seen in the lower left, this distribution narrows to the distribution under p 0 as fi approaches one. The plot in the lower right shows the values of the first component and of the importance weights for the states at the ends of the runs. In this case, the values and the weights appear to be independent. The estimate for the expectation of the first component of the state in this first test is 1.0064, with standard error 0.0050, as estimated using equation (16). This is compatible with the true value of one. In this case, the error estimate from equation (16) is close what one would arrive at from the estimated standard deviation of 0.10038 and the adjusted sample size of expected when the values and the weights are independent. The average of the importance weights for this test was 0.000236, with standard error 0.000008 (estimated simply from the sample variance of the weights divided by N ); this is compatible with the true normalizing constant of 0.000248. Two tests were done in which each run used half as much computer time as in the first test. In one of these, the annealing sequence was identical to the first test, but the number of repetitions of the three Metropolis updates in each T j was reduced from 10 to 5. This increased the variance of the normalized importance weights to 2.18, with a corresponding increase in the standard errors of the estimates. In the other test, the number of distributions in the annealing sequence was cut in half (spaced according to the same scheme as before), while the number of Metropolis repetitions was kept at 10. This increased the variance of the normalized importance weights to 2.72. As expected, spreading a given number of updates over many intermediate distributions appears to be better than using many updates to try to produce nearly independent points at each of fewer stages. The final test on this unimodal distribution used twice as many intermediate distri- butions, spaced according to the same scheme as before. This reduced the variance of the normalized importance weights to 0.461, with a corresponding reduction in standard errors, but the benefit in this case was not worth the factor of two increase in computer time. However, this test does confirm that when each T j mixes well, the variance of the importance weights can be reduced as desired by spacing the fi j more closely. Tests were also done on a distribution with two modes, which was a mixture of two Gaussians, under each of which the six components were independent, with the same means and standard deviations. One of these Gaussians, with mixing proportion 1=3, had means of 1 and standard deviations of 0.1, the same as the distribution used in the unimodal tests. The other Gaussian, with mixing proportion 2=3, had means of \Gamma1 and standard deviations of 0.05. This mixture distribution was defined by the following The normalizing constant for this f 0 is 3 0:000744. The means of the components with respect to this p 0 are \Gamma1=3. The same f n as before was used for these tests (independent standard Gaussian distributions for each component, normalized). The same transitions based on Metropolis updates were used as well, along with the same scheme for spacing the fi j . For the first test, the number of distributions used was 200, as in the first test on the unimodal distribution. The results are shown in Figure 2. As seen in the lower left of the figure, the distributions for fi near zero cover both modes, but as fi is increased, the two modes become separated. The Metropolis updates are not able to move between these modes when fi is near one, even when using the larger proposals with standard deviation 0.5, since the probability of proposing a movement to the other mode simultaneously for all six components is very small. Both modes are seen when annealing, but the mode at \Gamma1 is seen only rarely - 27 times in the 1000 runs - despite the fact that it has twice the probability of the other mode under the final distribution at average over the final states of the annealing runs would therefore give very inaccurate results. The plot in the lower right of the figure shows how the importance weights compensate for this unrepresentative sampling. The runs that ended in the rarely-sampled mode received much higher weights than those ending in the well-sampled mode. The estimate for the expectation of the first component from these runs was \Gamma0:363, with an estimated standard error of 0.107 (from equation (16)), which is compatible with the true value of \Gamma1=3. This standard error estimate is less than one might expect from the estimated standard deviation of 0.92 and the adjusted sample size of N = (1 +Var(w )), which was 35.0. The difference arises because the values and the importance weights are not independent in this case. The average of the importance weights in these runs was 0.000766, with an estimated standard error of 0.000127, which is compatible with the true value of 0.000744 for the normalizing constant of f 0 . beta log weight index of distribution variance of log weights 200 150 100 50 00.20.61.01.4 beta first component of state -11first component of state importance weight Figure 1: Results of the first test on the unimodal distribution. Upper left: the logs of the importance weights at ten values of fi, for each of the 1000 runs. Upper right: the variance of the log weights as a function of the index of fi. Lower left: the distribution of the first component of the state at ten fi values. Lower right: the joint distribution of the first component and the importance weight at the ends of the runs. Random jitter was added to the fi values in the plots on the left to improve the presentation. beta log weight index of distribution variance of log weights 200 150 100 50 00.20.61.01.4 beta first component of state -11first component of state importance weight Figure 2: Results of the first test on the distribution with two modes. The four plots here correspond to those in Figure 1. We therefore see that annealed importance sampling produces valid estimates for this example. However, the procedure is less efficient than we might hope, because so few runs end in the mode at \Gamma1. Another symptom of the problem is that the variance of the normalized importance weights in this test was 27.6 - quite high compared to the variance of 1.12 seen in the similar test on the unimodal distribution. We can see how this comes about from the upper plots in Figure 2. For small values of fi, these plots are quite similar to those in Figure 1, presumably because the mode at \Gamma1 has almost no influence for these distributions. However, this mode becomes important as fi approaches one, producing a high variance for the weights at the end. One might hope to reduce the variance of the importance weights by increasing the number of intermediate distributions (ie, by spacing the fi j more closely). I ran tests with twice as many distributions, and with four times as many distributions, in both cases using the same number of Metropolis updates for each distribution as before. The results differed little from those in the first test. The variance of the importance weights for runs ending within each mode was reduced, but the difference in importance weights between modes was not reduced, and the number of runs ending in the mode at \Gamma1 did not increase. There was therefore little difference in the standard errors for the estimates. For this example, the annealing heuristic used was only marginally adequate. One could expect to obtain better results only by finding a better initial distribution, p n , or a better scheme for interpolating from p n to p 0 than that of equation (3). This example also illustrates the dangers of uncritical reliance on empirical estimates of accuracy. If only 100 runs had been done, the probability that none of the runs would have found the mode at \Gamma1 would have been around 0:07. This result can be simulated using the first 100 runs that ended in the mode at +1 from the 1000 runs of the actual test. Based on these 100 runs, the estimate for the expectation of the first component is 0.992, with an estimated standard error 0.017, and the estimate for the normalizing constant of f 0 is 0.000228, with an estimated standard error of 0.000020. Both estimates differ from the true values by many times the estimated standard error. Such unrecognized inaccuracies are of course also possible with any other importance sampling or Markov chain method, whenever theoretically-derived guarantees of accuracy are not available. 6 Demonstration on a linear regression problem To illustrate the use of annealed importance sampling for statistical problems, I will briefly describe its application to two Bayesian models for a linear regression problem, based on Gaussian and Cauchy priors. This example, and that of the previous section, are implemented using my software for flexible Bayesian modeling (version of 1998-09-01). The data and command files used are included with that software, which is available from my web page. The data consists of 100 independent cases, each having 10 real-valued predictor vari- ables, real-valued response variable, y, which is modeled by y =X The residual, ffl, is modeled as Gaussian with mean zero and unknown variance oe 2 . The 100 cases were synthetically generated from this model with oe 10. The predictor variables were generated from a multivariate Gaussian with the variance of each x i being one and with correlations of 0.9 between each pair of x i . Two Bayesian models were tried. In both, the prior for the reciprocal of the residual variance (1=oe 2 ) was gamma with mean 1=0:1 2 and shape parameter 0:5. Both models also had a hyperparameter, - 2 , controlling the width of the distribution of the fi k . Its reciprocal was given a gamma prior with mean 1=0:05 2 and shape parameter 0:25. For the model with Gaussian priors, - 2 was the variance of the fi k , which had mean zero, and were independent conditional on - 2 . The model based on Cauchy priors was similar, except that - was the width parameter of the Cauchy distribution (ie, the density for fi k conditional on - was (1=-)[1+ fi 2 suspect that the Cauchy prior will prove more appropriate for the actual data, since this prior gives substantial probability to situations where many of the fi k are close to zero, but a few fi k are much bigger. It seems quite possible that the posterior using the Cauchy prior could be multimodal. Since the x i are highly correlated, one fi k can to some extent substitute for another. The Cauchy prior favours situations where only a few fi k are large. This could produce several posterior modes that correspond to different sets of fi k being regarded as significant. I sampled for both models using a combination of Gibbs sampling for oe 2 and the "hybrid Monte Carlo" method for the fi k (see Neal 1996). There was no sign of any problems with isolated modes, but it is difficult to be sure on this basis that no such modes exist. Annealed importance sampling was applied in order to either find any isolated modes or provide further evidence of their absence, and also to compare the two models by calculating their marginal likelihoods. An annealing schedule based on equation (3) was used. After some experimentation, adequate results were obtained using such a schedule with 1000 distributions: 50 distributions geometrically spaced from distributions geometrically spaced from finally 500 distributions geometrically spaced from updates were used for each distribution. A single annealing run took approximately 8 seconds on our 194 MHz SGI machine. I did 500 such runs for each model. Because a few of the annealing runs resulted in much smaller weights than others, the variance of the logs of the weights was very large, and hence was not useful in judging whether the annealing schedule was good. Instead, I looked at )), the log of one plus the variance of the normalized importance weights. If the distribution of the logs of the weights were Gaussian, W would be equal to the variance of the logs of the weights. When this distribution is not Gaussian, W is less affected by a few extremely small weights. Plots of W show that for both models it increases approximately linearly with the index of the distribution, reaching a final value around 0.6, only a bit less than the optimal value of one. For both models, the estimates of the posterior means of the fi k found using annealed importance did not differ significantly from those found using hybrid Monte Carlo without annealing. It therefore appears that isolated modes were not present in this problem. The annealed importance sampling runs yielded estimates for the log of the marginal likelihood for the model with Gaussian priors of -158.68 and for the model with Cauchy priors of -158.24, with a standard error of 0.04 for both estimates. The difference of 0.44 corresponds to a Bayes factor of 1.55 in favour of the model with Cauchy priors. 7 Relationship to tempered transitions Several ways of modifying the simulated annealing procedure in order to produce asymptotically correct estimates have been developed in the past, including simulated tempering (Marinari and Parisi 1992; Geyer and Thompson 1995) and Metropolis coupled Markov chains (Geyer 1991). The method of tempered transitions (Neal 1996) is closely related to the annealed importance sampling method of this paper. The tempered transition method samples from a distribution of interest, p 0 , using a Markov chain whose transitions are defined in terms of an elaborate proposal procedure, involving a sequence of other distributions, p 1 to p n . The proposed state is found by simulating a sequence of base transitions, - leave invariant the distributions 1 to p n , followed by a second sequence of base transitions, - T n to - which leave p n to invariant, and which are the reversals of the corresponding - with respect to the p j . The decision whether to accept or reject the final state is based on a product of ratios of probabilities under the various distributions; if the proposed state is rejected, the new state is the same as the old state. In detail, such a tempered transition operates as follows, starting from state - x Generate - x 1 from - using - Generate - x 2 from - using - Generate - x n from - x using - Generate - x using - Generate - x 1 from - using - Generate - x 0 from - using - The state - x 0 is then accepted as the next state of the Markov chain with probability min The second half of the tempered transition procedure (26) is identical to the annealed importance sampling procedure (4), provided that - T n in fact generates a point from p n that is independent of - x n . We can also recognize that the annealed importance sampling weight given by equation (5) is essentially the same as the second half of the product defining the tempered transition acceptance probability (27). Due to these similarities, the characteristics of annealed importance sampling will be quite similar to those of the corresponding tempered transitions. In particular, the comparison by Neal (1996) of tempered transitions with simulated tempering is relevant to annealed importance sampling as well. The major difference between annealed importance sampling and tempered transitions is that each tempered transition requires twice as much computation as the corresponding annealing run, since a tempered transition involves an "upward" sequence of transitions, from p 1 to p n , as well as the "downward" sequence, from p n to p 1 , that is present in both methods. This is a reason to prefer annealed importance sampling when it is easy to generate independent points from the distribution p n . When this is not easy, tempered transitions might be preferred, though annealed importance sampling could still be used in conjunction with a Markov chain sampler that produces dependent points from p n . With tempered transitions, there is also the possibility of using more than one sequence of annealing distributions (with the sequence chosen randomly for each tempered transition, or in some fixed order). Potentially, this could lead to good sampling even when neither annealing sequence would be adequate by itself. There appears to be no way of employing multiple annealing sequences with annealed importance sampling without adding an equivalent of the "upward" sequence present in tempered transitions. When tempered transitions are used, the idea behind annealed importance sampling can be applied in order to estimate ratios of normalizing constants, which were previously unavailable when using tempered transitions. To see how to do this, note that the first half of a tempered transition (up to the generation of - x x n\Gamma2 using - is the same as an annealed importance sampling run, but with the sequence of distributions reversed (p 0 and p n exchange roles, the first state of the run is the current state, - x 0 , which comes from p 0 , and in general, x j of (4) corresponds to - x n\Gamma1\Gammaj of (26)). The importance weights for this backwards annealed importance sampling are f The average of these weights for all tempered transitions (both accepted and rejected) will converge to the ratio of normalizing constants for f n and f 0 . A similar estimate can be found by imagining the reversal of the Markov chain defined by the tempered transitions. In this chain, the states are visited in the reverse order, the accepted transitions of the original chain become accepted transitions in the reversed chain (but with the reversed sequence of states), and the rejected transitions of the original chain remain unchanged. An importance sampling estimate for the ratio of normalizing constants for f n and f 0 can be obtained using this reversed chain, in the same manner as above. The importance weights for the accepted transitions are as follows, in terms of the original chain: f f The importance weights for the rejected transitions are the same as in equation (28). These two estimates can be averaged, producing an estimate that uses the states at both the beginning and the end of the accepted transitions, plus the states at the beginning of the rejected transitions, with double weight. An estimate for the ratio of the normalizing constant for f j to that for f 0 can be found in similar fashion for any of the intermediate distributions, by simply averaging the weights obtained by truncating the products in equations (28) and (29) at the appropriate point. These weights can also be used to estimate expectations of functions with respect to these intermediate distributions. Note that error assessment for all these importance sampling estimates will have to take into account both the variance of the importance weights and the autocorrelations produced by the Markov chain based on the tempered transitions. A cautionary note regarding these estimates comes from considering the situation when only two distributions are used, which are the prior and the posterior for a Bayesian model. The estimate for the reciprocal of the marginal likelihood based on equation (28) will then be the average over points drawn from the posterior of the reciprocal of the likelihood. This estimator will often have infinite variance, and will be very bad for any problem where there is enough data that the posterior is not much affected by the prior (since the marginal likelihood is affected by the prior). Compare this to the annealed importance sampling estimate for the marginal likelihood using just these two distributions, which will be the average of the likelihood over points drawn from the prior. This is not very good when the posterior is much more concentrated than the prior, but it is not as bad as averaging the reciprocal of the likelihood. Even when many intermediate distributions are used, it seems possible the annealed importance sampling estimates may be better than the corresponding "backwards" estimates using tempered transitions (assuming that p n is more diffuse than p 0 ). 8 Relationship to sequential importance sampling A variant of sequential importance sampling recently developed by MacEachern, Clyde, and Liu (1998) can be viewed as an instance of annealed importance sampling, in which the sequence of distributions is obtained by looking at successively more data points. This method (which MacEachern, et al call Sequential Importance Sampler S4) applies to a model for the joint distribution of observable variables x along with associated latent variables s (which have a finite range). We are able to compute these joint probabilities, as well as the marginal probabilities for the x k together with the s k over any subset of the indexes. We wish to estimate expectations with respect to the conditional distribution of s known values for x We could apply Gibbs sampling to this problem, but it is possible that it will be slow to converge, due to isolated modes. The method of MacEachern, et al can be viewed as annealed importance sampling with a sequence of distributions, p 0 to p n , in which p j is related to the distribution conditional on of the observed variables; p 0 is then the distribution of interest, conditional on all of x In detail, these distributions have probabilities proportional to the following Y We can apply annealed importance sampling with this sequence of distributions, using transitions defined as follows. T j begins with some number of Gibbs sampling updates for s 1 to s n\Gammaj , based only on P We can ignore s n\Gammaj+1 to s n here because we can generate values for them afterward from their conditional distribution independently of their previous values. This is done by forward simulation based on their conditional probabilities. (Actually, there is no need to generate values for s k with k ? since these values have no effect on the subsequent computations anyway.) This is easily seen to be equivalent to the sampling done in procedure S4 of MacEachern, et al . The importance weights of equation (5) are products of factors of the following form: The product of these factors produces the same weights as used by MacEachern, et al . Sequential Importance Sampler S4 of MacEachern, et al is thus equivalent to annealed importance sampling with the annealing distributions defined by equation (30). Unlike the family of distributions given by equation (3), these distributions form a fixed, discrete family. Consequently, the variance of the importance weights cannot be decreased by increasing the number of distributions. This could sometimes make the method too inefficient for practical use. However, it is possible that the sequence of distributions defined by equation (30) could be extended to a continuous family by partially conditioning on the x k in some way (eg, by adjusting the variance in a Gaussian likelihood). Other forms of annealed importance sampling (eg, based on the family of equation (3)) could also be applied to this problem. 9 Discussion Annealed importance sampling is potentially useful as a way of dealing with isolated modes, as a means of calculating ratios of normalizing constants, and as a general Monte Carlo method that combines independent sampling with the adaptivity of Markov chain methods. Handling isolated modes was the original motivation for annealing, and has been the primary motivation for developing methods related to annealing that produce asymptotically correct results. Annealed importance sampling is another such method, whose characteristics are similar to those of tempered transitions. As I have discussed (Neal 1996), which of these methods is best may depend on whether the sequence of annealing distributions is "deceptive" in certain ways. It is therefore not possible to say that annealed importance sampling will always be better than other methods such as simulated tempering, but it is probably the most easily implemented of these methods. Annealing methods are closely related to methods for estimating ratios of normalizing constants based on simulations from many distributions, many of which are discussed by Gelman and Meng (1998). It is therefore not surprising that the methods of simulated tempering (Marinari and Parisi 1992; Geyer and Thompson 1995) and Metropolis coupled Markov chains (Geyer 1991) easily yield estimates for ratios of normalizing constants as a byproduct. Tempered transitions were previously seen as being deficient in this respect (Neal 1996), but we now see that such estimates can in fact be obtained by using annealed importance sampling estimators in conjunction with tempered transitions. One can also estimate expectations with respect to all the intermediate distributions in this way (as is also possible with simulated tempering and Metropolis coupled Markov chains). Ratios of normalizing constants can also be obtained when using annealed importance sampling itself, which from this perspective can be seen as a form of thermodynamic integration (see Gelman and Meng 1998). One might expect a thermodynamic integration estimate based on a finite number of points to suffer from systematic error, but the results of this paper show that the annealed importance sampling estimate for the ratio of normalizing constants is in fact unbiased, and will converge to the correct value as the number of annealing runs increases. (Note that in this procedure one averages the estimates from multiple runs for the ratio of normalizing constants, not for the log of this ratio, as might perhaps seem more natural.) Unlike simulated tempering and the related method of umbrella sampling (Torrie and preliminary estimates for ratios of normalizing constants are required when using annealed importance sampling. Metropolis coupled Markov chains share this advantage, but have the disadvantage that they require storage for states from all the intermediate distributions. Annealed importance sampling may therefore be the most convenient general method for estimating normalizing constants. In addition to these particular uses, annealed importance sampling may sometimes be attractive because it combines independent sampling with the ability of a Markov chain sampler to adapt to the characteristics of the distribution. Evans (1991) has also devised an adaptive importance sampling method that makes use of a sequence of intermediate distributions, similar to that used for annealing. His method requires that a class of tractable importance sampling densities be defined that contains a density appropriate for each of the distributions in this sequence. Annealed importance sampling instead uses a sampling distribution that is implicitly defined by the operation of the Markov chain transitions, whose density is generally not tractable to compute, making its use for simple importance sampling infeasible. From this perspective, the idea behind annealed importance sampling is that one can nevertheless find appropriate importance weights for use with this sampling distribution by looking at ratios of densities along the sequence of intermediate distributions. One annoyance with Markov chain Monte Carlo is the need to estimate autocorrelations in order to assess the accuracy of the estimates obtained. Provided the points from p n used to start the annealing runs are generated independently, there is no need to do this with annealed importance sampling. Instead, one must estimate the variance of the normalized importance weights. This may perhaps be easier, though nightmare scenarios in which drastically wrong results are obtained without there there being any indication of a problem are possible when using methods of either sort. For annealed importance sampling, this can occur when the distribution of the importance weights has a heavy upward tail that is not apparent from the data collected. Another annoyance with Markov chain Monte Carlo is the need to decide how much of a run to discard as "burn-in" - ie, as not coming from close to the equilibrium distribution. If only one, long run is simulated, the exact amount discarded as burn-in may not be crucial, but if several shorter runs are done instead, as is desirable in order to diagnose possible non-convergence, the decision may be harder. Discarding too little will lead to biased estimates; discarding too much will waste data. With annealed importance sampling, one must make an analogous decision of how much computation time to spend on the annealing runs themselves, which determine the importance weights, and how much to spend on simulating a chain that samples from p 0 starting from the final state from the annealing run (as is usually desirable, see Section 2). However, this decision affects only the variance of the estimates - the results are asymptotically correct regardless of how far the annealing process is from reaching equilibrium. Regenerative methods (Mykland, Tierney, and Yu 1995) also eliminate the problems of dealing with sequential dependence (and also replace them with possible problems due to heavy-tailed distributions). To use regenerative methods, an appropriate "splitting" scheme must be devised for the Markov chain sampler. For high-dimensional problems, this may be harder than defining an appropriate sequence of intermediate distributions for use with annealed importance sampling. As discussed in Section 4, the time required for annealed importance sampling can be expected to increase in direct proportion to the dimensionality of the problem (in addition to any increase due to the Markov chain samplers used being slower in higher dimensions). One must also consider the human and computer time required to select an appropriate sequence of intermediate distributions, along with appropriate Markov chain transitions for each. For these reasons, annealed importance sampling will probably be most useful when it allows one to find needed ratios of normalizing constants, or serves to avoid problems with isolated modes. One should note, however, that the potential for problems with multiple modes exists whenever there is no theoretical guarantee that the distribution is unimodal. Acknowledgements I thank David MacKay for helpful comments. This research was supported by the Natural Sciences and Engineering Research Council of Canada. --R "Chaining via annealing" "Simulating normalizing constants: From importance sampling to bridge sampling to path sampling" "Markov chain Monte Carlo maximum likelihood" "Annealing Markov chain Monte Carlo with applications to ancestral inference" "Bayesian inference in econometric models using Monte Carlo inte- gration" Markov Chain Monte Carlo in Practice "Monte Carlo sampling methods using Markov chains and their applications" "Nonequilibrium equality for free energy differences" "Equilibrium free-energy differences from nonequilibrium measure- ments: A master-equation approach" "Optimization by simulated annealing" "Simulated tempering: A new Monte Carlo scheme" "Sequential importance sampling for nonparametric Bayes models: The next generation" "Equation of state calculations by fast computing machines" "Regeneration in Markov Chain Samplers" "Sampling from multimodal distributions using tempered transi- tions" Bayesian Learning for Neural Networks Stochastic Simulation "Nonphysical sampling distributions in Monte Carlo free-energy estimation: Umbrella sampling" --TR --CTR Jonathan Deutscher , Ian Reid, Articulated Body Motion Capture by Stochastic Search, International Journal of Computer Vision, v.61 n.2, p.185-205, February 2005 Malte Kuss , Carl Edward Rasmussen, Assessing Approximate Inference for Binary Gaussian Process Classification, The Journal of Machine Learning Research, 6, p.1679-1704, 12/1/2005 J. Sullivan , A. Blake , M. Isard , J. MacCormick, Bayesian Object Localisation in Images, International Journal of Computer Vision, v.44 n.2, p.111-135, September 2001 Jrgen Gall , Jrgen Potthoff , Christoph Schnrr , Bodo Rosenhahn , Hans-Peter Seidel, Interacting and Annealing Particle Filters: Mathematics and a Recipe for Applications, Journal of Mathematical Imaging and Vision, v.28 n.1, p.1-18, May 2007 Cristian Sminchisescu , Bill Triggs, Building Roadmaps of Minima and Transitions in Visual Models, International Journal of Computer Vision, v.61 n.1, p.81-101, January 2005 Tapani Raiko , Harri Valpola , Markus Harva , Juha Karhunen, Building Blocks for Variational Bayesian Learning of Latent Variable Models, The Journal of Machine Learning Research, 8, p.155-201, 5/1/2007 Ajay Jasra , David A. Stephens , Christopher C. Holmes, On population-based simulation for static inference, Statistics and Computing, v.17 n.3, p.263-279, September 2007 David A. Forsyth , Okan Arikan , Leslie Ikemoto , James O'Brien , Deva Ramanan, Computational studies of human motion: part 1, tracking and motion synthesis, Foundations and Trends in Computer Graphics and Vision, v.1 n.2, p.77-254, July 2006
tempered transitions;sequential importance sampling;estimation of normalizing constants;free energy computation
599407
Stable local computation with conditional Gaussian distributions.
This article describes a propagation scheme for Bayesian networks with conditional Gaussian distributions that does not have the numerical weaknesses of the scheme derived in Lauritzen (Journal of the American Statistical Association 87: 10981108, 1992).The propagation architecture is that of Lauritzen and Spiegelhalter (Journal of the Royal Statistical Society, Series B 50: 157 224, 1988).In addition to the means and variances provided by the previous algorithm, the new propagation scheme yields full local marginal distributions. The new scheme also handles linear deterministic relationships between continuous variables in the network specification.The computations involved in the new propagation scheme are simpler than those in the previous scheme and the method has been implemented in the most recent version of the HUGIN software.
Introduction Bayesian networks have developed into an important tool for building systems for decision support in environments characterized by uncertainty (Pearl 1988; Jensen 1996; Cowell et al. 1999). The exact computational algorithms that are most developed are concerned with networks involving discrete variables only. This is Research Report R-99-2014, Department of Mathematical Sciences, Aalborg University. Lauritzen (1992) developed a computational scheme for exact local computation of means and variances in networks with conditional Gaussian dis- tributions. Unfortunately the scheme turned out to have fatal numerical difficulties, basically due to a computationally unstable transformation between two different representations of these distributions. The motivation for the present work is to remedy this numerical insta- bility. The fundamental idea behind the developments below is at all times to keep the interesting quantities represented in units that have a direct meaning such as probabilities, means, regression coefficients, and variances. These must necessarily be of a reasonable order of magnitude. The computational scheme to be developed is rather remote from the computational architecture used to deal with the discrete variables in the HUGIN software and similar schemes as represented, for example, in abstract form in Shenoy and Shafer (1990) and Lauritzen and Jensen (1997). The difference is partly related to the fundamental operations of combination and marginalization being only partially defined, but also the handling of evidence is quite different. The scheme is closest to the original scheme developed in Lauritzen and Spiegelhalter (1988), but abstract considerations such as those in Shafer (1991) seem necessary to embed the scheme in a unifying framework. Additional benefits of the present scheme includes that deterministic linear relationships between the continuous variables can be represented without difficulty, and we show how to calculate full local marginals of continuous variables without much computational effort. Both of these represent major improvements over the original scheme of Lauritzen (1992). distributions and regressions The Bayesian networks to be considered have distributions that are conditionally Gaussian, a family of distributions introduced by Lauritzen and Wermuth (1984, 1989). We shall briefly review some standard notation but otherwise refer the reader to Lauritzen (1996) for further details. The set of variables V is partitioned as into variables of discrete (\Delta) and continuous (\Gamma) type and the joint distribution of the continuous variables given the discrete is assumed to be multivariate Gaussian, i.e. where Y denotes the continuous variables, I the discrete, j\Gammaj denotes the cardinality of \Gamma, and \Sigma(i) is positive semidefinite. We then say that I [ Y follows a CG distribution. The symbol N j\Gammaj (; \Sigma) denotes the multivariate Gaussian distribution with mean and covariance matrix \Sigma. In the case where \Sigma is positive definite, this distribution has density (2) j\Gammaj det \Sigma exp If \Sigma is singular, the multivariate Gaussian distribution has no density but is implicitly determined through the property that for any vector v, the linear combination v ? Y has a univariate Gaussian distribution: is to be interpreted as the distribution degenerate at . See for example Rao (1973), Chapter 8, for a description of the Gaussian distribution at this level of generality. Note: there is a slight difference between the terminology used here and in Lauritzen (1996) in that we allow p(i) to be equal to 0 for some entries i. We also avoid using the so-called canonical characteristics of the CG distribution as the numerical instability of the scheme in Lauritzen (1992) is associated with switching between these and the moment characteristics As an additional benefit, we can then allow singular covariance matrices \Sigma. Occasionally it is of interest to describe how a CG distribution depends on additional variables. If the dependence on a set of discrete variables j and a vector of continuous variables z is determined as we refer to this dependence as a (simple) CG regression. Note that neither the covariance matrix nor the discrete part depends on the continuous variables z and the conditional expectation of the continuous variables depends linearly on the continuous variables for fixed values of the discrete variables (i; j). In a general CG regression, p is also permitted to depend on z in a specific way (Lauritzen 1996), but this is not relevant here. 3 Mixed Bayesian networks We consider probabilistic networks over a directed acyclic graph (DAG), known as Bayesian networks (Pearl 1986). A mixed Bayesian network with conditional Gaussian distributions is specified over a set of nodes or variables discrete and continuous variables as above. The DAG associated with the network must satisfy the restriction that discrete nodes have no continuous parents. The conditional distributions of discrete variables given their (discrete) parent variables are specified as usual, whereas the conditional distribution of continuous variables are given by CG regressions Note that as Y is one-dimensional, fl(i) is just a nonnegative real number. If distribution specifies a linear and deterministic dependence of Y on Z. The assumptions above imply that the joint distribution of all variables in the Bayesian network is a CG distribution. The computational task to be addressed is that of computing the joint distribution of interesting subsets of these variables - in particular of a single variable - possibly given specific evidence, i.e. given known values of arbitrary subsets of other variables in the network. This distribution will in general be a mixture of conditional Gaussian distributions. The propagation scheme to be described involves the usual steps: Construction of a junction tree with strong root, initialization of the junction tree, incorporation of evidence, and local computation of marginals to cliques. 4 Potentials and their operations 4.1 CG potentials The basic computational object is that of a CG potential. A CG potential is represented as a partitioning of the continuous variables in the domain D of OE into head and tail : H [T . We denote the variables in the head by Y and those in the tail by Z and assume these to be r and s-dimensional. An arbitrary configuration of the discrete variables in the domain is denoted by i. Thus, every potential has a domain with discrete nodes, head nodes and tail nodes, some of which could be absent. In the expression above is a table of nonnegative numbers, i.e. a 'usual' potential as in the discrete case; is a table of r \Theta 1 vectors; fB(i)g is a table of r \Theta s matrices; is a table of r \Theta r positive semidefinite symmetric matrices. The potential represented by [p; A; B; C](H specifies the CG regression The abstract notion of potentials with head and tail is due to Shafer (1991). In many ways it would be more natural also to partition the discrete variables into head and tail variables, then reflecting that the potentials always represent a conditional distribution of head variables given their tail. But as the partitioning of discrete variables is not exploited in our propagation scheme, we have chosen not to do so. A propagation scheme of the type (Madsen and Jensen 1998) could exploit such a partitioning. The initial conditional distribution for a continuous variable v with parent nodes pa(v) in a mixed Bayesian network corresponds to the CG potential of the domain equal to pa(v) " \Delta. Similarly, the specification of the conditional distribution of a discrete variable given its parents corresponds to the CG potential [p; \Gamma; \Gamma; \Gamma](\Gamma j \Gamma), where p is determined by the conditional probability tables. The discrete part of the domain is equal to the family hyphens indicate that the corresponding parts of the potential are void. 4.2 Extension and reduction A CG potential can be extended by adding discrete variables to its domain or continuous variables to its tail. When adding discrete variables to its domain, the parts of OE are extended as p (i; adding continuous variables to its tail, the B matrices are extended by adding zero columns for each of the new tail variables: Similarly, if B has columns that are identically zero for all values of i, the corresponding variables can be removed from the tail of the potential, and we say that the tail is reduced. If no columns of B are identically zero, the tail of the potential is said to be minimal. 4.3 Marginals As in the propagation scheme of Lauritzen (1992), marginals of a CG potential are only defined under certain conditions and when marginals over groups of discrete and continuous variables are calculated, the marginals over continuous variables are calculated first. Marginals over continuous variables can only be calculated over head variables. If [p; A; B; C](H corresponding to a partitioning of the head variables as marginal of OE to D We say that these marginals are strong as they correspond to calculating ordinary marginals of the relevant conditional Gaussian distributions. When all head variables have been removed by marginalization, the tail can be reduced to become empty so that a discrete potential emerges. This leads indirectly to marginalization of tail variables. Marginals over discrete variables are defined only when the tail of the potential is empty, i.e. when there are no continuous conditioning variables and therefore no B matrix. Then the marginal of the CG potential \Gamma) with discrete domain partitioned as U [ W over W is where ~ ~ ~ ae oe This marginalization is said to be weak when it does not correspond to calculating the full marginal distribution. In general the full marginal distribution will be a discrete mixture of CG distributions, and the distribution represented by the weakly marginalized potential will be the CG distribution closest in Kullback-Leibler distance to the true marginal, see Lauritzen (1996), Lemma 6.4. 4.4 Direct combination The combination operation for CG potentials will not be defined for an arbitrary pair of potentials and as such the scheme is quite different from most other propagation schemes. The direct combination of two CG potentials and defined only if the head of / is disjoint from the domain of OE, i.e. satisfies that Here we always assume that the potentials have first been reduced so that the tails are minimal. If (1) is fulfilled for the reduced potentials, these are subsequently extended such that the extensions have This is done by extending Next, let corresponding to (H We then define the direct combination as the (apparently non-commutative) product where and This combination operation corresponds to ordinary composition of conditional distributions. Note that if both of OE \Omega / and / \Omega OE exist, they are equal. The direct combination also satisfies \Omega /) \Omega (/ \Omega in the sense that if the combinations on one side are well defined, so are those on the other side and the resulting potentials are the same. Shafer (1991) has called this type of algebraic structure a partial commutative semigroup. The notation above reflects that the operation of direct combination in some sense is similar to that of forming disjoint union of sets. Unfortunately, direct combination of CG potentials is not sufficient for our propagation scheme to work for an arbitrary mixed Bayesian network. But before we can define a more general combination, we need to introduce the notion of complement. 4.5 Complements If the head of a CG potential partitioned as and [p ; A is the strong marginal of OE, then we define its complement OE jH1[T as the CG potential [q; E; F; G](H Here denotes an arbitrary generalized inverse of the matrix M (Penrose 1955), i.e. an arbitrary matrix M \Gamma satisfying see also Rao (1973), pp. 24-27, and Rao and Mitra (1971). Then which is easily checked by using the formulae for combination together with (2) and the fact that for any generalized inverse 11 of C 11 it also holds that see e.g. Rao (1973), formula (8a.2.12). Note that in the above expressions we either have p ;. The decomposition of a potential into its strong marginal and its complement corresponds exactly to the decomposition of a probability distribution into its marginal and conditional. 4.6 Recursive combination We next define a more general combination of CG potentials. This is required for the initialization process described in the section below. Consider again two potentials with minimal tails. If H the combination will remain undefined. If the heads of the potentials are disjoint, we let \Omega / or \Omega OE if at least one of the right-hand-side expressions are defined. As we have OE \Omega OE if both are defined, there is no ambiguity in this definition. If neither of the direct combinations are defined, we must have that Let D If both of these are empty, the combination will not be defined. Else we decompose one of the factors, say OE (assuming D 12 6= ;), as \Omega OE 00 and attempt to combine OE and / as This equation is to be understood recursively in the sense that the procedure described is to be repeated for the product OE 0\Omega /, whereas the direct combination in the expression is well defined by construction. The recursion terminates unsuccessfully if two potentials with minimal tails satisfy (3) and also Then the combination of OE and / remains undefined. Initialization Setting up the computational structure involves several steps: forming a strong junction tree with strong root, assigning potentials to cliques, transforming these to potentials of a specific form by sending messages first towards the root, then away from the root. A junction tree with strong root is constructed in the usual way, see for example Cowell et al. (1999), Chapter 7. Thus, we assume to begin our computational scheme at the point where we have specified a mixed Bayesian network and an associated junction tree with cliques C and a root such that for all neighbouring cliques C and D with C closer to the root than D, we have that i.e. if the 'residual' D n C contains a discrete variable, then the separator S consists of discrete variables only. Also, it holds for all variables v that fa(v) is contained in some clique of the junction tree. 5.1 Assignment of potentials to cliques Every CG potential corresponding to a specification of the conditional distribution of a node given its parents is assigned to an arbitrary clique of the junction tree that contains its family. The potentials assigned to a given clique are subsequently combined in some order. This can always be done using direct combination as the DAG is acyclic and each continuous node is head of exactly one potential. 5.2 Collecting messages at the root The next step in the initialization process involves sending messages from the leaves of the junction tree towards the root in a way similar to the process known as CollectEvidence in the standard HUGIN architecture (Jensen et al. 1990), although the messages sent are slightly different. Thus, a clique is allowed to send a message if it is a leaf of the junction tree, or if it has received messages from all of its neighbours further away from the root. The process stops when the root has received messages from all of its neighbours. We use the term Collect for this operation. When a Collect-message is sent from a clique C to its neighbour D towards the root with separator D, the potentials OE C on C and OE D on D are modified to become OE C and OE OE D\Omega OE #S i.e. OE C is the complement of OE C after marginalization to the separator and OE D is obtained by combining the original potential with the marginal of OE C . It remains to be argued that the combination in (6) is indeed well defined. To see this we first realize that the heads of any two potentials to be combined must necessarily be disjoint as a variable occurs only once as head. Further, for any of the potentials involved in (6), it holds that tail variables have no parents in the DAG induced by the conditional specifications that have been combined and possibly marginalized to form the potential. Thus, if the potential is reduced to have minimal tail, there must be a directed path from every variable present in the tail of the potential to some variable in the head of the potential. Because then it holds for any tail variable u that it is not conditionally independent of the head given the remaining tail variables. Thus there must be a trail which d-connects u to some variable in the head. As tail variables have no parents, this trail must initially be directed away from u and leave the tail immediately. As only tail variables are in the conditioning set, there can be no head-to-head nodes on this active trail, which then must form a directed path from u to the head. Assume that (4) is satisfied and H 1 and H 2 are both nonempty. This implies . From this we deduce that there must be a directed path from every variable u (implying and from v there must be a directed path to some variable w . Thus, from every u there is a directed path to some nonempty and finite, this would contradict the acyclicity of the DAG. To illustrate that recursive combination is necessary for the initialization process, we consider two simple examples. Example 1 Consider the DAG in Figure 1. When potentials are assigned to cliques, the nodes c and e must be assigned to fb; c; eg and the remaining nodes to fa; b; c; dg. Combining the potentials in the two cliques leads to potentials with head and tail (fc; eg j fbg) in fb; c; eg and (fb; dg j fcg) in fa; b; c; dg. When the first of these is marginalized to the separator fb; cg, the result has head and tail (fcg j fbg), which cannot be directly combined with the potential on the root clique fa; b; c; dg. e Figure 1: A mixed Bayesian network with associated junction tree. The variable a is the only discrete variable and the strong root is fa; b; c; dg. The root clique potential is then decomposed into potentials with head and tail (fdg j fb; cg) and (fbg j fcg). But the latter can be reduced to (fbg j \Gamma) as the dependence on c is spurious. The potentials can now be combined directly. 2 In the example above, it was the potential in the receiving clique that was decomposed. And had we not combined the potentials in the receiving clique before combining with the incoming message, the combination could have been performed directly. The next example illustrates that it may be the incoming message which needs to be decomposed and there is no way to avoid computation during the decomposition. Example 2 Consider the DAG in Figure 2. When potentials are assigned to cliques, the nodes d, e and f must be assigned to fc; d; e; fg, c to fa; c; d; eg, and b to fa; b; dg. There are two choices for the node a and we choose to assign it to the clique fa; b; dg, which is also chosen as root. When Collecting towards the root, the first message is the fc; d; eg- marginal of the potential in fc; d; e; fg. This must be calculated by combining the assigned potentials to one with head and tail (fd; e; fg j fcg) and then marginalizing to (fd; eg j fcg). Again this cannot be directly combined with the potential on the neighbouring clique which has head and tail (fcg j feg). The incoming potential is then decomposed into potentials with head and tail (fdg j fc; eg) and (feg j fcg). But the latter can be reduced to (feg j \Gamma) as the dependence on c is spurious. The potentials can now be combined directly. 2 After the root has received messages from all its neighbours, the root potential contains the correct root marginal and its tail is then empty. If evidence has been incorporated, a normalization of the discrete part of the root potential may be necessary, see Section 7. e f Figure 2: A mixed Bayesian network with associated junction tree. The variable a is the only discrete variable and the strong root could be chosen to be either fa; b; dg or fa; c; d; eg. Also, the potential OE representing the joint distribution of all the variables is now equal to the combination of all the clique potentials OE C O In fact, as all marginals computed during the Collect phase have been strong, it holds for any subset C 0 ' C which contains the root R and forms a connected subtree of the junction tree that O As the complements are stored in the cliques during Collect and the separators are not playing a specific role during this process, the computation is similar to the process of forming a set chain in Lauritzen and Spiegelhalter (1988). Thus the inward computation is of the type called Lauritzen-Spiegelhalter architecture in Shafer (1996), see also Lauritzen and Jensen (1997). 5.3 Distributing messages from the root The first step in the calculation of marginals involves sending messages away from the root, similar to DistributeEvidence in the standard HUGIN architecture. The root begins by sending messages to all its neighbours, and a clique is allowed to send a message as soon as it has received one from its neighbour closer to the root. We use the term Distribute for this process which again has slightly different messages than in the standard HUGIN architecture. When a Distribute-message is sent from a clique C to its neighbour D further away from the root with separator them, C has just received a message from its neighbour towards the root. We make the inductive assumption that the separator S 0 towards the root then contains the weak clique marginal of the joint potential When sending a message, a new potential OE S is created on S as follows. First the weak clique marginal at C is calculated as That this formula is correct is seen exactly as in Lauritzen (1992). Next this potential is further marginalized to the separator The combination is well defined because after the collect operation, complements were stored in the cliques so the head of OE C is disjoint from S 0 and the (weak) marginal is well defined as the tail of OE C is contained in the head of OE S 0 implying that the combination in (9) has empty tail. After Distribute the separators all contain weak marginals to the separator nodes. Note that we have chosen not to store the weak clique marginals calculated under Distribute, but preferred to keep the original complement potentials. This is a minor variation of the Lauritzen-Spiegelhalter architecture The initialization process is now completed. The cliques of the junction tree contain complement potentials, the separators contain weak marginals of the joint potential, and this joint potential can be recovered by (7). 6 Computation of marginals When the junction tree has been initialized as described in the previous section, various types of marginals can easily be calculated. 6.1 Marginals of variables in a single clique If not stored separately, weak clique marginals can always be recalculated as in (9) when needed, and further marginalized to subsets of cliques, in particular to single nodes. Under some circumstances, these weak marginals happen to be strong and give the correct, full marginal distribution of the variables involved. This is clearly true if the desired marginal involves discrete variables only. But there are other cases of interest when this is true. As already mentioned, the root clique contains the correct full marginal distribution of its variables. Thus, for example, the true marginal of the set of continuous variables Y in the root clique can be easily calculated as a Gaussian discrete mixture with weights p(i), i.e. where the root potential is [p; A; \Gamma; Further marginalization can then easily be performed. But the same holds for a clique C that satisfies the slightly less restrictive condition that the tail of its potential is empty. For example, this is the case if the separator of the clique C towards the root contains discrete variables only. To see this we argue as follows. From (8) we have that the true marginal to the union of cliques on the path from the root to C is given by combination of the relevant potentials O where and the cliques on the path are C. The continuous variables in C are conditionally independent of the remaining discrete variables on this path, given the separator variables; as the tail of the potential on C is assumed empty, this also holds given just the discrete separator variables. Proposition 6.3 of Lauritzen (1996) then yields that the weak marginal to C is also equal to the full marginal and we can proceed as with the root clique. 6.2 Rearranging the junction tree To obtain the marginal of a set of variables that is not a subset of some clique of the junction tree or to obtain strong marginals of a group of variables or a single variable that is not in a clique having a potential with an empty tail, the junction tree must be rearranged. Fortunately there is a simple operation that can be used to achieve the necessary rearrangement which we denote by Push. It acts on a group of variables M which are contained in a clique W with neighbour U towards the root and corresponding separator . The operation Push appplied to the variables M does the 1. The potential OE W is decomposed as \Omega 2. The clique U is extended to U 3. The potentials are changed as \Omega \Omega After the Push operation the variables in M have come closer to the strong root, but the extended junction tree still represents the joint potential as after the initialization. The price that has been paid is that the clique U has increased to U . Example 3 We illustrate the Push operation using the mixed Bayesian network in Figure 2, assuming that we have chosen fa; b; dg as root. After initialization the clique fa; c; d; eg contains the potential representing the conditional distribution of variables fc; eg given fa; dg having head and tail (fc; eg j fdg). If we use Push on fcg, this potential is decomposed into its marginal with head and tail (fcg j fdg) and complement with head and tail (feg j fc; dg). The root clique is now extended with the variable c and the marginal is combined with the root potential, whereas the complement is kept in the clique fa; c; d; eg. 2 6.3 Marginals of variables in different cliques If a (weak) marginal is desired of a set of variables that is not a subset of some clique of the original junction tree, we first form the smallest connected subtree of the original junction tree that contains all the variables. Let C be the clique of the subtree that is closest to the strong root of the original junction tree. By repeated use of the Push operation we eventually achieve that the variables in question all become members of C. The desired weak marginal can then be computed directly using (9). 6.4 Strong marginals If the strong marginal of a group of variables is desired, the Push operation again yields the appropriate rearrangement of the junction tree. As in the computation of weak marginals, we first form the smallest connected subtree of the original junction tree that contains all the variables. Let C be the clique of this subtree that is closest to the strong root R of the original junction tree. Again, we use the Push operation to make the variables in question become members of C. If C, after performing the Push operations, has a potential with an empty tail, we can compute the desired strong marginal from the potential of C as in (10). Otherwise, we need to Push the variables in question closer to R until we eventually have all the variables contained in a clique having a potential with an empty tail; from the potential of this clique we can compute the desired potential as in (10). If necessary, we may need to Push the variables all the way to R. The calculation of the strong marginal for a single continuous variable is an important special case, and from the above discussion it follows that such a marginal can be calculated with limited additional effort, since no potential of the junction tree will be extended with more than a single continuous variable as part of this calculation. 7 Incorporating evidence At this point we assume that the initialization process has been completed so that the cliques of the junction tree contain complements and the separators contain weak marginals. Discrete evidence is incorporated as usual, it does not matter where, and it is not necessary to insert discrete evidence in more than one clique. To describe how to incorporate continuous evidence we first realize that every continuous node necessarily appears as head in exactly one clique, which is the clique where it appears closest to the strong root. In all other clique potentials where it appears, it must be a tail node. Also, if U and W are neighbouring cliques with U closest to the root, the continuous variables in the separator constitute a superset of the tail of the potential (complement) that is stored in W . It is most convenient to incorporate evidence about continuous nodes a single node at a time. Evidence that Y must be entered in all cliques appears. We assume that the clique where Y 2 appears as head has a potential with an empty tail. If this is not the case, we use the Push operation described above in Subsection 6.2 until we achieve this. We then proceed as follows: 1. In cliques where Y 2 is a tail node, the tail of the clique potential is decreased by Y 2 , p and C are unchanged, and B is changed by removing the column B 2 corresponding to Y 2 . A is modified to become A 2. In the clique where Y 2 is a head node we partition the head nodes as under marginalization into The potential after inserted evidence is denoted OE obtained from H by removing Y 2 . The tail T (and thus B ) is empty. We then distinguish two cases: (a) If there is a j with C 22 (j), we let for all i ae and for all i with p (i) ? 0 we let A (b) Else we let 2C22 (i) and for all i with p (i) ? 0 we let A Intuitively the operation reflects that any deterministic explanation of the evidence (with C 22 infinitely more likely than a non-deterministic one, if it is available. The calculation for case (2a) is simply based upon the fact that whereas a standard density calculation is appropriate in case (2b), where The correctness of the operation can be formally proved by a small calculation in (not so elementary) probability. For simplicity we only give this argument in the case where Y 1 is void, so that Y Let q(i j y) denote the kernel obtained by normalizing p above, but where we have let the dependence on y be explicit, i.e. We need to show that for any interval D on the real line, q satisfies the relation Z where is the marginal distribution of Y , i.e. and j denoting the normal distribution NfA(j); C(j)g, degenerate at A(j) For C 22 Z ae Thus we get Z ae P ae If C 22 (i) ? 0 we similarly get Z Z Z When a piece of continuous evidence has been inserted, the representation is still a 'complement' representation, and the insertion of the next F Figure 3: Bayesian network and strong junction tree for the waste incinerator example. The variables are W (type of waste), F (filter state), B (burn- ing regimen), M i (metals in waste), E (filter efficiency), C (CO 2 emission), D (emission of dust), M o (emission of metals), and L (light penetrability). The variables W , F and B are discrete. piece of evidence can take place. When all evidence has been inserted, we Collect towards the root as during initialization. This collection will only involve proper computations in the discrete part of the potentials. And the normalizer at the root clique will be equal to the joint density of the evidence. Example 4 Our final example is the Waste example described in Lauritzen (1992) and Cowell et al. (1999), Section 7.7, and we refer to either of these for the details of the numerical specifications. The example is concerned with the control of the emission of heavy metals from a waste incinerator: The emission from a waste incinerator differs because of compositional differences in incoming waste. Another important factor is the waste burning regimen which can be monitored by measuring the concentration of CO 2 in the emission. The filter efficiency depends on the technical state of the electrofilter and the amount and composition of waste. The emission of heavy metals depends both on the concentration of metals in the incoming waste and the emission of dust particulates in general. The emission of dust is monitored through measuring the penetrability of light. The essence of this description is represented in the Bayesian network of Figure 3, which also shows a junction tree. The strong root can be chosen either as fB; Cg or fB; F; W;Eg. There is only one way to assign (the potentials corresponding to) the continuous variables to cliques of the junction tree: C is assigned to fB; Cg, D to fB; W;E;Dg, E to fB; F; W;Eg, L to g. So, there is exactly one potential involving continuous variables assigned to each clique, and the continuous components of these potentials become the corresponding continuous components of the clique potentials of the initialized strong junction tree. This is because the Collect operation - for this particular junction tree - does not change the continuous components of the clique potentials during the initialization process. Incorporation of evidence on C or E can be done without invoking the Push operation, since these variables appear either as head in the root or in a clique with discrete separator towards the root. Incorporating evidence on D requires D to be Pushed to fB; F; W;Eg (unless evidence on E has already been incorporated). Similarly, incorporation of evidence on L will require Pushing L to fB; F; W;Eg unless some separator along the path from fL; Dg to fB; F; W;Eg has been made empty or fully discrete by incorporation of evidence on D and/or E. Before incorporation of evidence on M i and M o the clique fW; D;M i g has a potential with head fM i g and an empty tail. Incorporating evidence on M i at this point can therefore be done without invoking the Push operation. If, on the other hand, evidence on M o (but not on D) has been incorporated, the potential on the clique fW; D;M i g will have head and tail (fM i g j fDg) and incorporating evidence on M i at this point will require Pushing M i closer to fB; F; W;Eg. Incorporation of evidence on M Pushing M o to fW; D;M i g unless evidence have been incorporated on both D and M i . Similar considerations apply to finding full mixture distributions for individual continuous variables. Figures 4 and 5 display full mixture distributions of all the continuous variables before and after incorporation of the information that the waste has been of industrial type, L has been measured to 1:1, and C to \Gamma0:9. 2 Figure 4: Screendumps from the HUGIN software displaying full marginals of all continuous variables from the waste incinerator example before any evidence has been incorporated. Figure 5: Screendumps from the HUGIN software displaying full marginals of the remaining continuous variables from the waste incinerator example after inserting the evidence that the waste has been of industrial type, L has been measured to 1:1, and C to \Gamma0:9. Acknowledgements The first author has benefited from conversations with Glenn Shafer concerning the development of an abstract theory of local computation. The research has been partly supported by the Danish Research Councils through the PIFT programme. Anders L. Madsen provided helpful comments on a draft version of this paper, and Lars M. Nielsen prepared the HUGIN screendumps shown in Figures 4 and 5. --R Probabilistic Networks and Expert Systems. An Introduction to Bayesian Networks. Bayesian updating in causal probabilistic networks by local computation. Propagation of probabilities Graphical Models. Local computation with valuations from a commutative semigroup. Local computations with probabilities on graphical structures and their application to expert systems (with discussion). Mixed interaction models. Graphical models for associations between variables Annals of Statistics Lazy propagation in junction trees. Probabilistic Reasoning in Intelligent Systems. A generalized inverse for matrices. Linear Statistical Inference and Its Applications John Wiley and Sons An axiomatic study of computation in hypertrees. Probabilistic Expert Systems. Axioms for probability and belief- function propagation The Netherlands. --TR --CTR Anders L. Madsen, An empirical evaluation of possible variations of lazy propagation, Proceedings of the 20th conference on Uncertainty in artificial intelligence, p.366-373, July 07-11, 2004, Banff, Canada Thiesson , David Maxwell Chickering , David Heckerman , Christopher Meek, ARMA time-series modeling with graphical models, Proceedings of the 20th conference on Uncertainty in artificial intelligence, p.552-560, July 07-11, 2004, Banff, Canada Robert G. Cowell, Local Propagation in Conditional Gaussian Bayesian Networks, The Journal of Machine Learning Research, 6, p.1517-1550, 12/1/2005 David Barber, Expectation Correction for Smoothed Inference in Switching Linear Dynamical Systems, The Journal of Machine Learning Research, 7, p.2515-2540, 12/1/2006 Martin Neil , Manesh Tailor , David Marquez, Inference in hybrid Bayesian networks using dynamic discretization, Statistics and Computing, v.17 n.3, p.219-233, September 2007
propagation of evidence;bayesian networks;gaussian mixtures;artificial intelligence;probabilistic expert systems;CG distributions
599421
Parameter estimation for a deformable template model.
In recent years, a number of statistical models have been proposed for the purposes of high-level image analysis tasks such as object recognition. However, in general, these models remain hard to use in practice, partly as a result of their complexity, partly through lack of software. In this paper we concentrate on a particular deformable template model which has proved potentially useful for locating and labelling cells in microscope slides Rue and Hurn (1999). This model requires the specification of a number of rather non-intuitive parameters which control the shape variability of the deformed templates. Our goal is to arrange the estimation of these parameters in such a way that the microscope user's expertise is exploited to provide the necessary training data graphically by identifying a number of cells displayed on a computer screen, but that no additional statistical input is required. In this paper we use maximum likelihood estimation incorporating the error structure in the generation of our training data.
INTRODUCTION The use of high-level models in image analysis has increased in popularity during the last few years as the problem of interpretation and understanding of images has become more important. One specific task for which such models have been proposed is object recognition, locating objects in a scene and providing estimates of their type, position and outline. The confocal microscopy image in Figure 1 is one such application, showing an optical section through cartilage growth plate in which two types of cell are present; one stage of the analysis of these data is to identify and distinguish cells on the basis of their shape and size. Manual segmentation of each cell would be a tedious and time consuming task, especially as this image forms just one of a large number of similar images, and so there is a great need for some automated procedure. A number of different approaches, both statistical and non-statistical, exist for tackling the task. In this paper we concentrate on a high-level statistical model which represents each cell by a polygon outline model embedding these deformable templates into a marked point process to handle the unknown number of objects. A point process of stochastic geometrical objects is thus constructed which is conditioned on the observed data, i.e. the data image, and simulation techniques are then used to generate samples from this posterior distribution. These samples are used to estimate quantities such as the number of objects, their type, outline and position. Although there has been much progress in understanding such models recently, they remain somewhat inaccessible in part due to the difficulty in specifying many of the parameters associated. Further work is needed before microscope users could routinely use these techniques for automatic extraction of in- formation. A significant step towards this goal would be a way of automating parameter estimation, both for the parameters describing the stochastic variations in shape for the objects and for the parameters in the data model. The aim of this paper is to provide such a solution in a way that the only interaction between the microscope user and the estimation procedures is purely graphical; the end-user supplies computer-drawn templates of the cells and the training data for parameter estimation then take the form of polygons fitted on the screen to a display of image data. The plan of the paper is as follows: In Section 2 we review the high-level deformable template model and we propose a likelihood model suitable for confocal microscopy applications. In Section 3 we briefly discuss inference from the model using reversible jump Markov chain Monte Carlo methods. We then discuss parameter estimation in Section 4, treating the image degradation parameters in a fully Bayesian way and using likelihood methods for the remaining parameters. We concentrate on deriving the maximum likelihood estimates of the deformation parameters under the assumption that the training data are recorded with measurement error due to the imperfect handtracking of individual cells. We conduct studies of this latter estimation problem in Section 5, using artificial data for which comparisons can be made with known values, and also using the cartilage data set. Adopting a Bayesian approach, we denote the scene by x and the recorded pixellated data by y, the posterior of interest being given by -(xjy) / -(yjx) -(x). Since we are concerned with the components, i.e. the cells, of the scene, x will be specified as a "high-level" variable, composed of an unknown length list of the constituent components of the scene. This approach has been pioneered by Grenander and his co-authors, and recent sources for references can be found in Grenander & Miller (1994), Jain, Zhong & Lakshmanan (1996), Baddeley & Van Lieshout (1993) and Blake & Isard (1998). 2.1 THE OBJECT PRIOR -(x) The prior model for a random configuration of cells is built around a stochastic template model for a single cell embedded in a mixture model of different cells types which is used as the mark distribution of a marked point process model. 2.1.1 THE TEMPLATE MODEL FOR A SINGLE CELL The prototypical cell is described by an n-sided template defined by a set of vectors which give the edges of the polygon (Figure 2a). For example, if one type of cell is characteristically circular, then these edges describe a polygonal approximation to a circle. The closure of the polygonal template is equivalent to the condition Described in this way, the template does not have any location information, and so we will consider its first vertex to be located at the origin, the second to be located at g 0 , the second at and so on (Figure 2b). In order to accommodate scaling and rotational effects, the template may be globally scaled by a scalar R and rotated through an angle ff (Figure 2c). To model natural shape variability occuring between cells of the same type, each edge g i is subject to a stochastic deformation which incorporates the scaling R, the rotation ff plus an additional edge-specific Gaussian deformation in length and direction (Figure 2d). This final edge-specific effect describes the change in length and direction between the undeformed g i and the new edge prior to global scaling and rotation. Writing the deformed edge as s Rff i is the representing these changes, we thus haveR sin ff cos ff s Rff Writing t (0) determines that s Rff \GammaR sin Specifying the distribution of r i and ' i to be the angular and radial components of a bivariate Gaussian with zero correlation, then conditional on fixed values of R and ff, t (0) are independent Gaussians with mean zero. Ignoring for a moment the constraint that the deformed template must be closed, i.e. suggest a first order cyclic Markov structure on the ft (0) and the ft (1) independently with each having an n-dimensional Gaussian distribution with mean 0 and circulant inverse covariance matrix incorporating the scaling where all other entries are zero. Define the length 2n vector considering only the unconstrained non-closed polygon case Imposing the closure constraint on the deformed template will destroy the simple structure of (2); we will derive the distribution under the closure constraint in Section 4.2.2. 2.1.2 THE MARKED POINT PROCESS FOR MULTIPLE OBJECTS It is possible to allow objects of different types by forming a mixture model using different basic templates with different deformation parameters, where the weights in the mixture model represent the relative frequencies of occurrence; refer to Rue & Hurn (1999) for details. This mixture distribution is then used as the mark distribution of a marked point process model to model an unknown number of objects (Baddeley & Van Lieshout, 1993). Within this framework, each object x i comprises a point which gives location (unspecified by the deformation model) and a set of marks which then specify its other attributes, in this case type and outline. The points lie in a window related to the data observation coordinates, and the marks in the space M associated with the object types and shapes. A configuration of cells is described as a finite unordered set an object process, i.e. a marked point process on \Theta M with a Poisson object process as the basic reference process. Under the Poisson process, conditional on the number of objects k, the objects are uniformly and identically distributed. The joint density of fx is defined by a density f(x; to the Poisson object process. For example, to model pairwise interactions between objects which are defined to be neighbours by some relation -, the function Y could be used; Van Lieshout (1995) discusses various interaction models. To model a situation where objects are not allowed to overlap, such as confocal microscopy where the images are optical sections, all objects are defined to be neighbours and the interaction function h(x taken to be zero if objects x i and x j overlap and one otherwise. This model is known as the hard core object process. We take the point, denoted c, to be the location of the first vertex for each object. The first mark is then a categorical variable defining the object type, and the remaining marks are the deformations t of the standard template for this type. We refer to Rue & Syversveen (1998) for more details. 2.2 A POISSON LIKELIHOOD MODEL -(yjx) FOR CONFOCAL MICROSCOPY Confocal microscopy can produce relatively high-quality sectional images for certain specimen types. The technique works by scanning the focal point of a laser through the stained specimen, the fluorescence emitted from this focal point is then recorded, and the image is built up as a grid of fluorescent dye concentration measurements. The likelihood model for the data y approximates the microscope measuring fluorescence photon counts. We begin by assuming that cells all have a typical fluorescence level -, while the background emits no fluorescence. The signal is measured on an 8 bit scale (i.e. on the integers 0 to 255) and in order to minimise clipping, the signal is operator adjusted at the experimental stage by a scale factor a and a shift b, so that the mean background value is now b, while the mean foreground value is b (and both are sufficiently far from the ends of the range of measurement). In addition, the recording process involves additive instrument white noise. We will approximate the record at pixel p by a Gaussian random variable with mean equal to the black-level b plus the expected scaled Poisson count for p, and with variance equal to the variance of the instrument noise oe 2 again plus the scaled expected Poisson count variance, where I [p2cell] is the indicator or whether the pixel is labelled as cell or background. The fy p g are assumed to be conditionally independent given the configuration x. To do inference for the high-level object model, we have to resort to Markov chain Monte Carlo techniques (refer to Gilks, Richardson & Spiegelhalter (1996) for an introduction and list of references.) The key idea is to construct a Markov chain which has the posterior as the equilibrium density, and to estimate expected values by empirical average along the trajectory of a realization of the Markov chain. This makes it possible to access both estimated expected values and their uncertainty represented by the estimated variance of the estimated marginal density. To construct this Markov chain, we need a set of basic transition rules that will take us around in the state-space, hopefully moving efficiently around and thereby creating good estimates with low variance for the empirical averages. The basic transition types for our problem are as follows: ffl Change a part of the template boundary of a randomly chosen object. ffl Change the type of an object. ffl Propose the birth of a new object. ffl Propose the death of an object. The details of the MCMC algorithm for these transitions are given in Rue & Husby (1998), Rue & Syversveen (1998), where the birth and death moves rely on applications of the Green (1995) algorithm for variable dimension distributions. In practice the basic transitions listed above do not ensure sufficient mixing of the Markov chain, the main problems being transitions between the various object types and difficulties when there is uncertainty over the whether one "object" is actually two objects lying close together. Rue & Hurn (1999) approach this problem by extending the template model to allow it to have a variable number of sides, demonstrating that this allows smoother transitions between the object types, and easing the transitions which split and merge objects. The model described in the previous sections relies on the specification of the parameters controlling the marked point process prior and the degradation model. Some of these parameters, particularly those involved in the deformations, are hard to interpret in any intuitive way. In this section we propose a parameter specification approach which will hopefully allow models of this type to be more widely used in practice. The parameters of the degradation process are handled in a Bayesian way. The remaining parameters will be estimated using maximum likelihood methods. 4.1 BAYESIAN TREATMENT OF THE DEGRADATION PARAMETERS The unknown parameters of the measurement process are - the typical fluorescence level, a and b the operator controlled measurement adjustments, and oe 2 the recording noise. Since estimation of these parameters from a section of image data would be dependent on a good initial segmentation, we propose instead to treat them as hyperparameters. Our choice of prior distributions is intended mainly to impose the constraints that the variables are positive, with 255. The noise variance rather than the precision is given a - 2 (1) prior distribution since it is expected to be of the order of a few squared pixel units. The mean fluorescence is given a fairly diffuse - 2 (255) prior reflecting that it is positive variable expected to take a reasonably large value, although this will vary considerably between specimens. As the data carry considerable information regarding the parameters, it is intended that these priors will not exert much influence; refer to Hurn (1998) for more discussion in a similar setting, a The joint posterior distribution of interest is then Markov chain Monte Carlo methods are needed for the sampling which generally will be done one parameter at a time requiring the conditional posterior distributions Y Y pixels p2cell Y pixels p2cell Y 4.2 ESTIMATION OF THE PRIOR MODEL PARAMETERS It is not computationally feasible to treat the remaining parameters in a similar Bayesian manner since it would require the intractable normalising constants which depend on these parameters. The alternative we suggest is to use likelihood-based methods which work with training data generated by the microscopist tracing cell outlines on a number of slices of image data using the computer mouse. This method has two benefits, the first is that the microscopist's expertise is being used in the data collection, and the second is that there is no further user-interaction in the estimation procedure. 4.2.1 THE MARKED POINT PROCESS PARAMETERS p i AND fl The use of a hard-core interaction model for the marked point process means that the normalising constant will be too complex for maximum likelihood estimation. However, previous experience in object recognition problems suggests that the results are not particularly sensitive to the specification of these parameters. We propose to use the naive estimators, that is the observed proportions of the different cell types in the training data for the fp i g, and the observed frequency per unit area for fl. These estimators will be least accurate in situations where there is significant packing observed in the training data. If this is the case, then an alternative is to simulate from the prior model (having first estimated the deformation parameters) searching over a range of values for fp i g and fl to match the observed and the simulated frequencies; this approach could be coded in advance. We also note some recent work by Baddeley & Turner (1998) who use maximum pseudo-likelihood methods to fit various point processes, although such an approach here would be considerably more complex. 4.2.2 THE DEFORMATION PARAMETERS fi AND ffi AND TRACKING ERRORS We derive the likelihood function for fi and ffi using data which are a number of polygons the vertices of which are observed with error. Although the inclusion of the observation error complicates this derivation, it is a realistic assumption given the intended manner of collecting training data. We begin by transforming from the deformation model for the polygon edges to the model for the corresponding vertex locations. Recall that the first vertex defines the location of the entire polygon; if the first vertex is at location then the second vertex v 1 is located at s Rff Note that there are vertices in the non-closed polygon. Considering the x and y components separately, the vertices can be x y \Gammag xg y \Gammag x \Gammag xg y \Gammag x \Gammag x t (1)t (1)t (1) where I is the 2n \Theta 2 matrix whose first column consists of n 1's followed by n 0's, and whose second column is n 0's followed by n 1's, and v Rff is the vector of vertex x and y positions of the undeformed template with first vertex at zero rotated through ff and scaled by R. We will write (3) in the form We assume that we record the n vertices of the closed polygon with error ~ and we further assume that these errors are normally distributed with Since the true location of the polygon is unobservable, we begin by finding the unconstrained distribution of v given R; ff; \Phi; ffl 0 and the observable ~ which by (3) and (4) is the distribution of Denoting the marginal variance of (ffl x 22 , the unconstrained distribution is To find the distribution of (v for an arbitrary v , we reorder the components of v from x then y components to the vertex pairs, rewriting (5) as ~ where the partitioning of the mean and variance correspond to partitioning into the sets (v and v n . Note that E(v n j(R; ff; \Phi; ~ by closure of the undeformed template v Rff . Denote the partitioned inverse of the variance matrix We will also rearrange the ordering of the fffl i g so that By manipulation of the conditional density -(v show in the Appendix that The particular v in which we are interested is v 0 , i.e. ~ which case To find the distribution of the vertices under the closure constraint, we use the known marginal distribution together with (8), integrating out ffl 0 to show in the Appendix that I \Phi 22 I T is the first 2n \Gamma 2 components of the reordered I~ I is the of the reordered I . The distribution of (~ under the same conditioning uses (4). Since (ffl may not be independent of ffl 0 , the resulting distribution is I \Phi 22 I I \Phi T I The distribution of ~ v 0 arises as the convolution of the distribution of v 0 with the distribution of ffl 0 . Assuming that v 0 is uniformly distributed in the observation window, and that the variance of ffl 0 is small in comparison to the window size, ~ v 0 is taken to be also uniformly distributed in the window. Finally, under an assumption of independence of the polygon shapes, the likelihood for m cells will be the product of the individual likelihoods. Finally, since in many applications it will not be reasonable to assume that the scale and rotation of each cell is known, the model allows each cell i to have an associated scaling R i and rotation ff i . We will concentrate on the case where there is a common unknown R for all cells (as would be used in an example where size was a distinguishing characteristic in cell recognition). Treating scale and rotation as additional nuisance parameters adds parameters R; ff , to the optimisation in order to obtain the maximum-likelihood estimates. However in the Appendix, we show that the rotation optimisation may be done exactly for any set of fi; ffi; R; \Phi, thus reducing the computational burden. 5 EXAMPLES OF THE ESTIMATION OF THE DEFORMATION PARAMETERS 5.1 AN ARTIFICIAL EXAMPLE We begin with an artificial example to demonstrate the properties of the estimation procedure since it allows us to consider the effect of various model misspecifications. The basic template for our experiments is an eight-sided regular approximation to a circle of radius 1, and the deformation model takes the parameters it is analytically intractable to find the maximum likelihood estimates of fi and ffi, Matlab (The MathWorks Inc, 1994) has been used for the numerical optimisation; it can also be used for direct entry of vertex locations using the mouse. 5.1.1 THE EFFECT OF MODEL MISSPECIFICATION In order to assess the importance of deriving the maximum likelihood estimates under the assumption of measurement error in recording the vertices, simulated realisations from the deformed template model have been generated using independent measurement errors with variance OE 2, and estimates of fi and ffi have then been found from these data when misspecifying that OE 2 Table 6 shows the mean and median estimates resulting from 250 repetitions of this procedure to assess the variability of the estimates. Not surprisingly, as the true variance increases, the estimates become severely biased; fi and - ffi both decrease since the observed shapes demonstrate greater variability and less smoothness than expected. Similarly, it is possible to fit a model with measurement error but for which the scale R and rotation ff are assumed known but are incorrectly specified. The effect here is that the observed polygons do have the expected shapes but that in the attempt to fit the incorrectly specified template, OE 2 1 is overestimated, while the balance of - fi to - is perturbed to the point of degeneracy latter effect is due to the extremely high correlations required between deformations which are needed in order to mimic a rotation or a rescale. 5.1.2 ESTIMATION UNDER DIFFERENT ERROR MODELS Having seen the importance of including measurement error in the modelling, we now investigate different possible models for the tracking errors. It seems unlikely that the errors will in practise be independent and so we consider the following three structures: Independent errors, First-order Markov structure for the variance, where \Phi 1 has a circulant structure with OE 1 down the diagonal, and OE 2 on the second diagonal MODEL 3 First-order Markov structure for the inverse variance, \Phi where \Phi 1 is although note that OE 1 and OE 2 have different interpretations under model 2 and 3. Our training data are a set of m simulated cell outlines, where m takes the values 25, 50 or 100. In the simplest noise model, we have also found estimates when the scale and rotation are taken to be unknown (the nuisance parameter R takes the value 1). Table 2 summarises the results of the numerical experiments, while Figure 3 shows the pairwise scatterplots of the four estimated parameters for the case under the independent noise model 1 with unknown scale and rotation. Both mean and median estimates have been quoted in all cases to highlight the skewed nature of the sampling distribu- tions, a feature which can also be seen in Figure 3 (marginalising by eye). Figure 3 also demonstrates the high correlation structure within the estimates, particularly between fi and ffi and between the deformation parameters and the observation error variance. Such relationships might be explained by noting that in the unconstrained model whose inverse variance is given by (1) the variance of any particular given the remaining t (0) components is 1=fi while the correlation of two consecutive t (0) given the remaining components is \Gammaffi=fi. The near non-identifiability due to the partitioning of the variability of the observed vertex locations into that due to the deformations and that due to the observational error is one of the reasons why this estimation problem is particularly difficult. 5.2 ESTIMATION FOR IMAGING Figure 4 shows the two template types together with 100 cell outlines traced by one of the authors from a series of images of cell cartilage. For display purposes, the outlines have been relocated on a regular grid, the scalings and rotations have not been altered. Using these training data, the proposed estimation technique has been applied assuming unknown scale R and rotation and a common measurement error for both template types. The same three measurement noise models have been considered. Table 3 gives the resulting parameter estimates together with the quantity \Gamma2\Theta the natural logarithm of the likelihood at those parameter estimates; this quantity will be used for determining which of the three models is most appropriate using the Akaike Information Criterion. Using this criterion, noise model 3 is chosen. Figure 5 shows some simulations from this fitted model; the top row shows 50 realisation from each of the two deformed template models, the bottom row shows the same realisations convolved with realisations from the fitted noise model. Note that the rotations here have been set to the value zero for displaying these outlines, which consequently appear less ordered than those in Figure 4 as a result of the natural structure of the cartilage. 6 DISCUSSION User-friendly techniques for parameter estimation in deformable template models are an important issue if such models are to find more wide-spread acceptance in applied work. Recent work by Kent, Dryden & Anderson (1998) has also considered the question of estimators for deformation parameters, although valid only for circular objects observed without measurement error. We have demonstrated that it is possible to treat all the parameters necessary for a Bayesian object recognition approach in either a fully Bayesian way or requiring only graphical intervention by the microscope user. We hope that approaches such as these will facilitate further work in the area of statistical image analysis in collaboration with the end-users of such techniques. --R Practical maximum pseudolikelihood for spatial point patterns Stochastic geometry models in high-level vision Active Contours Markov Chain Monte Carlo in Practice Reversible jump MCMC computation and Bayesian model determination Hands: a Pattern Theoretic Study of Biological Shapes Representations of knowledge in complex systems (with discus- sion) Confocal fluorescence microscopy of leaf cells: An application of Bayesian image anal- ysis Object matching using deformable templates Using circulant symmetry to model featureless objects Bayesian object identification of partly destroyed objects using deformable templates Bayesian object recognition with Baddeley's delta loss Markov point processes and their applications in high-level imaging (with discussion) --TR
object recognition;Markov chain Monte Carlo;bayesian image analysis;deformable templates;parameter estimation;confocal microscopy
599447
Choice of wavelet smoothness, primary resolution and threshold in wavelet shrinkage.
This article introduces a fast cross-validation algorithm that performs wavelet shrinkage on data sets of arbitrary size and irregular design and also simultaneously selects good values of the primary resolution and number of vanishing moments.We demonstrate the utility of our method by suggesting alternative estimates of the conditional mean of the well-known Ethanol data set. Our alternative estimates outperform the Kovac-Silverman method with a global variance estimate by 25% because of the careful selection of number of vanishing moments and primary resolution. Our alternative estimates are simpler than, and competitive with, results based on the Kovac-Silverman algorithm equipped with a local variance estimate.We include a detailed simulation study that illustrates how our cross-validation method successfully picks good values of the primary resolution and number of vanishing moments for unknown functions based on Walsh functions (to test the response to changing primary resolution) and piecewise polynomials with zero or one derivative (to test the response to function smoothness).
Introduction Wavelet shrinkage is a technique for estimating curves in the presence of noise which is appealing because it is nearly minimax for a wide range of functions, computationally practical and spatially adaptive (see the seminal work of Donoho et al. (1995)). This paper assumes a familiarity with wavelets and wavelet shrinkage up to the level of Nason and Department of Mathematics, University of Bristol, University Walk, BRISTOL, BS8 1TW, UK Silverman (1994). We also rely heavily on developments in Kovac and Silverman (2000). For a recent survey of research in the area see Vidakovic (1999) or Abramovich, Bailey and Sapatinas (2000). Most early wavelet shrinkage techniques relied on Mallat's (1989) pyramid algorithm for computing the discrete wavelet transform (DWT) which in its standard form requires data to be equally spaced and contain 2 J values. For this limited data situation wavelet shrinkage works by taking the DWT, then thresholding or shrinking the coefficients, and then taking the inverse transformation. A great deal of research effort has been expended on methods to choose the threshold value of wavelet shrinkage, again see Vidakovic (1999) for an excellent overview. However, the threshold, albeit important, is but one parameter involved in wavelet shrinkage. For successful shrinkage the following criteria need also to be chosen well: the primary resolution Thresholding of coefficients is applied to coefficients whose resolution level is equal to or finer than the primary resolution. The primary resolution parameter is similar to the usual bandwidth parameter in linear smoothing methods. For wavelet shrinkage choice of the primary resolution was first investigated by Hall and Patil (1995). Hall and Nason (1997) suggest that actually choosing the primary resolution on a continuous scale may be advantageous. However, even if the primary resolution is to be chosen on a discrete scale, as in standard wavelet shrinkage, it is critical to use good values (just as the bandwidth is critical in linear smoothing). the analysing wavelet. Very little detailed attention has been paid to the problem of which wavelet should be used in wavelet shrinkage. The Daubechies' (1988) series of compactly supported wavelets provide a family of mother wavelets of varying smooth- ness, V , where V is the number of vanishing moments and V 2 C V (R) where 0:2 and C (R) is the space of times continuously differentiable functions on R. We only consider the Daubechies' extremal phase wavelets in this article ranging from the discontinuous Haar wavelet to the smooth denote the quadrature mirror filter associated with Daubechies' extremal phase wavelet of order V and N hV be the length of this filter. The type of wavelet transform is also important. For example, the translation-invariant transform of Coifman and Donoho (1995) often gives better results than using the DWT. how the threshold is applied Early work described in Donoho et al. (1995) considered two methods for applying the threshold to wavelet coefficients, the "keep-or-kill" hard thresholding (similar to model selection) and "shrink-or-kill" soft threshold- ing. Other techniques have been suggested such as the firm thresholding of Gao and Bruce (1997) and more recently Bayesian wavelet shrinkage which also has a thresholding interpretation, see Chipman et al. (1997) or Abramovich et al. (1998). This article proposes a fast-update cross-validation method which aims to find good combinations of the threshold, number of vanishing moments (wavelet smoothness), V , and primary resolution parameters. Often there is no unique "optimal" combination as the parameters interact and sometimes quite different combinations give similar results. The cross-validation method described below could be extended to incorporate different choices of threshold application and type of wavelet transform but it is not clear that such choices could be implemented in a fast-update algorithm. Cross-validation for threshold selection in wavelet shrinkage was proposed, especially for functions sparsely represented by wavelets, by Nason (1996). Generalized cross-validation for wavelet shrinkage was proposed by Jansen, Malfait and Vial (1997) and other cross-validation techniques were proposed by Wang (1996) and Weyrich and Warhola (1998) but of course cross-validation as a general technique has been around for a very long time; see Stone (1974) for further details. Recently, papers such as Hall and Turlach (1997), Sardy et al. (1999) and Kovac and Silverman (2000) have adapted the wavelet shrinkage methodology to data sets with arbitrary size and irregular design. See also Antoniadis, Gr-egoire and Vial (1997) and Antoniadis and Pham (1998) for work on fast linear wavelet methods for random designs. We should also mention that recent algorithms based on the lifting transform show great promise for curve and surface estimation for irregular data (see for example, Daubechies et al. (1999) for an excellent review). Our cross-validatory method is a development of Kovac and Silverman (2000) and as such works with data sets of irregular design and arbitrary size but ours additionally gives useful information on which wavelet and primary resolution to use as well as choosing the threshold value. 1.1 Wavelet shrinkage and the Kovac-Silverman algorithm First we establish some notation and describe the data model specified by Kovac and Silverman (2000). We suppose that f(x) for x 2 (0; 1) is the function that we wish to estimate and that we observe n data points g(x i ) according to the model i=0 is i.i.d. noise with mean zero and variance 2 and fx i=0 are not necessarily equally spaced. Kovac and Silverman (2000) propose choosing a new equally spaced grid t on (0; 1) where and interpolate the observed data onto the new grid. They propose choosing t such that ng. Throughout their article they linearly interpolate the original data to new values, y k , on the grid by (2) where although they admit that higher order interpolants or other reweighting schemes might also be of some use. Writing the original and interpolated data as vectors the linear transform described by (2) can be written in matrix form by where the interpolation matrix R depends on t and x. Each row of R always contains either one or two non-zero entries which always sum to one. Interpolation to a grid is a useful technique but certainly not new see, for example, Jones and Lotwick (1983) or Silverman (1986). Kovac and Silverman (2000) then apply wavelet shrinkage to the interpolated data, y, which first involves taking the DWT by is the N N orthogonal matrix associated with Daubechies' extremal phase wavelet with V vanishing moments (in practice Mallat's fast algorithm is used but the matrix multiplication representation is mathematically convenient). Given model (1) above and in particular the i.i.d. assumption on the noise the covariance of the interpolated data is given by Kovac and Silverman (2000) exploit the fact that for the linear interpolation scheme described above Y is actually a band matrix. After applying the DWT to y Kovac and Silverman (2000) show that the variances of the individual wavelet coefficients can be computed exactly, up to knowledge of 2 which has to be estimated from the data, using a fast algorithm of computational order O(b2 J ) where Y is the bandwidth of the matrix Y . A useful consequence of Kovac and Silverman's work is that the variance of all the wavelet coefficients can be computed with no more effort than computing the wavelet coefficients themselves, which is O(N hV 2 J ) and also fast. Vannucci and Corradi (2000) also present a fast algorithm to compute the variance-covariance matrix of the wavelet coefficients and link it to the two-dimensional DWT. Kovac and Silverman (2000) show how knowledge of the wavelet coefficient variances permits extension of the universal and SURE thresholds of Donoho and Johnstone (1994; 1995) to their interpolated data situation. We are also interested in choosing the threshold, but by cross-validation, and also simultaneously selecting good values for the number of vanishing moments, V , and primary resolution, p. The next section shows that it is possible to apply full leave-one-out cross-validation to the Kovac-Silverman set-up and still retain a fast algorithm. cross-validation Cross-validation is a well-established technique for assessing model prediction error and, in our situation, selecting good choices of the threshold, number of vanishing moments, and primary resolution. In the following sections we describe how to obtain a leave-one- out estimate of the prediction error. That is, our wavelet shrinkage estimator, ^ f t;V;p (x) with threshold t, number of vanishing moments, V , and primary resolution p aims to minimize the mean integrated squared error (MISE) Z 1n dx: With the methodology below we could easily choose another form of loss function. In par- ticular, with wavelet shrinkage, we might be interested in doing better near known discontinuities or inhomogeneities for example. However, using MISE for now, we can estimate M by t;V;p is an estimate of f constructed from all the data except the ith point. To find good values of (t; V; p) we M . However, we do not believe that the first minimizer we come across is in any sense "optimal". Unlike, say, the cross-validation score developed in Nason (1996) the score ^ M has multiple minima and as many as possible should be investigated further. The next few sections describe the construction and efficient computation of the leave-one-out predictor ^ using all the original data points apart from The key to the efficiency is that removing the ith original data point only changes grid points and thus only wavelet coefficients local to x i . 2.1 Leave-one-out and interpolation Removing the ith original data point only has a very local effect on the interpolated data points because with linear interpolation only those grid points that lie in an interval with the ith point as one of the end points are affected. For these points the interpolated point t k is either to the left or the right of x i . If removed (or removed) then new grid points to the left of x 1 are updated to take the value g 1 (or those to the right of xn 2 take the value g n 2 ). Assume that x i 1 t k x i . We can compute the value of the updated interpolated points y k from the old ones y k by the simple formula where For each removed point, L i only has to be computed once and only local to the ith original point have to be recomputed. If N is chosen well then only a few y k need to be updated. We record the indices of those t k whose y k value has been updated and pass them onto the next stage. 2.2 Updating the wavelet transform The previous section tells which of the y changed. The Mallat algorithm is a recursive algorithm which takes the fy k g N 1 k=0 as input and computes coarser versions (called father wavelet coefficients) and detail coefficients between successive levels of coarse coefficients. For the father wavelet coefficients the formula for computing a coarser approximation to the data c j 1 from a finer approximation c j is given by The finest scale approximation of c J initializes the algorithm and then coarser ap- proximations, c J are generated using successive applications of (3). The mother wavelet coefficients, d lost when moving from a finer scale c j to a coarser scale c j 1 and are computed by a similar formula to (3) except that the smoothing filter h V is replaced by a "detail extraction" filter g V , we refer to Nason and Silverman (1994) or Vidakovic (1999) for further details. The key point for efficiency is that changing a single y k only affects those wavelet coefficients which are derived from the y k and only those coefficients local to t k will be changed. In summary, changing a y k changes very few wavelet coefficients. More specifically, if the single father wavelet coefficient c j k is changed then only the coarser father wavelet coefficients c j 1 ' where l k N hV need to be recomputed (here dxe is the smallest integer greater than or equal to x, and bxc is the largest integer less than or equal to x). Recall that the DWT is recursive starting with the fy k g N 1 as the input so formula (4) shows which coefficients need to be recomputed at a coarser resolution level and then supplies the indices of those changed recursively to the same routine for the next coarsest level. Further efficiency gains can be achieved by noting the range of the changed c j coefficients and only recomputing those coarser c j 1 that are involved. For example, if c j k has changed for k min k k max then we only need to recompute c j 1 ' for l k min N hV in other words 1(k max k min +N hV +1) coarser coefficients at resolution level j 1 need to be computed from k max k min +1 coefficients at level j. Since each coefficient computation takes O(N hV ) the recursive update of wavelet coefficients is effectively O(N hV J) and hence extremely fast (i.e. effectively O(1) with respect to N and n). Note that a similar algorithm can be developed for the DWT inversion. 2.3 Updating the wavelet coefficient variance factors Given the covariance matrix Y of y the wavelet coefficients' covariance matrix is given by W V Y W T . Removing the ith point alters the covariance matrix RR T because the N n matrix R changes to a N (n 1) matrix R. Let r k denote the kth row of R. has a non-zero entry at position ig. Then rows not in R i in both R and R will be the same except that those in R will be one entry missing where there was a zero in R. However, rows k 2 R i will be different in R and R. Therefore, the difference R R T will be zero apart from a cross-shaped region where any row or column of D i in R i can, in general, be non-zero. However, since both Y and are band matrices most of the entries in the cross-shaped region in D i , except those close to the main diagonal (less than b away from the main diagonal) will be zero. Summarizing we can compute the covariance matrix Y for the interpolated data from using where D i is almost all zero apart from some of the rows/columns near the main diagonal and in R i . To compute the wavelet coefficient variance for the new interpolated data we only need to consider W since we already know W V Y W T from the Kovac- Silverman algorithm. Computation of W V D i W T can be easily performed using the updating wavelet transform described in the previous section since multiplication by W or W T is simply an application of the DWT. Since most of the entries in rows or columns of D i are zero the updating algorithm can be executed first with a zero transform, and then with those non-zero entries in each row/column of D i . Again application of such a transform is extremely fast: O(N hV J). 2.4 Thresholding, inversion and optimisation Using the above information about which wavelet coefficients' variance change one can identify those coefficient positions where the quantity d jk =^ jk has changed (where jk are the updated variances of the wavelet coefficients, jk are the variance factors as in Kovac and Silverman (2000), ^ 2 is some estimate of 2 and ^ d jk are the up-dated empirical coefficients.) In wavelet shrinkage an estimate of is typically computed by using a robust estimator such as the median absolute deviation (MAD) of the wavelet coefficients at the finest level, divided by 0.6745. The estimate ^ can itself be updated quickly by keeping track of which coefficients in the finest resolution level change. For thresholding after point removal we only need note which jk have changed. If all of those jk that changed were previously thresholded, and if after point i removal they are subsequently all smaller in absolute size than the threshold then the estimate does not change. This means that inversion does not have to be performed and the prediction error simply taken from the non-removed point estimate. However, if any jk have changed their status since last time the estimate ^ has to be recomputed using the efficient inverse algorithm described in section 2.2. For optimisation we have found that a grid search algorithm works extremely effectively for finding minimal values of ^ M . We also have used a golden section search method but Table 1: Table showing values of ^ M (1000 to 3 s.f.) with t 3:11 fixed for various values of the primary resolution, p, and number of vanishing moments, V . Number of vanishing moments, V this tends to get stuck in one of the multiple minima. Another strategy that we adopt is to condition on the universal threshold t log N and then optimise ^ to find good values of (V; p). Then using the good values of (V; p) we optimise over the threshold t. This strategy is effective in practice because the universal threshold makes a useful starting value for the optimiser as its value is independent of (V; p). 3 Example: the ethanol data Before we describe a simulation study we present an applied example in detail. The well-studied ethanol data from Brinkman (1981) has been analysis by Cleveland et al. (1993) and Hastie (1993) but more importantly for our purposes by Kovac and Silverman (2000). The data consist of measurements from an experiment where ethanol was burned in a single cylinder engine. The concentration of the total amount of nitric oxide and nitrogen dioxide in engine exhaust, normalized by work done by the engine is related to the "equivalence ratio", a measure of the richness of the air ethanol mixture. Note that the range of the x-axis or "Equivalence ratio" variable is (0:535; 1:232) so this was linearly shifted to (0; 1). The ethanol data are plotted in the top left-hand corner of Figure 1. For the purposes of this example we fixed the threshold value t to be equal to the universal threshold value of Donoho and Johnstone (1994). The default Kovac-Silverman method chooses equally-spaced grid points to interpolate the original data. Thus the universal threshold computed was 2 log N 3:11. With this threshold fixed Table shows our computed value of ^ M for all values of the primary resolution ranging from 0 to 6 and for numbers of vanishing moments (smoothness) ranging from 1 to 10 from the Daubechies "extremal phase" series. From the table it is clear that the lowest value of M occurs for or 4 might also be of interest (one could continue to higher values of ^ Next, we conditioned on the three different pairs of (V; p) and optimized over the Equivalence Ratio Equivalence ratio Equivalence ratio Equivalence ratio Figure 1: Top left: ethanol data with NOx emission versus Equivalence ratio. Clockwise from top right: estimates ^ f t;V;p (x) for (t; V; p) equal to (3:11; 8; 2), (3:13; 10; 5) and (2:88; 2; 3). threshold value to minimize ^ M . In the cases (8; 2), (10; 5) and (2; 3) the minimizing thresholds were 3:11, 3:13 and 2:88 all of which are not actually too far from the universal threshold. The estimated curves ^ f t;V;p (x) are shown in Figure 1. The top-right plot in Figure shows our "best" estimate for the underlying curve. Kovac and Silverman (2000) use Daubechies' ``extremal phase'' wavelet with vanishing moments and a primary resolution of 3. Referring to Table 1 again one can see that in terms of minimizing M this combination is only ranked 31st out of all the combinations tried. Therefore we obtain an approximate 25% improvement on Kovac and Silverman by using our best combination. The improvement using our search method is also demonstrated by comparing the plot for our best estimate and their two best in their bottom row in Figure 1 of Kovac and Silverman (2000). Both of their plots use a combination of (5; 3) with the universal threshold. Their bottom-left uses a global estimate of variance, their bottom-right uses a local estimate of variance by noticing that the variance of the NOx variable decreases with Equivalence ratio. Their use of the more complex local variance estimate is motivated by the fact that their estimate with the global variance contains a small spike at about 0.8 (like the one in our bottom-left plot of Figure 1). However, after examining our top-right plot of Figure 1 which tracks the double bump and does not have a spike at 0.8 we claim that actually Kovac and Silverman (2000) need not go to the trouble of forming a local variance estimate but merely need change the number of vanishing moments V to 8 and their primary resolution to 2. We repeated the Kovac-Silverman (2000) analysis with the new number of vanishing moments and primary resolution and the resulting estimate is significantly better than theirs and looks more like our top-right plot in Figure 1 (note it is not exactly the same since they use soft thresholding and choose t to be exactly the universal threshold, whereas we use hard thresholding and optimize the value of t). In no way are we trying to denigrate Kovac and Silverman (2000). Indeed, this paper is based on their extremely useful methodology. However, we have used the above example to stress that choice of number of vanishing moments and primary resolution is extremely important, probably as important as choice of threshold but considerably neglected by much of the literature and available software. 4 Simulation study We performed several simulations that show that once the number of vanishing moments and primary resolution are correctly selected that our cross-validation method produces broadly similar results to GlobalSURE type thresholding (and also universal thresholding, although the goal of universal thresholding is not MISE minimisation). The GlobalSURE thresholding method was introduced by Nason (1996) and is a single threshold version of the level-dependent technique based on Stein's unbiased risk estimation for wavelet shrinkage introduced by Donoho and Johnstone (1995). However, as the ethanol example demonstrates in the previous section it is important to show that methodology can adapt to features such as the smoothness of the underlying function or the scale of the features (which require particular choices of numbers of vanishing moments or primary resolution). The first simulation ("adapting to primary scale") concentrates on choice of primary resolution, the next three simulations ("adapting to smoothness") concentrate on choice of number of vanishing moments. The "adapting to smoothness" simulations fix the threshold to be the universal threshold using sample sizes of and 500 and for each sample size perform 10 simulations to find the best combinations of number of vanishing moments and primary resolution. In each case we use Gaussian noise with zero mean and the variance, 2 , is specified in each section below. The "adapting to smoothness" simulations demonstrate how the primary resolution is most influenced by discontinuities in lowest-order derivatives and that the number of vanishing moments chosen by the cross-validation algorithm is influenced by the underlying smoothness of the true function. However, these results are not hard and fast and occasionally the cross-validation technique gets it wrong. 4.1 Adapting to primary scale The underlying true function for this simulation is the Walsh function W (p; x) defined on which is a piecewise constant function taking only the values 0 or 1 starting at 0 and then switching to 1 and then back to 0 and so on. The number of switches in the interval is parametrised by p and the distance between each switch is 1=p. A convenient way to think about Walsh functions is as a sine wave that has been "blocked"! The parameter p is more formally known as the sequency number of the Walsh function and it is akin to the frequency parameter of a sine wave, but not exactly the same as the Walsh function is not always periodic on (0; 1). See Stoffer (1991) for further information on Walsh functions and their applications in statistics. Table 2 demonstrates that the selected primary resolution increases with the fineness of the true Walsh function although there appears to be quite some variability in the selected primary resolution values at 2. However, notice that for (e.g.) 2the width of the Walsh peaks is 3=64 and so a primary resolution matching this of 4 or 5 (corresponding to nearest widths of 8/256 or 4/256 of the Haar wavelet at this resolution level) might have been expected. However, our algorithm chooses primary resolution of 7, and indeed the other primary resolutions also "over-estimate" in this way. This effect is presumably because of the addition of noise which causes the procedure to be conservative and use finer scale wavelets. Conceptually, the best wavelet basis for representing this set of Walsh functions should be the Haar basis. Table 3 shows that our cross-validation method nearly always selects Haar to be the best basis in this situation. The ten simulations in Tables 2 and 3 are based on sample sizes of variance of . The deliberately large signal to noise ratio in this simulation is to verify that in low-noise situations the cross-validation procedure chooses reasonable values of the primary resolution and number of vanishing moments. Clearly as the signal to noise ratio decreases our procedure will choose the "best" values far less often. We leave to further work the interesting questions: for which values of the signal to noise ratio does it become very hard to select good parameters and whether competitors such as SURE can do a better job. Table 2: Best primary resolution for Walsh function W (p; x) at sequency number 2Simulation Number Table 3: Best number of vanishing moments for Walsh function W (p; x) at sequency number 2Simulation Number 4.2 Adapting to smoothness: no derivatives The underlying true function for this example is x for x 2 [0; 1 This function is continuous on [0; 1] but is not differentiable everywhere (the first derivative has a discontinuity at 1). The variance of the noise for these simulations . The best primary resolutions and numbers of vanishing moments for each simulation/sample size combination are shown in Tables 4 and 5. Over all sample sizes the modal number of vanishing moments is 3 and the associated approximate wavelet smoothness is 0:6. However, at smaller sample sizes the wavelet with 7 vanishing moments is selected 4 times out of 10, as many times as the wavelet. The modal primary resolution appears to be 4 but chosen. Table 4: Best primary resolution for function with no derivatives at different sample sizes. Table 5: Best number of vanishing moments for function with no derivatives at different sample sizes. Simulation Number Table primary resolution for function with one derivative at different sample sizes. Simulation Number 4.3 Adapting to smoothness: one derivative The underlying true function for this example is This function is continuous on [0; 1], its first derivative is continuous on [0; 1] but the first derivative is not differentiable everywhere (the second derivative has discontinuities at 1and 3). The variance of the added noise for these simulations was . The best primary resolutions and numbers of vanishing moments for each simulation/sample size combination are shown in Tables 6 and 7. Over all sample sizes the modal number of vanishing moments is 9 and the associated approximate wavelet smoothness is approximately 1:8. However, at smaller sample sizes the wavelet with 10 vanishing moments is selected 5 times out of 10. It is interesting to note that the smoothness of the wavelets selected for the example with one derivative is approximately twice that in the example with no derivatives, which is what one would expect. The modal primary resolution Table 7: Best number of vanishing moments for function with one derivative at different Table 8: Best primary resolution for function with mixed derivatives at different sample sizes. Simulation Number Table Best number of vanishing moments for function with mixed derivatives at different sample sizes. Simulation Number is 2. 4.4 Adapting to smoothness: mixed derivatives The underlying true function for this example mixes the two functions, f 0 (x) and f 1 (x) from the previous two examples. f mixed This function is continuous on [0; 1] but the first derivative has a discontinuity at 1and the second derivative has a discontinuities at 5and 7. The variance of the added noise for these simulations was . The best primary resolutions and numbers of vanishing moments for each simulation/sample size combination are shown in Tables 8 and 9. The modal primary resolution is 4 for the smaller sample sizes (agreeing with the primary resolution for the "no" derivative case in section 4.2) but 5 for the size. The primary resolution is most greatly influenced by the lowest-order derivative, as one might expect from the work of Hall and Patil (1995). The number of vanishing moments at the sample size is 3 for four simulations and around 6/7 for most of the others. At lower sample sizes the number of vanishing moments is generally larger than the ones selected for the f 0 (x) example, but not as high as for the f 1 (x) example which indicates that maybe some sort of compromise is being made. 5 Conclusions and further work In this article we have introduced a fast cross-validation method that performs wavelet shrinkage on data sets of irregular design and arbitrary size and also selects good values of the number of vanishing moments and primary resolution. Our cross-validation method has been shown to work well on the Ethanol data set and on simulated data where the scale (primary resolution) and smoothness (vanishing mo- ments) of the underlying true function can be controlled. Further work could be performed to investigate the conditions under which our method would break down both in terms of diminishing signal to noise ratio and in non-Gaussian and correlated noise situations. Our method could easily be extended to use level-dependent thresholds which would be of use with correlated data. It would also be interesting to see how well a MISE estimator such as GlobalSURE would perform in place of the cross-validation estimate. Herrick (1999) uses cross-validation with the Kovac-Silverman (2000) algorithm in the two-dimensional case, although not using the fast version described above and as such the implementation is slow. It remains to be seen whether a fast version is plausible: the fast point insertion/deletion techniques of Green and Sibson (1978) for the Voronoi dia- gram/Delaunay triangulation used for data interpolation would certainly be of value. Acknowledgments The author would like to particularly thank Arne Kovac for helpful discussions and access to his code. He would like to thank Bernard Silverman, David Herrick, others in the Bristol Statistics Group and the audience of the wavelets contributed papers session at the 1999 ISI Helsinki meeting for helpful conversations and suggestions. The author would also like to thank the referees and Editors for supplying extremely helpful comments and suggestions. --R Wavelet analysis and its statistical applications. Random design wavelet curve smoothing. Statistics and Probability Letters Computational Statistics and Data Analysis Adaptive Bayesian Wavelet Shrink- age Models. Orthonormal bases of compactly supported wavelets. Wavelets on irregular point sets. spatial adaptation by wavelet shrinkage. Adapting to unknown smoothness via wavelet shrinkage. Wavelet shrinkage: asymptopia? WaveShrink with firm shrinkage. Computing Dirichlet tesselations in the plane. On choosing a non-integer resolution level when using wavelet methods for mean integrated squared error of nonlinear wavelet-based density estimators Generalized Additive Models. Wavelet methods for curve and surface estimation. Generalised cross validation for wavelet thresholding. On the errors involved in computing the empirical characteristic function. Extending the scope of wavelet regression methods by coefficient-dependent thresholding A theory for multiresolution signal decomposition: the wavelet rep- resentation Wavelet shrinkage using cross-validation The discrete wavelet transform in S. Wavelet shrinkage for unequally spaced data. Density estimation. Statistical modeling by Wavelets. Function estimation via wavelet shrinkage for long-memory data Wavelet shrinkage and generalized cross validation for image denoising. --TR --CTR Matthew A. Nunes , Marina I. Knight , Guy P. Nason, Adaptive lifting for nonparametric regression, Statistics and Computing, v.16 n.2, p.143-159, June 2006
ethanol data;kovac-silverman algorithm;fast wavelet shrinkage updates;cross-validation
599448
Perfect simulation for correlated Poisson random variables conditioned to be positive.
In this paper we present a perfect simulation method for obtaining perfect samples from collections of correlated Poisson random variables conditioned to be positive. We show how to use this method to produce a perfect sample from a Boolean model conditioned to cover a set of points: in W.S. Kendall and E. Thnnes (Pattern Recognition 32(9): 15691586, 1999), this special case was treated in a more complicated way. The method is applied to several simple examples where exact calculations can be made, so as to check correctness of the program using &khgr;2-tests, and some small-scale experiments are carried out to explore the behaviour of the conditioned Boolean model.
Introduction Markov chain Monte Carlo (McMC) provides the opportunity to carry out simulation-based statistical inference, by allowing one to sample approximately from a target distribution realised as the equilibrium of a Markov chain. The approximate nature of McMC arises because the output is subject to initialization bias. Recent work on perfect simulation [4, 13] shows that in favourable circumstances McMC simulation algorithms can be modified so as to replace the approximation by an exact simulation procedure. In particular the Coupling from the Past (CFTP) method due to Propp & Wilson [13] has been developed intensively since its discovery in 1994. For example, dominated CFTP is a variant of CFTP developed in [8], which permits perfect simulation of a general class of point processes (see also [10]). Dominated CFTP has an importance going beyond point processes, since it allows application of CFTP to a wide class of non-uniformly ergodic Markov chains which need not be monotonic. Kendall Thonnes [11] used dominated CFTP to carry out perfect simulation in stochastic ge- ometry, showing how to get perfect samples from Boolean models conditioned to cover a finite set of points. The purpose of this paper is to explain how to get a perfect sample from collections of correlated Poisson random variables conditioned to be positive (briefly, correlated Poisson random variables arise as sums of a basic set of independent Poisson random variables). Following Kendall & Thonnes [11], the motivating application is to obtain a perfect sample from a Boolean model conditioned to cover a set of points. However the construction in [11] is very involved. Conditional Boolean model can be viewed as arising from correlated conditioned Poisson random variables, and this leads to a simpler simulation algorithm; the more general random variables set-up draws attention away from the geometry (which here is a distracting complexity). As well as being of interest to stochastic geometers wishing to investigate the conditional Boolean model, the results reported on here add to a sequence of case-studies [6, 7, 8, 11, 10] aimed at developing CFTP by using it in challenge-problems from stochastic geometry. The particular challenge of perfect simulation of conditional Boolean models has resulted in the formulation of a rather general context for CFTP described as "extended state-space CFTP" below. The construction of the paper is as follows. In x2 we introduce the notion of correlated Poisson random variables, describe a McMC method for obtaining an approximate sample from the conditional correlated Poisson distribution, and then specify an algorithmic scheme for obtaining a perfect sample, in the context of extended state-space CFTP. In common with most other practical CFTP algorithms this is based on the construction of interleaved sequences of upper- and lower-sandwich processes, bounding intermediate Markov processes which actually have the required equilibrium distri- bution. Fundamental properties of our CFTP algorithm are established by Theorem 1 in x3: namely that the algorithm will terminate in finite time and that the output has the desired distribution. In x4 we describe the relationship between conditional Boolean models and collections of correlated Poisson random variables conditioned to be positive and thus show how to use our algorithm to conduct CFTP for the conditional Boolean model. Several examples are described in x5. For these examples, we derive explicit conditional distribution functions of the correlated Poisson random variables, enabling us to carry out 2 -tests in order to check the correctness of the CFTP algo- rithm. Relationships between the intensity of the germ process, radius of the typical grain, number of conditioning points and the coalescence time are investigated in x6. Finally, some comments and conclusions are presented in x7. Correlated Poisson random variables conditioned to be positive We begin this section by introducing the concept of collections of correlated Poisson random variables. We then describe a McMC method for obtaining an approximated sample from the collection when the individual random variables are all conditioned to be positive. Finally we describe the CFTP modification which allows us to obtain a perfect sample from the desired distribution. We fix a given index set and assign a rate A to each non-empty subset A S. Consider a collection of independent Poisson random variables fYA : A Sg indexed by these subsets, such that YA has mean A , and define is a collection of correlated Poisson random variables. We also define and set abbreviating As described in x4, such collections arise naturally in the context of the Boolean model in stochastic geometry, when the index set replaced by a finite set of conditioning points and YB counts the number of grains covering exactly the subset B of conditioning points and no others, while X fx i g counts the number of grains covering the conditioning point x i . In this context, motivated by problems from the oil industry, Lantuejoul [12] has investigated simulation of such Boolean models conditioned to cover the conditioning points: the question of converting this to perfect simulation, as discussed in [11], leads directly to the question of how to conduct perfect simulation of correlated Poisson random variables conditioned to be positive. 2.1 McMC for collection of correlated Poisson random variables conditioned to be positive To carry out McMC for fX we replace random variables by immigration- death processes. For each non-empty subset A S we define an immigration-death process YA of immigration rate A and unit death rate, requiring the YA to be indepen- dent. By detailed balance YA has Poisson equilibrium of mean A . Now we define XA for any non-empty subset A S by Abbreviating that the equilibrium distribution for fX is a collection of correlated Poisson random variables. The McMC procedure is now straightforward: simulate the YA processes for a long time, then construct the X i using Equation (1). Of course this is using a sledgehammer to crack a nut: there is no reason not to sample directly from the YA equilibria. However the McMC approach can easily be modified to allow for conditioning. Considered alone, the process XA is an immigration-death process of immigration rate A and unit death rate. Moreover where XA e XB means that if there is an immigration in XA at time t then there is an immigration in XB at that time, and if there is a death in XB at time t then there is a death in XA at that time. It is possible to establish a converse to the above as follows: given a collection of immigration-death processes fXA : A Sg satisfying the relation (2), and co-adapted in the sense that the rate-computations are based on conditioning on a common past, then independent immigration-death processes YA of immigration rate A and unit death rate can be constructed such that Equation (1) applies, using the Mobius formula [1, chapter 5, page 53] to deduce A:BA We now consider how to modify the above McMC procedure so as to produce correlated Poisson random variables conditioned to be positive. Since the underlying Markov chain is reversible, all that has to be done is to forbid transitions which lead to one or more of the X i becoming zero. To do this in a way which maintains the coupling required for CFTP methods, we need to prescribe replacement death times for the potential death times which are thus prevented from becoming actual; accordingly we introduce independent unit-rate Poisson processes ZA , one for each non-empty subset A S. We define the immigration-death process e YA to be based on the same immigration- death structure as YA , but forbidding deaths which would lead to one of the target random variables becoming zero. Namely, if t is a death time of YA such that then the death time t of YA will not be accepted by e YA , and we set e Furthermore, we use the next incident ^ t of ZA as a new potential death time of e YA . We call this perpetuation of e Y from time t to ^ t. The interval [t; ^ t) is a perpetuation interval, and ^ t is a perpetuation time of e YA . Summarizing, if e experiences a death at t, and if there exists A such that e A such that then perpetuation takes place. In particular, perpetuation increases e YA by at most 1 compared with the original YA . Since we use independent unit rate Poisson processes ZA (t) to provide perpetuation times, e YA inherits the unit death rate of YA subject to censorship of those transitions which would lead to X i Now if we define e A:BA e e then detailed balance shows that the equilibrium distribution of e is that of a collection of correlated Poisson random variables conditioned to be positive. The pseudo-code McMC-CCP displayed in Table 1 gives an explicit description of how we can derive a simulation of e X over a time interval [a; b] from a realization of over the same time interval. initialize e repeat e A:i2A e YA A index of next incident if next incident is immigration then e if next incident is death then if e e else label next ZA-incident as death until no more incidents return The algorithm McMC-CCP performs McMC to obtain an approximate sample of conditioned correlated Poisson random variables, using unconditioned immigration-death processes fYA g and associated perpetuation Poisson processes fZA g. Table 1: McMC-CCP algorithm 2.2 Extended state-space CFTP in a general context Dominated CFTP is presented in [10] in a general context. In this paper we require a further modest extension, extended state-space CFTP. Here we describe this in a general context, then describe how to use it to get perfect samples from a correlated Poisson random variables conditioned to be positive. Our aim is to obtain a perfect sample from the equilibrium distribution of a discrete or continuous time Markov chain taking values in a state space X. The difficulties here are that the Markov chain R may not be uniformly ergodic, and even if a relevant partial order exists we do not wish to assume either monotonicity or the existence of maximal and minimal elements. The main idea to overcome this problem is: insert the original unordered state-space X as a subset of a bigger ordered space e X, with an "upper/lower-sandwich" process living on e X and eventually being absorbed in X. The evolution of the stochastic process e R is chosen so that once it visits X it follows the stochastic dynamics of R. Specifically, we identify a sequence of majorizing processes e R ; such that which are identically distributed up to a shift in time, which live on the superset e X of X and satisfying the following conditions: 1. e X possesses a partial order relation , and if a 2 e X are such that a b then a = b (so X is at the base of the partially ordered space e 2. e R (n) is eventually absorbed in the subspace X, so that for any fixed u as n !1; 3. e R (n) evolves according to the stochastic dynamics of R once it hits X; 4. For all m n t 0 e R (m) (t) e Then we have the following CFTP result. Theorem 1 Suppose that the Markov chain R takes values in a state space X, and the R (n) live on the partially ordered superset e X of X and satisfy conditions 1-4. Suppose further that R(t) converges weakly to a unique equilibrium distribution as R (n) almost surely and e the equilibrium distribution . Proof : It follows from Equation (4) in condition 2 above that T < 1 almost surely. By Equation (5) of condition 4, if n > T then e R (n) (0) e Consequently by condition 1 above e R (n) R (T ) (0) for such n. Accordingly e e R (n) (0) exists almost surely. By condition 3, and the fact that the e R (n) are identically distributed up to time shifts, e R (n) (0) has the same equilibrium distribution as that of R(n), so lim R (n) where R is started at time 0 with the common hitting distribution of the e R (n) on X. But converges weakly to . Therefore, e R (T ) (0) has distribution as required. 2 In the following subsection we describe how to construct e R (n) as an ordered triple of processes, and in the next section we show that conditions 1-4 hold, so that we can use e R (n) to get a perfect sample from the desired distribution. 2.3 CFTP for correlated Poisson random variables conditioned to be positive We need to introduce some further notation in order to explain howwe can use extended state-space CFTP to produce perfect samples of correlated Poisson random variables conditioned to be positive. X as follows are n-tuples of nonnegative integersg ; e are n-tuples of nonnegative integers with v min v max where the n-tuples are all of length 2 k 1 indexed by the non-empty subsets of S, the inequality v min v max is interpreted element-wise, and in fact v, v min , v max only contain entries which are 0 or 1. The embedding X e X is given by The partial ordering on e X is given by exactly when y interpreting equalities and inequalities element-wise. This ordering on e corresponds exactly to the inclusion ordering for order intervals which was used in set-valued CFTP and, implicitly, in dominated CFTP in earlier formulations [6, 7, 8]. It is apparent that this partial ordering and embedding of X in e 1 preceding Theorem 1. We now describe how to use the unconditional immigration-death processes (Y A : non-empty A S) (assumed to be in statistical equilibrium) and the perpetuating incident processes (ZA : non-empty A S) to construct realizations of e R (n) over the time interval [ n; 0]. Note that we can use time-reversibility of the YA to extend their trajectories as far back into the past as may be required, fixing their values at time 0 to be samples from the unconditioned Poisson equilibrium of these processes. Extension of the ZA is even easier! For e R (n) where YA is the unconditional immigration-death process assigned to the subset A, and the V (n);min , V (n);max processes are defined together recursively in the following way. Initially, at time n, we set for all non-empty A S. Updates of these processes occur only at death times of corresponding Y processes and perpetuation times of corresponding Z processes. For convenience of notation we define e e Suppose YA experiences a death at time A , respectively A , may be set equal to 1 when there is a danger of causing zeros in some of the opposite processes e respectively e [min-death] If e so that after the YA -death there would be a zero in some upper process e then we set the lower component [max-death] If e so that after the YA -death there would be a zero in some lower process e then we set the upper component On the other hand suppose that ZA experiences a perpetuation incident at time t. Then we can set V (n);min A , respectively V (n);max A , equal to 0 when there is no danger of causing zeros in any of the opposite processes e respectively e [min-perpetuation] If e so that there is no danger of zeros in any upper process e then we set the lower component [max-perpetuation] We need to consider the following two cases. 1. In this case, if e we set the upper component V (n);max 1. In this case, if e 1 for all i 2 A, then we set the upper component V (n);max It remains to establish the conditions 1-4 required by Theorem 1, and we shall do that in the next section. First, we give a brief description of our CFTP algo- rithm. It begins by testing for whether e R (n) (0) lies in X, which is to say, whether A (0) for all non-empty A S. If so then the vector of common values X (n);min is returned as a sample of the corresponding vector of correlated Poisson random variables conditioned to be positive. If there exist A S such that V (n);min A (0) 6= V (n);max A (0) then we must choose a new starting time m < n and repeat the simulation replacing n by m (as suggested in [13], in this case a sensible choice is to double n). Note that we must insist on extending backwards in such a way that we re-use the previous realization of as we noted above, the reversibility arising from detailed balance is of technical assistance here. We proceed to extend backwards in time until minimal and maximal processes coalesce, and then return the common value of the coalesced processes at time 0. Table 2 gives pseudo-code summarizing the resulting algorithm CFTP-CCP. 3 Properties of the CFTP algorithm To prove that our CFTP algorithm CFTP-CCP will indeed provide us with perfect samples from the desired distribution, we must establish a sequence of lemmas relating to the conditions 1-4. extend Y , Z to [ n; 0] if e R (n) e A (0)) return else The CFTP-CCP algorithm performs extended state-space CFTP to obtain an exact sample of conditioned correlated Poisson random variables. Table 2: CFTP-CCP algorithm First we must make sure that condition 1 applies, which is to say, the process e R (n) genuinely stays in the state-space e X. defined as above we have A (t) V (n);max A (t) (8) for all non-empty A S and for n t 0. In particular, the state-space for e R (n) can be taken to be e X. First note that by construction Equation (8) must hold at time n. Now suppose that Equation (8) holds up to, but possibly not including, time t. Therefore we have e for all i 2 S. It suffices to consider t such that either YA experiences a death at that time, or ZA delivers a perpetuation incident. In the case of a death the relationship (9) and the crossover between [min-death] and [max-death] assure us that V (n);min can be set to 1 only if V (n);max is, so Equation (8) must also hold at time t. The case of a perpetuation incident is entirely similar: If the perpetuation happens in both upper and lower processes then V (n);max can be set to 0 only if V (n);min is, so Equation (8) must also hold at time t. If the perpetuation happens only in the upper process, we already have V (n);min holds no matter what is the value of (t). The result follows by induction. 2 Setting aside condition 2 for the moment, we turn to condition 3. persists over all [t; 0] and over that time interval the coupled process Y evolves as a copy of e Y . Proof : This is simply a matter of observing that if V (n);min , V (n);max coincide at time t then so do e and so there is no longer any distinction between min and max in the conditions [min-death], [max-death] for death and [min- perpetuation], [max-perpetuation] for perpetuation above, note that the case of perpetuation in the upper process only will not happen any more, while birth decisions are already identical. Consequently from time t onwards the death and perpetuation decisions are the same for V (n);min , V (n);max so they must continue to coincide. Furthermore the effect of the death and perpetuation decisions on Y +V (n);min , Y +V (n);max agrees with the prescription for the evolution of e Y in our description of the McMC-CCP Algorithm in Table 1. 2 Now consider condition 4. This follows if we can establish the following "fun- nelling" result: Lemma 3 For all n m t 0 and all non-empty A S we have A (t) V (n);min A (t) V (n);max A (t) V (m);max Proof : The initial values V (m);min ( m), V (m);max ( m) are respectively minimal and maximal, so this funnelling certainly holds at time m. Consider therefore an incident at time t > m, and suppose the funnelling relationship holds at time t . This carries through into a relationship e If the incident is an immigration then all of V (m);min , V (m);max , V (n);min and V (n);max are not affected, and the relationship persists. If the incident is a death then examination of [min-death] shows that V (m);min can be set to 1 only if V (n);min is set to 1, since e similar arguments using [max-death] apply to show V (n);max can be set to 1 only if V (m);max is set to 1. If the incident is a perpetuation in both upper and lower processes then similar arguments concerning [min-perpetuation] and [max-perpetuation] show that V (n);min can be set to 0 only if V (m);min is set to 0, V (m);max can be set to 0 only if V (n);max is set to 0. Now we consider the case, where the incident is a perpetuation only in the upper process. In this case, we have and Then it follows from Lemma 1 that A (t) V (n);min A (t) V (n);max So we only need to prove A (t) V (m);max If there is i 2 A such that e according to [max-perpetuation], A (t) can not be set to 0. So V (m);max holds. If e then we set V (m);max and we have e for all i 2 A. There are two cases to be considered: In this case, since V (m);min actually know e and hence also e A. Then it follows from [max-perpetuation] and [min-perpetuation] conditions that we have In this case, we have either V (n);max e it follows from [max-perpetuation] that V (n);max is automatic since t is a perpetuation time not a death time. So in any case, (10) holds. This means the funnelling relationship persists to time t if it has been maintained up to time t . The result follows by induction along the sequence of incidents over the Finally we turn to condition 2. This is a consequence of the following lemma. Lemma 4 For all sufficiently large n, the processes V (n);min , V (n);max coalesce at some time in the interval [ n; 0]. Proof : The lemma follows if there are times at which the upper processes V (n);max A all vanish. For by construction it then follows coalescence occurs at that time. Fix T < t < 0, > 0 and for experiences an immigration in the time interval [t; Then the D i are increasing events based on independent events of the form that YA has an immigration in [t; t the FKG inequality [5, Theorem 2.4] applies and consequently Y On the other hand there is > 0 such that P [D i ] > for all i. It follows that alternative line of reasoning constructs an estimate based on all of the YA experiencing immigration, thus dispensing with the FKG inequality.) Now suppose that at time t + the event occurs. Let S t be the family of subsets A S such that YA experiences at least one immigration in [t; t occurs then the union A must cover S, moreover clearly S t has no more than 2 k 1 members. Now there are at most 2 k 1 perpetuated values among V (T );max A , for all A S. Coalescence of V (T );min A and V (T );max A will occur if, for all A yielding perpetuated val- ues, both the Poisson process ZA experiences incidents in the time interval [t+; t+2] and also the YA does not hit zero in the same time interval, since then all the V (T );max A will be zero. But a simple stochastic comparison, using the Strong Markov property and the representation of immigration-death processes in terms of Poisson inputs and exponential death times, shows that this happens with a conditional probability (condi- tioned on Let C t be the event that occurs together with the event whose probability is given in Equation (11) above. Then However C t is actually independent of events in the past of time t. We may therefore apply the second Borel-Cantelli lemma to show that, almost surely, infinitely many of the C 2r occur (for It follows that coalescence is almost sure to happen.The following result is an immediate consequence of the above lemmas and Theorem 1 and the existence of a unique limiting equilibrium for processes e X in x2. Theorem 2 The algorithm described in x2 almost surely terminates in finite time, moreover the output of the algorithm has the distribution of the corresponding array of correlated Poisson random variables conditioned to be positive. The above work shows that our CFTP algorithm does indeed produce a perfect sample of the corresponding collection of correlated Poisson random variables conditioned to be positive. 4 Application to simulation of the conditional Boolean model In this section, we show how our CFTP algorithm can be used to obtain a perfect sample from a conditional Boolean model. 4.1 Relationship between the conditional Boolean model and correlated Poisson random variables conditioned to be positive Recall that in section 2, we introduced the distribution of correlated Poisson random variables showed it could be obtained as the equilibrium distribution of the process (X 1 A:i2A YA (t); for for independent immigration-death processes YA (t) Now if we consider a Boolean model as an equilibrium distribution for a spatial immigration-death process then with appropriate assignation of conditioning points rates A , the process XB (t) can be interpreted as the time evolving number of germ-grain pairs whose grains cover all the conditioning points in B, while the process YA (t) describes the number of germ-grain pairs whose grains cover all conditioning points in A, but no conditioning point which is not in A. For example, counts the number of germ-grain pairs whose grains cover the conditioning point x 1 . We divide this process XB (t) into counts the number of germ-grain pairs whose grains cover x 1 , but not x 2 , and Y fx1 ;x2 g (t) counts the number of germ- grain pairs whose grains cover both x 1 and x 2 . If we convert the Boolean model into a Poisson process on a space marked using the grains, then the space of germs leading to grains covering x 1 is divided into two disjoint subregions; Y fx1g (t) counts the number of germs which fall in one of the subregions, and Y fx1 ;x2 g (t) counts the other. Thus the number of germ-grain pairs in the subregion associated with A is an immigration- death process YA (t), independent of other such immigration-death processes until the conditioning is applied by means of forbidding certain transitions. We have noted that some of the processes YA (t) might have zero immigration rate. In the conditional Boolean model, this corresponds to a set A of conditioning points which can not simultaneously be covered by a single germ-grain pair. In the case of grains which are disks of constant radius, there will then be at least two points in A which are separated by a distance of greater than 2r, where r is the radius of a typical grain. From the above it can be seen how we can use perfect samples from conditional correlated Poisson random variables to produce perfect samples from a conditional Boolean model. 4.2 Perfect simulation for the conditional Boolean model For the sake of simplicity we consider only the case of disks of constant radius, though the method can be extended to cover the case when the typical grain is random but of bounded diameter. Perfect simulation follows once one establishes how to simulate sorted incident times of all YA (t) and ZA (t) over [ In essence all one has to do is to simulate a stream of candidate incident times of time-varying intensity, then for each incident time choose whether it is a Z-type or a Y -type incident using appropriate probabilities. The time-varying rate of the underlying stream of candidate incidents should be taken to be A YA where N is the total number of processes ZA with A 6= 0, and assignations of type should be made so as to deliver corresponding rates A For Z-type incidents, one assigns the type (indicating to which of the various ZA processes the incident belongs) uniformly at random. For Y -type death incidents one assigns the type (indicating to which of the various YA processes the incident belongs) randomly but weighted by the sizes of the corresponding YA . For Y -type birth inci- dents, one chooses a location uniformly at random from the bounded window W and then assigns the incident to YA if this location falls in the region x G y GA (12) where G is a typical grain (since then the corresponding disk will cover exactly those conditioning points constituting the indexing set A). Birth incidents can be discarded if their locations do not fall in any of these regions. Perfect simulation is then conducted according to the algorithm CFTP-CCP as given in Table 2. At the conclusion of the algorithm the perfectly sampled conditional Boolean model is built up using the locations of surviving birth incidents, supplemented by a sample from the unconditional Boolean model on the region y which by construction covers no conditioning points. (This can be done easily by thinning the unconditional Boolean model on the full region W .) In the following, we consider plots of conditional Boolean models obtained from the above perfect simulation method. Clearly, given the configuration of conditioning points and the radius of a typical grain, the results will be affected by the value of the intensity. We give plots for simulations using varying patterns of conditioning points (random pattern, oblique lattice, square lattice) and medium and high intensities of the underlying Poisson germ process. For low intensity (less than germs per unit area) and closely-spaced conditioning points (such that a grain can cover more than one conditioning point) the algorithm failed to coalesce within the memory constraints of our computer (Sun Ultra 1, 64 MBytes RAM); the maximum and minimum processes then take a long time to come to agreement, since initially the perpetuated maximum grains disappear only when minimum grains cover conditioning points (itself a rare event), and moreover perpetuated minimum grains tend to disappear quickly back to zero since conditioning points are typically covered by several perpetuated maximum grains. Our plots are based on intensities of germs per unit area. The same general features are displayed in each case: there are many extra grains induced by the requirement to cover all conditioning points. For high intensity the resulting figure differs less from the unconditional case, since much of the window is covered anyway, but there is still an excess of grains covering conditioning points. In each case we compute the number of grains covering the conditioning points and the excess of this over the number to be expected for a comparable simulation of an unconditional Boolean model. The excess is much larger in the case of a random pattern of conditioning points; this is reasonable since a randomly scattered pattern affects a much greater area of the window. The excess does not appear to depend strongly on the underlying germ intensity. This comes as no surprise. The excess, when generated by our algorithm, is merely the sum of all perpetuated grains: in the notation of section 2. Since the VA are only over 0 or 1, the scope for variation of the total excess is limited. Note that in all the figures conditioning points are marked as "+". 20.20.611.41.8Perfect sample from a conditional Boolean model with placed randomly in a window W of width units. - Intensity of underlying germ process - Radius of typical grain Simulation yields grains, of which 103 cover at least one conditioning point. The unconditional model would yield a Poisson number of grains, mean number 120, of which we would expect 47:41 to cover at least one of the points. So the excess number of grains from the conditional Boolean model covering the conditioning points is 55:59. Figure 1: Conditional Boolean model, random pattern placed randomly in a window W of width units. - Intensity of underlying germ process - Radius of typical grain Simulation yields grains, of which 131 cover at least one conditioning point. The unconditional model would yield a Poisson number of grains, mean number 180, of which we would expect 71:11 to cover at least one of the points. So the excess number of grains from the conditional Boolean model covering the conditioning points is 59:89. Figure 2: Conditional Boolean model, random pattern points placed on a lattice based on a parallelogram of horizontal side length 2=19, height 2=19 and angle 63:43 o in a window W of width units. - Intensity of underlying germ process - Radius of the typical grain Simulation yields grains, of which 71 cover at least one conditioning point. The unconditional model would yield a Poisson number of grains, mean number 120, of which we would expect 47:41 to cover at least one of the points. So the excess number of grains from the conditional Boolean model covering the conditioning points is 23:59. Figure 3: Conditional Boolean model, parallelogram grid points placed on a lattice based on a parallelogram of horizontal side length 2=19, height 2=19 and angle 63:43 o in a window W of width units. - Intensity of underlying germ process - Radius of the typical grain Simulation yields grains, of which 97 cover at least one conditioning point. The unconditional model would yield a Poisson number of grains, mean number 180, of which we would expect 71:11 to cover at least one of the points. So the excess number of grains from the conditional Boolean model covering the conditioning points is 25:89. Figure 4: Conditional Boolean model, parallelogram grid points placed on a square lattice of side length 2=19 in a window W of width units. - Intensity of underlying germ process - Radius of the typical grain Simulation yields grains, of which 74 cover at least one conditioning point. The unconditional model would yield a Poisson number of grains, mean number 120, of which we would expect 47:41 to cover at least one of the points. So the excess number of grains from the conditional Boolean model covering the conditioning points is 26:59. Figure 5: Conditional Boolean model, square grid 20.20.611.41.8Perfect sample from a conditional Boolean model with points placed on a square lattice of side length 2=19 in a window W of width units. - Intensity of underlying germ process - Radius of the typical grain Simulation yields grains, of which 98 cover at least one conditioning point. The unconditional model would yield a Poisson number of grains, mean number 180, of which we would expect 71:11 to cover at least one of the points. So the excess number of grains from the conditional Boolean model covering the conditioning points is 26:89. Figure Conditional Boolean model, square grid 5 Checking for correctness Implementations of simulation methods should always be checked out carefully, to protect against mistakes in coding as well as to confirm the theory. In this section we summarize several simple examples which provided checks for the correctness of the method. The programs are implemented in C. The simulation time interval is initialized at [ 2; 0] in each case, though of course the algorithm can extend this further back in time if required. Window W is a unit square. G is set to be a disk of radius r, is the intensity of the germ process. To check correctness, in each case we collect 10000 samples and then carry out a 2 test using appropriate grouping. In the following we only report summarized results. Full details of implementation, results, and derivations of the exact equilibrium distribution functions for the examples can be found in the associated research report [3], available as Preprint 350 at http://www.warwick.ac.uk/statsdept/Staff/WSK/ppt.html. 1. Single conditioning points. 5. The resulting 2 5 value was 4.804. 2. Two separated conditioning points. 5. The resulting 2 8 value was 9.368. 3. Two close conditioning points. 5. The resulting 2 value was 12.344. 4. Three close conditioning points in 3-fold symmetry. g. Place the three points in a configuration of 3-fold symmetry. 8. The resulting 2 26 value was 19.993. None of the above 2 values are significant. 6 Investigating algorithm performance In this section we carry out some experiments to explore the way in which the run-time of the perfect simulation algorithm depends on various parameters. It follows from the analysis in Section 4.2 that each unconditioned process YA is a spatial immigration-death process of constant immigration rate and unit death rate on EA , where A S and EA is given by Equation (12). Recall that k is the number of conditioning points and r is the radius of a typical grain. In this section we will investigate the dependence of T c on , r, k. Note that throughout this section, we use the actual coalescence time T c , not the time produced by doubling during the performance of Algorithm CFTP-CCP. Experiment 1: dependence of coalescence time on grain radius Holding fixed the intensity of the germ process and the number of conditioning points, we investigate the relation between coalescence time T c and the radius r of a typical grain. We place a set conditioning points on the vertices of a square of side-length 0:2 in a unit-width window W , and obtain independent samples of size 200 each for 99 equally spaced values of r ranging from 0:01 to 0:5. Figure 7 plots log(sample mean) of coalescence time versus r (the dotted line), and includes two theoretically derived asymptotics (the curved solid line for small ra- dius, and the horizontal solid line for large radius). A discontinuity in the sample curve signals the effect of the possibility of single grains covering several conditional points. The theoretical asymptotics are derived as follows. First consider the case of grains so small that any one grain can cover at most one conditioning point (r < 0:1). Then the only relevant YA are the k processes for which fig is a singleton, and they are independent of each other. Coalescence occurs exactly when each of the Y fig has experienced a death at a time when there is no perpetuation in V max fig . For an individual Y fig the first such event occurs approximately at the first instance of a Poisson process of rate r 2 which is independently thinned with deletion probability Using this approximation, the thinned process is also a Poisson process of rate r 2 =2. Therefore At the alternative extreme of large r (r >> 0:1), the conditioning points are likely to be covered by just one disk of the unconditional Boolean model: coverage probability for just one conditioning point on its own at time zero is and the coverage events are positively correlated. Accordingly the coalescence time T c will be approximated by the maximum of the first perpetuation times for each of the N YA processes, so not depending on grain radius r. We deduce the following theoretical asymptotics for the mean coalescence time: for small r, and for large r. Radius log(mean) of the Coalescence Time -226 Figure 7: Graph of the log(sample mean) of T c versus grain radius r for fixed conditioning points value of 20. The reason for the big jump at 0:1 is as follows. When 0:1, it is possible for one grain to cover more than one conditioning point. The jump shows the cost we pay for the consequent interaction between e Y processes. Experiment 2: dependence of coalescence time on intensity Holding fixed the radius of a typical grain and the number of conditioning points, we now investigate the relation between coalescence time T c and the intensity of the germ process. We place a set on the vertices of a square of side-length 0:2 in a unit-width window W , and obtain independent samples of size 200 each for 75 equally spaced values of ranging from 2 to 150. Figure 8 plots the log(sample mean) of coalescence time versus (dotted line) and again includes two theoretically derived asymptotics (solid lines). The theoretical asymptotics are derived essentially as for Experiment 1, as follows. First consider the case where is very large. Then all the conditioning points are likely to be covered by a single disk of the unconditional Boolean model so, with the same arguments as those in Experiment 1, the coalescence time T c can also be approximated by the maximum of the N first perpetuation times for the YA processes. Hence the mean is approximated by asymptotic (16), which is independent of the value of . On the other hand, for small values of , the coalescence time T c will depend on the the value of r. In this experiment, we take r = 0:08, so it follows from the arguments in Experiment 1 that when is not very large, the distribution of T c is approximately given by asymptotic (13). Hence the approximated theoretical mean is given by (15), but viewed as a function of . Intensity log(mean) of the Coalescence Time Figure 8: Graph of the log(sample mean) of T c versus intensity for fixed conditioning points radius of the grain Experiment 3: dependence of coalescence time on the number of conditioning points Holding fixed the intensity of the germ process and the radius r of a typical grain, we investigate the relation between coalescence time T c and the number of conditioning points. On a unit-width window W , when k is small, it is likely that a single grain can cover at most one conditioning point as long as r and are not very large. Therefore, for small k, the distribution of T c can also be approximated by equation (13), hence the mean is given by asymptotic (15) but now viewed as a function of k. On the other hand, when k is very large, any disk of the unconditional Boolean model are likely to cover at least one conditioning point. So the distribution of T c in this case can be approximated by equation (14), where again, N is the number of YA processes with A S, A 6= 0. Hence the mean is given by asymptotic (16), but now viewed as a function of k. We illustrate the relation between T c and k when r is small. The experiment is designed as follows. We take conditioning points on the vertices of rectangles in a unit-width window W , each rectangular has width 1=11 and length 1=6. We obtain independent samples of size 200 for each k. By above settings, any grain can cover at most one conditioning point. Therefore, in this case, we would expect that the sample mean versus k should agree with the approximated theoretical mean curve given by asymptotic (15), as is confirmed by the plot of sample mean (dotted lines) and the two asymptotics of the theoretical mean versus number of conditioning points k in Figure 9. Mean of the Coalescence Time Figure 9: Graph of the sample mean of T c versus k for fixed value of of the grain Experiment 4: dependence of actual duration of algorithm on intensity Finally we investigate the relation between actual duration ("wall-clock time") of the algorithm and , r and k. In each experiment, we recorded 200 independent actual duration times for collecting one sample for each value of r, or k and plotted the average duration time and 95% confidence limits about the mean versus r, or k respectively in the following figures. We first consider the duration time as in Experiment 1. Theoretical arguments suggest that mean duration time should be a convex function of grain radius r, tending to infinity as r ! 0 and to a positive constant as r ! 1. Simulations support this conclusion, but also show that the significant features of dependence occur over only a relatively small range of r. In Figure we plot the log(sample mean) over 200 realizations and the 95% confidence limits about the mean over the range r 2 [0:01; 0:5], from which we see that there are two peaks corresponding to two values of 0:145. This corresponds to the following observations: as r increases through possible for one grain to cover at most 2 conditioning points, while as r increases through becomes possible for one grain to cover at most 4 conditioning points. Now consider the dependence of mean duration time on intensity , as in Experiment 2. We gain a similar theoretical picture, except that for large intensity the mean duration time should increase from a minimum (since the algorithm needs more time to deal with more and more incidents of YA and ZA processes as increases). Figure 11 plots the log(sample mean) over 200 realizations and 95% confidence limits about the mean, and confirms this argument from theory. The sharp increase in duration time as intensity is reduced is mirrored by our ex- Radius log Actual Duation (in seconds) of The Algorithm -22 Figure 10: Graph of the log(mean actual duration) (in seconds) and 95% confidence limits over 200 realizations of the algorithm versus r for fixed value of 4. The two peaks correspond to the two values of r when one grain can cover at most two and four conditioning points respectively. perience of larger-scale simulations as displayed in Figures 1-6, particularly by the failure of the algorithm to produce coalescence for low intensity in such cases. Things are much simpler in the case of dependence on number of conditioning points k as in Experiment 3. As in Experiment 3, fix 0:04. In this case, all the e Y processes are independent with each other. Therefore, if we need h amount of time for coalescence for each conditioning point, then the total amount of time for coalescence for k conditioning points will be approximately kh. Figure 12 plots the log(sample mean) over 200 realizations and 95% confidence limits about the mean. This figure shows that the actual time increase as number of conditioning points increases, in agreement with the above. 7 Conclusion In this paper we have presented a perfect simulation method for correlated Poisson random variables conditioned to be positive. Working in a general context (as opposed to the geometric context of [11]) has made the algorithm simpler to implement and to present. Moreover, although the method in this paper does not fall in the category of dominated CFTP defined in Kendall &Moller [10] nevertheless it is a modest variation of it. In this paper, "domination" does not occur with respect to the partial order defined in the state space, but the lower- and upper sandwich processes are "dominated" by a process in extended state space formed from YA and ZA for all A S. While we cannot give theoretical bounds on the range of parameters involved in the particular kind of perfect simulation, it may be seen from the results of Sections Intensity log Actual Duation (in seconds) of The Algorithm Figure 11: Graph of the log(mean actual duration) (in seconds) and 95% confidence limits over 200 realizations of the algorithm versus for fixed value of Number of k log Actual Duation (in seconds) of The Algorithm -22 Figure 12: Graph of the log(mean actual duration) (in seconds) and 95% confidence limits over 200 realizations of the algorithm versus k for fixed value of 4.2 and 6 that low-intensity conditional Boolean models present challenges which this particular perfect simulation algorithm has not overcome. Of course there is a contrast here with conventional McMC methods: perfect simulation clearly indicates when it is failing to give a correct answer, while conventional McMC may fail without overt warning. This should not however be overstated. Firstly, there is a price to pay for CFTP [2], so that CFTP methods may fail when judiciously chosen McMC algorithms still give good answers. Secondly, CFTP exhibits bias if the user is liable to terminate runs early: this is overcome by Fill's rejection method [4] and this has been generalized to the point process context in [14] though, as Wilson has pointed out to one of us, a problem remains because of time-variability due to simulation of point processes as part of the point process algorithm. Despite these caveats, perfect simulation remains an attractive member of the statistician's tool-box, and the above algorithm delivers on its promise for medium and high intensity conditional Boolean models. Further development of the particular problem of perfect simulation of conditional Boolean models leads to the consideration of conditioning constraints based on connectivity [12]. Perfect simulation in such situations is likely to prove very difficult, since the conditioning appears to involve arbitrarily large numbers of extra grains. As with work on perfect simulation of Gibbs point processes [10, 9] we have taken care to test our simulation program carefully. This is a particular issue for perfect simulation implementations, which are inevitably more complicated than straightforward McMC algorithms, and raises interesting issues of how best to test correctness in such cases. In the above we have concentrated on straightforward 2 tests and compatibility with simple theoretical asymptotics: [9] gives details of a pseudo-likelihood approach which deals directly with the coupled random processes lying at the heart of the sim- ulation. We hope to return to this issue in later work, as it has ramifications beyond perfect simulation in general issues of programming complicated simulations. Acknowledgements This research was supported by EPSRC grant GR/L56831 and by the EU TMR network ERB-FMRX-CT96-0095 on "Computational and Statistical methods for the analysis of spatial data". --R Asymptotic Techniques for use in Statistics. Efficient Markovian couplings: examples and counterexamples. Perfect implementation of simulation for conditioned Boolean model via correlated Poisson random variables. An interruptible algorithm for exact sampling via Markov Chains. On some weighted Boolean models. Perfect simulation for spatial point processes. Perfect simulation for the area-interaction point process Perfect implementation of a Metropolis-Hastings simulation of Markov point processes Perfect simulation of point processes using Metropolis-Hastings algorithms Perfect simulation in stochastic geometry. Exact sampling with coupled Markov chains and applications to statistical mechanics. Perfect simulation of some point processes for the impatient user. --TR --CTR James D. Brown , Gerard B. M. Heuvelink, The Data Uncertainty Engine (DUE): A software tool for assessing and simulating uncertain environmental variables, Computers & Geosciences, v.33 n.2, p.172-190, February, 2007
Markov chain Monte Carlo;correlated Poisson random variables conditioned to be positive;conditional Boolean model;perfect simulation;extended state-space CFTP;dominated CFTP
599486
An Efficient Partial Order Reduction Algorithm with an Alternative Proviso Implementation.
This paper presents a partial order reduction algorithm called Twophase that generates a significantly reduced state space on a large class of practical protocols over alternative algorithms in its class. The reduced state-space generated by Twophase preserves all CTL&ast;-X assertions. Twophase achieves this reduction by following an alternative implementation of the proviso step. In particular, Twophase avoids the in-stack check that other tools use in order to realize the proviso step. In this paper, we demonstrate that the in-stack check is inefficient in practice, and demonstrate a much simpler alternative method of realizing the proviso. Twophase can be easily combined with an on-the-fly model-checking algorithm to reduce memory requirements further. A simple but powerful selective caching scheme can also be easily added to Twophase.A version of Twophase using on-the-fly model-checking and selective caching has been implemented in a model-checker called PV (Protocol Verifier) and is in routine use on large problems. PV accepts a proper subset of Promela and a never automaton expressing the LTL-X assertion to be verified. PV has helped us complete full state-space search several orders of magnitude faster than all alternative tools available in its class on dozens of real protocols. PV has helped us detect bugs in real Distributed Shared Memory cache coherency protocols that were missed during incomplete search using alternate tools.
Introduction With the increasing scale of software and hardware systems and the corresponding increase in the number and complexity of concurrent protocols involved in their design, formal verification of concurrent protocols is an important practical need. Automatic verification of finite state systems based on explicit state enumeration methods [CES86, z Supported in part by a Graduate Fellowship from the University of Utah. Present address: Hewlett-Packard, Cupertino Systems Lab, Cupertino, CA, 95014 - [email protected] x Supported in part by DARPA under contract #DABT6396C0094 (Utah Verifier), and NSF grant CCR-9800928 c 2000 Kluwer Academic Publishers. Printed in the Netherlands. Hol91, Dil96, HP96, Hol97] has shown considerable promise in real-world protocol verification problems and has been used with success on many industrial designs [Hol97, DPN93]. Using most explicit state enumeration tools, a protocol is modeled as a set of concurrent processes communicating via shared variables and/or communication channels [HP96, Dil96]. The tool generates the state graph represented by the protocol and checks for the desired temporal properties on that graph. A common problem with this approach is that state graphs of most practical protocols are quite large and the size of the graph often increases exponentially with the size of the protocol, commonly referred to as state explosion. The interleaving model of execution used by these tools is one of the major causes of state explosion. This is shown through a simple example in Figure 1. Figure 1(a) shows a system with two processes P1 and P2 and Figure 1(b) shows the state space of this example. If the property under consideration does not involve at least one of the variables X and Y, then one of the two shaded states need not be generated, thus saving one state. A straightforward extension of this example to n processes would reveal that an interleaving model of execution would generate states where Partial order reductions attempt to bring such reductions by exploiting the fact that in realistic protocols there are many transitions that "commute" with each other, and hence it is sufficient to explore those transitions in any one order to preserve the truth value of the temporal property under consideration. In essence, from every state, a partial order reduction algorithm selects a subset of transitions to explore, whereas a normal graph traversal such as depth first search (DFS) algorithm would explore all transitions. Partial order reduction algorithms play a very important role in mitigating state explosion, often reducing the computational and memory cost by an exponential (a) Simple system000000000000000000111111111111111111000000000000000000111111111111111111 X:=0 (b) State graph Figure 1. A simple system and its state graph 2000rev.tex; 21/07/2000; 16:37; p. factor. This paper presents a new partial order reduction algorithm called Twophase, that in most practical cases outperforms existing implementations of the partial order reductions. The algorithm is implemented in a tool called PV (Protocol Verifier) that finds routine application in our research. The partial order reduction algorithm presented in [Pel96a, HP94] is implemented in the explicit state enumeration model checker SPIN 1 [HP96, Hol97] and in the implicit state exploration tools VIS and COSPAN [ABHQ97, KLM The algorithm presented in [God95] is implemented in the PO-PACKAGE tool. In general, partial order reduction algorithms must avoid the so called ignoring problem- the problem of infinitely postponing an action, resulting in an incorrect reduction-using some measure of progress. Partial order reduction algorithms generally solve the problem by using provisos, whose need was first recognized by Valmari [Val92]. The traditional way of implementing provisos (made clear momentarily) is to ensure that the subset of transitions selected at a state do not generate a state that is in the stack maintained by the DFS algorithm. If a subset of transitions satisfying this check cannot be found at a state s, then all transitions from s are executed by the DFS algorithm. The PO-PACKAGE algorithm (and also the algorithm presented in [HGP92]) requires that at least one of the selected transitions do not generate a state in the stack, whereas SPIN algorithm requires the stronger condition that no selected transition generates a state in the stack. The stronger proviso (hereafter abbreviated as proviso) is sufficient to preserve all stutter whereas the weaker proviso preserves only stutter free safety properties [HGP92, HP94, Pel93, Pel96a]. In the context of verifying reactive systems such as directory based coherence protocols and server-client protocols, we observed that the most commonly adopted method of implementing the proviso-namely an explicit in-stack check of the next state(s)-causes all existing partial order reduction algorithms to be ineffective [NG96]. As an example, on invalidate, a distributed shared memory protocol described later, SPIN aborts its search by running out of memory after generating more than 270,000 states when limited to 64MB memory usage, ultimately finishing in 961,089 states when allowed more memory. PO-PACKAGE also aborts its search after generating a similar number of states. In invalidate, there are many opportunities for partial order reductions to All references to SPIN in this paper refer to versions that existed in the public domain between the end of 1995, the first time Twophase was implemented within PV, and mid-1998, when most of the experiments comparing PV and SPIN were finished. reduce the complexity; hence, protocols of this complexity ought to be easy for on-the-fly explicit enumeration tools to handle. This intuition is confirmed by the fact that Twophase, a partial order reduction that does not use the in-stack check, finishes comfortably on this protocol within 64M main memory, generating only 27,600 states. In fact, as shown in Section 7, in all nontrivial examples, our implementation of Twophase in our model checker called PV [NG98b] outperforms in-stack checking based algorithms. Alternate Implementation of Provisos The term proviso is used to refer to condition - A5 of [Val96, Page 222] 2 , which, roughly speaking, states that every action enabled in a state s of the reduced state space is present in the stubborn set of a state s 0 of the reduced state-space reachable from s. The Twophase algorithm implements the proviso condition - A5 as follows. When it encounters a new state x, it expands the state using only deterministic transitions in its first phase (both these notions will be defined shortly), resulting in a state y. Deterministic transitions, equivalent to singleton ample sets [Pel96a], are those that can be taken at the state without effecting the truth of the property being verified. Then in the second phase, y is expanded completely. The need to cross-over from the first-phase to the second phase can be detected using a different (and much simpler) strategy than an in-stack check. This strategy provides Twophase all its advantages mentioned earlier. An important consequence of the above strategy is that Twophase naturally supports selective caching in conjunction with on-the-fly model checking. An explicit enumeration search algorithm typically saves the list of visited states in a hash table ("cached"). Since the number of visited states is large, it would be beneficial if not all visited states need to be stored in the hash table, referred to as selective caching. On-the- fly model checking means that the algorithm finds if the property is true or not as the state graph of the system is being constructed (as opposed to finding it only after the graph is completely constructed). It is difficult to combine the on-the-fly model checking algorithm, partial-order reductions, and selective-caching due to the need to share information among these three aspects. In [HPY96], it is shown that previous attempts at combining in-stack checking based algorithms with the on-the-fly algorithm presented in [CVWY90] have been er- roneous. However, thanks to the fact that the first phase of Twophase does not depend on the stack state, it can be combined easily with the When we use the colloquial or the plural form of the word "proviso," we will mean particular implementations, such as in-stack checks. on-the-fly algorithm presented in [CVWY90] and a simple but effective selective-caching strategy, as discussed in Sections 6 and 6.1. The rest of the paper is organized as follows. Section 2 presents related work. Section 3 presents definitions and background. Section 4 presents the basic depth-first search algorithm and the in-stack checking based partial order reduction algorithm. Section 5 presents the Twophase algorithm and its proof of correctness. Section 6 presents the on-the-fly model checking algorithm presented in [CVWY90] and discusses on how it can be combined with Twophase. This section also presents a very simple but effective selective caching strategy and shows how it can be incorporated into Twophase. Section 7 compares the performance of the algorithm [Pel96a] implemented in SPIN with that of Twophase implemented in the PV tool and provides a qualitative explanation of the results. Finally, Section 8 provides concluding remarks. 2. Related Work Lipton [Lip75] suggested a technique to avoid exploring the entire state graph to find if a concurrent system deadlocks. Lipton noted that execution of some transitions can be postponed as much as possible (right movers) and some transitions can be executed as soon as possible (left movers) without affecting the deadlocks. Partial order reductions can be considered as a generalization of this idea to verify richer properties than just deadlocks. In [GW92, GP93, God95], a partial order theory based on traces to preserve safety properties is presented. This work uses a slight variation of the proviso. In [Pel96a], a partial order reduction algorithm based on ample sets and the proviso is presented. In [HP94], an algorithm very similar to (and based on the algorithm of [Pel96a]) is given. This algorithm is implemented in SPIN. The algorithm in [Pel96a] is discussed in Section 4. In all these algorithms, the proviso is realized using an in-stack check. Valmari [Val92, Val93] has presented a technique based on stubborn sets to construct a reduced graph to preserve the truth value of all stutter free The Twophase algorithm was conceived at the end of 1995 in the context of verifying real distributed shared memory protocols used in the Avalanche processor [CKK96]. We first proved that Twophase preserved stutter-free safety properties [NG97a], and later extended the proof to LTL-X [NG97b, NG98a, Nal98]. The PV tool embodying Twophase was also demonstrated [NG98b]. Thanks to editorial comments received during the review of this paper, we now know that the condition 'deterministic' discovered by us to avoid the explicit in-stack check turns out to be the exact same condition required by CTL*-X (stutter free CTL*) preserving methods [GKPP95, Val96, Pel96b]. In fact, we now realize that Twophase ends up implementing conditions - A5 and - A8 of [Val96]. Thus, Twophase preserves CTL*-X, as argued in Section 5.1 referring to existing proofs. With these new insights, we can characterize our contributions as follows 1. An experimental characterization of the state explosion caused by the in-stack method. 2. A new partial order reduction algorithm called Twophase that uses an alternative proviso implementation to the in-stack method, thereby considerably mitigating state explosion. 3. Advantages of our method of realizing the proviso in terms of supporting selective caching and on-the-fly model-checking. 4. An extensive list of experiments that demonstrate the superior performance of the PV model-checker compared to other tools in its class. 3. Definitions and Notation A process oriented modeling language with each process maintaining a set of local variables that only it can access is assumed. The value of these local variables form the local state of the process. For convenience, each process is assumed to contain a distinguished local variable called program counter ("control state"). A concurrent system ("system") consists of a set of processes, a set of global variables, and point-to- point channels of finite capacity to facilitate communication among the processes. The global state ("state") consists of local states of all the processes, values of the global variables, and the contents of the channels. S denotes the set of all possible states ("syntactic state") of the system, obtained by taking the Cartesian product of the range of all variables (local variables, global variables, program counters, and the channels) in the system. The range of all variables (local, global, and channels) is assumed to be finite, hence S is also finite. Each program counter of a process is associated with a finite number of transitions. A transition of a process P can read/write the local variables of P , read/write the global variables, send a message on the 2000rev.tex; 21/07/2000; 16:37; p. channel on which it is a sender, and/or receive a message from the channel for which it is a receiver. A transition may not be enabled in some states (for example, a receive action on a channel is enabled only when the channel is nonempty). If a transition t is enabled in a state then it is uniquely defined. Nondeterminism can be simulated by having multiple transitions from a given program counter. t, t 0 are used to indicate transitions, s 2 S to indicate a state in the system, t(s) to indicate the state that results when t is executed from s, P to indicate a sequential process in the system, and pc(s,P ) to indicate the program counter (control state) of P in s, and pc(t) to indicate the program counter with which the transition t is associated. local: A transition (a statement) is said to be local if it does not involve any global variable. global: A transition is said to be global if it involves one or more global variables. Two global transitions of two different processes may or may not commute, whereas two local transitions of two different processes commute. A control state (program counter) of a process is said to be internal if all the transitions associated with it are local transitions. unconditionally safe: A local transition t is said to be unconditionally safe if, for all states s 2 S, if t is enabled (disabled) in s 2 S, then it remains enabled (disabled) in t 0 is any transition from another process. Note that if t is an unconditionally safe transition, by definition it is also a local transition. From this observation, it follows that executing t 0 and t in either order would yield the same state, i.e.t and t 0 commute. This property of commutativity forms the basis of the partial order reduction theories. Note that channel communication statements are not unconditionally safe: if a transition t in process P attempts to read and the channel is empty, then the transition is disabled; however, when a process Q writes to that channel, t becomes enabled. Similarly, if a transition t of process P attempts to send a message through a channel and the channel is full, then t is disabled; when a process Q consumes a message from the channel, t becomes enabled. conditionally safe: A conditionally safe transition t behaves like an unconditionally safe transition in some of the states characterized by a safe execution condition p(t) ' S. More formally, a local transition t of process P is said to be conditionally safe whenever, in state s 2 p(t), if t is enabled (disabled) in s, then t is also enabled (disabled) in t 0 is a transition of a process other than P . In other words, t and t 0 commute in states represented by p(t). Channel communication primitives are conditionally safe. If t is a receive operation on channel c, then its safe execution condition is "c is not empty." Similarly, if t is a send operation on channel c, then its safe execution condition is "c is not full." safe: A transition t is safe in a state s if t is an unconditionally safe transition or t is conditionally safe whose safe execution condition is true in s, i.e.s 2 p(t). deterministic: A process P is said to be deterministic in s, written deterministic(P, s), if the control state of P in s is internal, all transitions of P from this control state are safe, and exactly one transition of P is enabled. independent: Two transitions t and t 0 are said to be independent of each other iff at least one of the transitions is local, and they belong to different processes. The partial order reduction algorithms such as [Val92, Pel96a, HP94, God95] use the notion of ample set based on safe transitions. Twophase, on the other hand, uses the notion of deterministic-singleton ample sets-to obtain reductions. The proof of correctness of the Twophase algorithm uses the notion of independent transitions. 3.1. Linear temporal logic and B- uchii automaton A LTL-X formulae is a LTL formulae without the next time operator X. Formally, system LTL-X (linear-time logic without next time operator or stutter free LTL) is defined from atomic propositions means of boolean connectives, 2 ("always"), 3 ("eventually"), and U operators. If is an infinite sequence of states that assign a truth value to then the satisfaction relation ff j= OE is defined as follows: ff ff ff ff ff ff and If M is a concurrent system, then M j= OE is true iff for each sequence ff generated by M from the initial state, ff B-uchii automaton [vL90] are nondeterministic finite automata with an acceptance condition to specify which infinite word (!-word) is accepted by the automaton. Formally, a B-uchii automaton is a tuple is the set of the states, q 0 is the initial state, \Sigma is the input, \Delta ' Q \Theta \Sigma \Theta Q, and F ' Q is the set of final states. A run of A on an !-word is an infinite sequence of states \Delta. The sequence ff is accepted by A iff at least one state of F appears infinitely often in oe. The model checking problem, M may be viewed as an automata-theoretic verification problem, L(M) ' L(OE) where L(M) and L(OE) are languages accepted by M and the linear-time temporal formulae OE respectively. If an ! automaton such as the B-uchii automaton A :OE accepts the language L(OE), the verification problem of L(M) ' L(OE) can be answered by constructing the state graph of the synchronous product of M and A :OE , M\Omega A :OE . If any strongly connected components of the graph represented by S satisfies the acceptance condition of A :OE then and only then OE is violated in M [Kur94]. 4. Basic DFS and In-stack check Based Partial Order Reduction Algorithms Figure 2 shows the basic depth first search (DFS) algorithm used to construct the full state graph of a protocol. V f is a hash table ("visited") used to cache all the states that are already visited. Statement 1 shows that the algorithm expands all transitions from a given state. Statement shows how the algorithm constructs the state graph of the system in E f . Partial order reduction based search algorithms attempt to replace 1 by choosing a subset of transitions. The idea is that if two transitions t and t 0 commute with each other in a state s and if the property to be verified is insensitive to the execution order of t and t 0 , then the algorithm can explore t(s), postponing examination of t 0 to t(s). Of course, care must be exercised to ensure that no transition is postponed forever, commonly referred to as the ignoring problem. The algorithm in [Pel96a, HP94] is shown as dfs po Figure 3. As already mentioned, this algorithm is implemented in SPIN. This algorithm also uses ample(s) to select a subset of transitions to expand at each step. When ample(s) returns a proper subset of enabled transitions, the following conditions must hold: (a) the set of transitions returned commute with all other 2000rev.tex; 21/07/2000; 16:37; p. model-check() f f foreach enabled t in s do if endif endforeach Figure 2. Basic depth first search algorithm transitions, (b) none of the transitions result in a state that is currently being explored (as indicated by its presence in redset variable maintained by dfs po). The intuitive reasoning behind the condition (b) is that, if two states s and s 0 can reach each other, then without this condition s might delegate expansion of a transition to s 0 and vice versa; hence without this condition the algorithm may never explore that transition at all. Condition (b), sometimes referred to as reduction proviso or simply proviso, is enforced by the highlighted line in ample(s). If a transition, say t, is postponed at s, then it must be examined at a successor of s to avoid the ignoring problem. However, if t(s) is itself being explored (i.e.t(s) 2redset), then a circularity results if t(s) might have postponed t. To break the circularity, ample(s) ensures that t(s) is not in redset. As Section 6.1 shows later, the dependency of ample on redset to evaluate the set of transitions has some very important consequences when on-the-fly model checking algorithms are used. 4.1. Efficacy of partial order reductions The partial order reduction algorithm shown in Figure 3 can reduce the number of states by an exponential factor [HP94, Pel96a]. However, in many practical protocols, the reductions are not as effective as they can be. The reason can be traced to the implementation of the proviso using in-stack checking. This is motivated using the system shown in Figure 4. Figure 4(a) shows a system consisting of two sequential processes P1 and P2 that do not communicate at all; i.e.- with . The total number of states in this system is 9. The optimal reduced graph for this system contains 5 states, shown in Figure 4(b). Figure 4(c) shows the state graph generated by the partial order reduction algorithm in Figure 3. This graph is obtained as follows. The initial state is !s0,s0?. ample(!s0,s0?) may return either 2000rev.tex; 21/07/2000; 16:37; p. f /* Record in redset that s is partly expanded */ redset uses redset */ foreach transition t in ample(s) do if /* s is completely expanded. So remove from redset */ redset := redset-fsg; f for each process P do acceptable := true; T := all transitions t of P such that foreach t in T do if(t is global) or (t is enabled and (t is conditionally safe and s 62 p(t)) then acceptable := false; endif if acceptable and T has at least one enabled transition return enabled transitions in T; subset of transitions is found */ return all enabled transitions; Figure 3. Proviso based partial order reduction algorithm or f- 5 g. Without loss of generality, assume that it returns resulting in states !s1,s0? and !s2,s0?. Again, without loss of generality, assume that the algorithm chooses to expand !s1,s0? first, where transitions f- 2 g of P 1 and f- 5 of P 2 are enabled. - 2 (!s1,s0?) !s0,s0?, and when dfs po(!s1,s0?) is called, redset=f!s0,s0?g. As a result ample(!s1,s0?) cannot return f- 2 g; it returns f- 5 g. Executing - 5 from (!s1,s0?) results in !s1,s1?, the third state in the figure. Continuing this way, the graph shown in Figure 4(c) is obtained. Note that this system contains all 9 reachable states in the system, thus showing that an in-stack checking based partial order reduction algorithm might fail to bring appreciable reductions. As confirmed by the examples in Section 7, the algorithm may not bring much reductions in realistic protocols also. tt22 tt44 tt66 tt88 (a) System (b) Optimal Graph (c) Search order by dfs_po Figure 4. A simple example, its optimal reduced graph, and the reduced graph generated by dfs po 5. The Twophase Algorithm As the previous contrived example shows, the size of the reduced graph generated by an algorithm based on in-stack checking can be quite high. This is true even for realistic reactive systems. In most reactive systems, a transaction typically involves a subset of processes. For example, in a server-client model of computation, a server and a client may communicate without any interruption from other servers or clients to complete a transaction. After the transaction is completed, the state of the system is reset to the initial state. If the partial order reduction algorithm uses in-stack checking, state resetting cannot be done as the initial state will be in the stack until the entire reachability analysis is completed. Since at least one process is not reset, the algorithm generates unnecessary states, thus increasing the number of states visited, as already demonstrated in Figure 4. Section 7 will demonstrate that in realistic systems also the number of extra states generated due to the proviso can be high. The proposed algorithm is described in Figure 5. In the first phase (phase1), Twophase executes deterministic processes resulting in a state s. In the second phase, all enabled transitions at s are examined. The Twophase algorithm often outperforms SPIN (and PO-PACKAGE) as evidenced by the examples in Section 7. Note that phase1 is more gen- f (fully expanded) is used in proof */ f list := fsg; path := fg; foreach process P do while (deterministic(s, P)) Let t be the only enabled transition in P */ olds := s; path f(olds, t, s)g; goto NEXT-PROC; endif list := list /* next process */ return(path, s); f (path, s) := phase1(s); Phase 2: Classic DFS */ if s62V r then /* fe is used in proof */ all states in path foreach enabled transition t do if else all states in path; Figure 5. The Twophase algorithm eral than the notion of coarsening actions (for example, implemented as a d-step in SPIN). In coarsening, two or more actions of a given process are combined together to form a larger "atomic" operation. In phase1, actions of multiple processes are executed. 5.1. Correctness of the Twophase algorithm The correctness of Twophase follows from previous results. In particu- lar, Theorem 6.3 of [Val96] states that if conditions - A5 and - A8 hold, the reduced and the unreduced transition systems are branching-bisimilar. Here, condition - A5 states that every action enabled in a state s of the reduced state space is eventually in the stubborn set of a state s 0 of the reduced state-space that is reachable from s. This condition is easily satisfied by Twophase: those states attained at the end of phase1 are fully expanded in phase2 (fe in Figure 5 under Twophase records all those states that are fully expanded). Condition - A8 states that for every state s in the reduced state space, either its stubborn set contains all actions or there is an internal action a such that the stubborn set of s has exactly a enabled in s and further a is super-deterministic in s. The exact definition of super-determinism in the context of [Val96] may be found in that reference; in our context, super-determinism is what we defined as deterministic on Page 8. The correctness of Twophase can be understood also in terms of the proof in [Pel96b]. A proof of correctness of Twophase from first principles may be found in [Nal98]. 6. On-the-fly Model Checking A model checking algorithm is said to be on-the-fly if it examines the state graph of the system as it builds the graph to find the truth value of the property under consideration. If the truth value of the property can be evaluated by inspecting only a subgraph, then the algorithm need not generate the entire graph. Since the state graphs of many protocols are quite large, an on-the-fly model checking algorithm might be able to find errors in protocols that are otherwise impossible to analyze. As discussed in Section 3.1, the model checking problem M can be equivalently viewed as answering the question if the graph represented by M\Omega A :OE , the synchronous product of the model M and the B-uchii automaton representing :OE, does not contain any paths satisfying the acceptance condition of A :OE . The algorithms dfs and dfs po are not on-the-fly model checking algorithms since they construct the graph in E f or E r , which must be analyzed later to find if the acceptance condition of the B-uchii automaton A :OE is met or not. Note that E f and E r holds the information about the edges traversed as part of the search. The condition that there is an infinite path in E (E f or E r ) that satisfies the acceptance condition of A :OE can be equivalently expressed 2000rev.tex; 21/07/2000; 16:37; p. as there is a strongly connected component (SCC) in the graph that satisfies the acceptance condition. Tarjan [Tar72] presented a DFS based on-the-fly algorithm to compute SCCs without storing any edge information. Since space is at a premium for most verification problems, not having to store the edge information can be a major benefit of using this algorithm. This algorithm uses one word overhead per state visited and traverses the graph twice. The on-the-fly model checking algorithm of [CVWY90] is shown in Figure 6. This algorithm can be used to find if a graph has at least one infinite path satisfying a B-uchii acceptance condition. Note that whereas Tarjan's algorithm can find all strongly connected components that satisfy the acceptance condition of A :OE , the algorithm in [CVWY90] is guaranteed to find only one infinite path satisfying the acceptance condition. Since presence of such an infinite path implies that the property is violated, it is usually sufficient to find one infinite path. The attractiveness of the algorithm in [CVWY90] comes from the fact that it can be implemented with only one bit per state compared to one word per state in the case of Tarjan's algorithm. The algorithm consists of two DFS searches, dfs1 and dfs2. The outer dfs, dfs1, is very similar to dfs, except that instead of maintaining E f , the algorithm calls an inner dfs, dfs2, after an accept state is fully expanded. dfs2 finds if that accept state can reach itself by expanding the state again. If the state can reach it self, then a path violating OE can be found from the stack needed to implement dfs1 and dfs2. This figure assumes that full state graph is being generated. To use it along with partial order reductions, statements labeled 1 in dfs1(s) and dfs2(s) can be appropriately modified to use the transitions in (when used in conjunction with dfs po) or with the search strategy of Twophase. Earlier attempts at combining this on-the-fly model checking algorithm with the dfs po have been shown to be incorrect in [HPY96]. The reason is that ample(s) depends on redset; hence when a state s is expanded on lines indicated by 1 in dfs1 and dfs2, ample(s) might evaluate to different values. If ample(s) returns a different set of transitions in dfs1 and dfs2, even if an accept state s is reachable from itself in the graph constructed by dfs1, dfs2 might not be able to prove that fact. Since the information in redset is different for dfs1 and dfs2, ample(s) may indeed return different transitions, leading to an incorrect implementation. [HPY96] solves the problem using the following scheme: ample(s) imposes an ordering on the processes in the system. When ample(s) cannot choose a process, say due to the proviso, they choose ample(s) to be equal to all enabled transitions of s. In addition, one bit of information is recorded in V1 to indicate that s is completely expanded. When s is en- f /* outer dfs */ f foreach enabled-transition t do if if s is an accept state /* Call nested dfs */ and s 62 V2 then seed := s; /* inner dfs */ f foreach enabled transition t do if t(s)=seed then error(); elseif then dfs2(t(s)); Figure 6. An on-the-fly model checking algorithm countered as part of dfs2, this bit is inspected to find if ample(s) must return all enabled transitions or if it must return a subset of transitions without requiring the proviso. This strategy reduces the opportunities for obtaining effective reductions, but it is deemed a good price to pay for the ability to use the on-the-fly model checking algorithm. Thanks to the independence of phase1 on global variables, including when phase1(s) is called in dfs2, the resulting state is exactly same as when it is called in dfs1. Hence the on-the-fly model checking algorithm can be used easily in conjunction with Twophase. In Section 6.2, it is argued that the combination of this on-the-fly model checking algorithm, the selective caching technique can be used directly with Twophase. 6.1. Selective caching Both Twophase and dfs po, when used in conjunction with the above on-the-fly model checking algorithm, obviate the need to maintain E r . However, memory requirements to hold V r , for most practical protocols, can be still quite high. Selective caching refers to the class of techniques where instead of saving every state visited in V r , only a subset of states are saved. There is a very natural way to incorporate selective caching into Twophase. Instead of adding all states of path to V r (line 1 in Twophase) only s can be added. This guarantees that a given state always generates the same subgraph beneath it whether it is expanded as part of outer dfs or inner dfs; hence the above on-the-fly model checking algorithm can still be used. Adding s instead of list also means that the memory used for list in phase1 can be reused. Even the memory required to hold the intermediate variable list can be reduced: the reason for maintaining this variable is only to ensure that the while loop terminates. This can be still guaranteed if instead of adding s to list unconditionally, it is added only if "s!olds," where ! is any total ordering on S. PV uses bit-wise comparison as !. 6.2. Combining on-the-fly model checking and selective caching with Twophase When the selective caching technique is combined with Twophase, the execution goes as follows: a given state is first expanded by phase1, then the resulting state is added to V r and fully expanded. In other contains only fully expanded states, which implies that the state graph starting a given state is the same in dfs1 and dfs2 of the on-the-fly algorithm. Hence, the on-the-fly algorithm and selective caching can be used together with Twophase. 7. Experimental Results As already mentioned, Twophase outperforms the algorithm dfs po (implemented in SPIN) when in-stack checking succeeds often, as confirmed by the results in Table I 3 . This table shows results of running dfs po and Twophase (with and without selective caching enabled) on various protocols. The column corresponding to dfs po shows the number of states entered in V r and the time taken in seconds by SPIN 4 . The column "all" column in Twophase shows the number of states in V r and the time taken in seconds when Twophase is run without the selective caching. The "Selective" column in Twophase shows the 3 All these examples as well as the PV tool distribution are available in the web URL www.cs.utah.edu/formal verification. 4 These experiments were run versions of SPIN available during 1997-98. number of states entered in V r or list and time taken in seconds when Twophase is run with the selective caching. All verification runs are conducted on an Ultra-SPARC-1 with 512MB of DRAM. Contrived examples: B5 is the system shown in Figure 4(a) with processes. W5 is a contrived example to show that Twophase does not always outperform the dfs po. This system has no deterministic states; hence Twophase degenerates to a full search, whereas dfs po can find significant reductions. SC is a server/client protocol. This protocol consists of n servers and n clients. A client chooses a server and requests for a service. A service consists of two round trip messages between server and client and some local computations. dfs po cannot complete the graph construction for 4, when the memory is limited to 64MB; when the memory limit is increased to 128MB it generates 750k states. protocols: Mig and inv are two cache coherency protocols used in the implementation of distributed shared memory (DSM) using a directory based scheme in Avalanche multiprocessor [CKK96]. In a directory based DSM implementation, each cache line has a designated node that acts as its home-a node that is responsible for maintaining the coherency of the line. When a node needs to access the line, if it does not have the required permissions, it contacts the home node to obtain the permissions. Both mig and inv have two cache lines and four processes; two processors act as home nodes for the cache lines and the other two processors access the cache lines. Both algorithms can complete the analysis of Mig within 64MB of main memory, albeit with Twophase performing much better. On inv, a much more involved coherence protocol, dfs po requires 128MB of memory. Twophase on the other hand finishes comfortably generating a modest 27,600 states (with selective caching) or 60,736 states (without selective caching) within 64MB of main memory. Protocols in the SPIN distribution: Pftp and snoopy protocols are provided as part of SPIN distribution. On pftp, dfs po generates fewer states than Twophase without state caching. The reason is that there is very little determinism in this protocol. Since Twophase depends on determinism to bring reductions, it generates a larger state space. However, with state caching, the number of states in the hash table goes down by a factor of 2.7. On snoopy, even though Twophase generates fewer states, the number of states generated by dfs po and Twophase (without selective caching) are too close to obtain any meaningful con- clusions. The reason for this is twofold. First, this protocol contains some determinism, which helps Twophase. However, there are a number of deadlocks in this protocol. Hence, the proviso is not invoked many times. Hence the number of states generated is very close. Table I. Number of states visited and the time taken in seconds by the dfs po algorithm and Twophase algorithm on various protocols Protocol dfs po Twophase all Selective Mig 113,628/14 22,805/2.6 9,185/1.7 Inv 961,089/37 60,736/5.2 27,600/3.0 Snoopy 16,279/4.4 14,305/2.7 8,611/2.4 UPO 4.9e+06/210 733,546/32 176,618/21 ROWO 5.2e+06/330 868,665/44 222,636/32 Memory model verification examples: We modeled the Hewlett-Packard Precision Architecture (HPPA) split-transaction coherent bus called Runway [BCS96, GGH + 97], a modern symmetric multiprocessor interconnect bus, in the common subset of Promela supported by the PV tool and SPIN. Then, we applied our approach to verify memory orderings via finite-state reachability analysis (described in [Nal98, Col92, GMNG98, NGMG98]) on this Runway bus model. Our method to establish a given memory ordering such as write atomicity (WA), uniprocessor order (UPO), read-order (RO), or read and write order (ROWO) involves writing highly non-deterministic 'test au- tomata' to drive the bus, and verifying that the execution never causes the test automata to enter one of their error states. On these protocols, the number of states saved by dfs po is approximately 25 times larger than the number of states saved by Twophase (with selective caching). 8. Conclusion We presented a new partial order reduction algorithm Twophase that implements the proviso without using in-stack checking. The correctness of Twophase was shown to follow from earlier results in CTL -X preserving partial-order reduction methods. We also showed how the algorithm can be combined with an on-the-fly model-checking algo- rithm. Through an extensive set of experiments, we demonstrated that Twophase outperforms those algorithms that realize the proviso using in-stack checking, where the in-stack check succeeds often. Twophase also naturally lends itself to be used in conjunction with a simple yet powerful selective caching scheme. Twophase is implemented in a model-checker called PV, and is available upon request. --R Automatic verification of finite-state concurrent systems using temporal logic specifications ACM Transactions on Programming Languages and Systems Reasoning About Parallel Architectures. Memory efficient algorithms for the verification of temporal properties. The stanford murphi verifier. A partial order approach to branching time logic model checking. "test model-checking" Refining dependencies improves partial-order verification methods Using partial orders for the efficient verification of deadlock freedom and safety properties. Coverage preserving reduction strategies for reachability analysis. Design and Validation of Computer Protocols. The model checker spin. An improvement in formal ver- ification Holzmann and On nested depth first search. Formal design and verification methods for shared memory systems. Partial order reduction without the proviso. A new partial order reduction algorithm for concurrent system verification. a model-checker for verifying ltl-x properties A partial order reduction algorithm without the proviso. An explicit enumeration model-checker The 'test model-checking' approach to the verification of formal memory models of multiprocessors. Translation between S/R and Promela. All from one Combining partial order reductions with on-the-fly model- checking Partial order reduction: Linear and branching temporal logics and process algebras. A stubborn attack on state explosion. Stubborn set methods for process algebras. Handbook of Theoretical Computer Science --TR Automatic verification of finite-state concurrent systems using temporal logic specifications Design and validation of computer protocols Reasoning about parallel architectures Formal specification of abstract memory models A stubborn attack on state explosion Computer-aided verification of coordinating processes The Model Checker SPIN A new partial order reduction algorithm for concurrent system verification Stubborn set methods for process algebras Partial order reduction Verifying hardware in its software context Using MYAMPERSANDldquo;test model-checkingMYAMPERSANDrdquo; to verify the Runway-PA8000 memory model Reduction Handbook of Theoretical Computer Science Coverage Preserving Reduction Strategies for Reachability Analysis An improvement in formal verification Formal modeling and validation applied to a commercial coherent bus The ''Test Model-Checking'' Approach to the Verification of Formal Memory Models of Multiprocessors Memory Efficient Algorithms for the Verification of Temporal Properties All from One, One for All On-the-Fly Verification with Stubborn Sets Refining Dependencies Improves Partial-Order Verification Methods (Extended Abstract) Combining Partial Order Reductions with On-the-fly Model-Checking The State of SPIN Using Partial Orders for the Efficient Verification of Deadlock Freedom and Safety Properties A partial order approach to branching time logic model checking Formal design and verification methods for shared memory systems --CTR Madanlal Musuvathi , Shaz Qadeer, Iterative context bounding for systematic testing of multithreaded programs, ACM SIGPLAN Notices, v.42 n.6, June 2007 Twan Basten , Dragan Bonaki , Marc Geilen, Cluster-Based Partial-Order Reduction, Automated Software Engineering, v.11 n.4, p.365-402, October 2004
explicit enumeration;partial order reductions;concurrent protocol verification;proviso;temporal logic;on-the-fly model-checking;in-stack checking
599488
An Improvement of McMillan''s Unfolding Algorithm.
McMillan has recently proposed a new technique to avoid the state explosion problem in the verification of systems modelled with finite-state Petri nets. The technique requires to construct a finite initial part of the unfolding of the net. McMillan's algorithm for this task may yield initial parts that are larger than necessary (exponentially larger in the worst case). We present a refinement of the algorithm which overcomes this problem.
Introduction In a seminal paper [10], McMillan has proposed a new technique to avoid the state explosion problem in the verification of systems modelled with finite-state Petri nets. The technique is based on the concept of net un- folding, a well known partial order semantics of Petri nets introduced in [12], and later described in more detail in [4] under the name of branching processes. The unfolding of a net is another net, usually infinite but with a simpler structure. McMillan proposes an algorithm for the construction of a finite initial part of the unfolding which contains full information about the reachable states. We call an initial part satisfying this property (in fact slightly stronger one) a finite complete prefix. He then shows how to use these prefixes for deadlock detection. The unfolding technique has been later applied to other verification prob- lems. In [7, 8, 11] it is used to check relevant properties of speed independent circuits. In [5], an unfolding-based model checking algorithm for a simple branching time logic is proposed. Although McMillan's algorithm is simple and elegant, it sometimes gen- Institut f?r Informatik, Technische Universit?t M-unchen. E-mail: [email protected]. Partially supported by the Teilprojekt A3 SAM of the Sonderforschungsbereich 342 "Werkzeuge und Methoden f?r die Nutzung paralleler Rechnerarchitekturen". y Institut f?r Mathematik, Universit?t Augsburg. E-mail: [email protected]. J. Esparza, S. R-omer, W. Vogler erates prefixes much larger than necessary. In some cases a minimal complete prefix has O(n) in the size of the Petri net, while the algorithm generates a prefix of size O(2 n ). In this paper we provide an algorithm which generates a minimal complete prefix (in a certain sense to be defined). The prefix is always smaller than or as large as the prefix generated with the old algorithm. The paper is organised as follows. Section 2 contains basic definitions about Petri nets and branching processes. In Section 3 we show that McMil- lan's algorithm is just an element of a whole family of algorithms for the construction of finite complete prefixes. In Section 4 we select an element of this family, and show that it generates minimal prefixes in a certain sense. Finally, in Section 5 we present experimental results. 2 Basic Definitions 2.1 Petri Nets A triple (S; T; F ) is a net if The elements of S are called places, and the elements of T transitions. Places and transitions are generically called nodes. We identify F with its characteristic function on the set (S \Theta T ) [ (T \Theta S). The preset of a node x, denoted by ffl x, is the set fy 1g. The postset of x, denoted by x ffl , is the set fy 1g. A marking of a net (S; T; F ) is a mapping S ! IN . We identify a marking M with the multiset containing M (s) copies of s for every s 2 S. A 4-tuple net system if (S; T; F ) is a net and M 0 is a marking of (called the initial marking of \Sigma). A marking M enables a transition is enabled at M , then it can occur, and its occurrence leads to a new marking M 0 (denoted M t defined by for every place s. A sequence of transitions is an occurrence sequence if there exist markings M 1 , M 2 , . , Mn such that \Gamma! Mn Mn is the marking reached by the occurrence of oe, also denoted by M 0 oe \Gamma! . M is a reachable marking if there exists an occurrence sequence oe such that M 0 oe \Gamma! M . The reachability graph of a net system \Sigma is a labelled graph having the set of reachable markings of \Sigma as nodes and the relations t \Gamma! between markings as edges. marking M of a net is n-safe if M for every place s. We identify 1-safe markings with the set of places s such that M net system \Sigma is n-safe if all its reachable markings are n-safe. An Improvement of McMillan's Unfolding Algorithm 3 In this paper we consider only net systems satisfying the following two additional properties: ffl The number of places and transitions is finite. Every transition of T has a nonempty preset and a nonempty postset. 2.2 Occurrence Nets be a net and let x 1 , x 2 . The nodes x 1 and x 2 are in conflict, denoted by x 1 #x 2 , if there exist distinct transitions t 1 , that belong to the reflexive and transitive closure of F . In other words, x 1 and x 2 are in conflict if there exist two paths leading to x 1 and x 2 which start at the same place and immediately diverge (although later on they can converge again). For x 2 S [T , x is in self-conflict if x#x. An occurrence net is a net ffl for every b 2 B, j ffl bj - 1, ffl F is acyclic, i.e. the (irreflexive) transitive closure of F is a partial order, ffl N is finitely preceded, i.e., for every x the set of elements belongs to the transitive closure of F is finite, and ffl no event e 2 E is in self-conflict. The elements of B and E are called conditions and events, respectively. Min(N ) denotes the set of minimal elements of B [ E with respect to the transitive closure of F . The (irreflexive) transitive closure of F is called the causal relation, and denoted by !. The symbol - denotes the reflexive and transitive closure of F . Given two nodes nor x#y. 2.3 Branching Processes Branching processes are "unfoldings" of net systems containing information about both concurrency and conflicts. They were introduced by Engelfriet in [4]. We quickly review the main definitions and results of [4]. be two nets. A homomorphism from N 1 to N 2 1 is a mapping In [4], homomorphisms are defined between net systems, instead of between nets, but this is only a small technical difference without any severe consequence. 4 J. Esparza, S. R-omer, W. Vogler 1. A net system and two of its branching processes ffl for every t 2 T 1 , the restriction of h to ffl t is a bijection between ffl t (in In other words, a homomorphism is a mapping that preserves the nature of nodes and the environment of transitions. A branching process of a net system ) is an occurrence net, and p is a homomorphism from N 0 to N such that (i) The restriction of p to Min(N 0 ) is a bijection between Min(N 0 ) and (ii) for every e 1 Figure 1 shows a 1-safe net system (part (a)), and two of its branching processes (parts (b) and (c)). Two branching processes of a net system are isomorphic if there is a bijective homomorphism h from N 1 to N 2 such that Intuitively, two isomorphic branching processes differ only in the names of conditions and events. It is shown in [4] that a net system has a unique maximal branching process up to isomorphism. We call it the unfolding of the system. The unfolding of the 1-safe system of Figure 1 is infinite. be two branching processes of a net system. fi 0 is a prefix of fi if N 0 is a subnet of N satisfying ffl if a condition belongs to N 0 , then its input event in N also belongs to N 0 , and An Improvement of McMillan's Unfolding Algorithm 5 ffl if an event belongs to N 0 , then its input and output conditions in N also belong to N 0 . and p 0 is the restriction of p to N 0 . 2.4 Configurations and Cuts A configuration C of an occurrence net is a set of events satisfying the following two conditions: causally closed). of conditions of an occurrence net is a co-set if its elements are in co relation. A maximal co-set B 0 with respect to set inclusion is called a cut. Finite configurations and cuts are tightly related. Let C be a finite configuration of a branching process p). Then the co-set Cut(C), defined below, is a cut: In particular, given a finite configuration C the set of places p(Cut(C)) is a reachable marking, which we denote by Mark(C). marking M of a system \Sigma is represented in a branching process fi of \Sigma if fi contains a finite configuration C such that Mark . It is easy to prove using results of [1, 4] that every marking represented in a branching process is reachable, and that every reachable marking is represented in the unfolding of the net system. For 1-safe systems, we have the following result, which will be later used in Section 4: Proposition 2.1 be two nodes of a branching process of a 1-safe net system. If x 1 co x 2 , then Given a cut c of a branching process as the is the unique subnet of N whose set of nodes is is the restriction of p to the nodes of N 0 . Further, we define p(c) as the multiset containing an instance of the place p(b) for every b 2 c. The following result will also be used later: Proposition 2.2 If fi is a branching process of (N; M 0 ) and c is a cut of fi, then * c is a branching process of (N; p(c)). 2.2 6 J. Esparza, S. R-omer, W. Vogler 3 An Algorithm for the Construction of a Complete Finite Prefix 3.1 Constructing the Unfolding We give an algorithm for the construction of the unfolding of a net system. First of all, let us describe a suitable data structure for the representation of branching processes. We implement a branching process of a net system \Sigma as a list of nodes. A node is either a condition or an event. A condition is a pair (s; e), where s is a place of \Sigma and e the input event. An event is a pair (t; B), where t is a transition of \Sigma, and B is the set of input conditions. Notice that the flow relation and the labelling function of a branching process are already encoded in its list of nodes. How to express the notions of causal relation, configuration or cut in terms of this data structure is left to the reader. The algorithm for the construction of the unfolding starts with the branching process having the conditions corresponding to the initial marking of \Sigma and no events. Events are added one at a time together with their output conditions. We need the notion of "events that can be added to a given branching process". Definition 3.1 be a branching process of a net system \Sigma. The possible extensions of fi are the pairs (t; B), where B is a co-set of conditions of fi and t is a transition of \Sigma such that t, and ffl fi contains no event e satisfying PE (fi) denotes the set of possible extensions of fi. 3.1 Procedure 3.2 The unfolding algorithm input: A net system output: The unfolding Unf of \Sigma. begin pe := PE (Unf ); while pe 6= ; do append to Unf an event of pe and a condition (s; e) for every output place s of t; pe := PE (Unf ) endwhile An Improvement of McMillan's Unfolding Algorithm 7 (a) 2. A 1-safe net system, its unfolding, and a prefix The procedure does not necessarily terminate. In fact, it terminates if and only if the input system \Sigma does not have any infinite occurrence sequence. It will eventually produce any reachable marking only under the fairness assumption that every event added to pe is eventually chosen to extend Unf (the correctness proof follows easily from the definitions and from the results of [4]). Constructing a Finite Complete Prefix We say that a branching process fi of a net system \Sigma is complete if for every reachable marking M there exists a configuration C in fi such that: ffl Mark (i.e., M is represented in fi), and ffl for every transition t enabled by M there exists a configuration C[feg such that 2 C and e is labelled by t. The unfolding of a net system is always complete. A complete prefix contains as much information as the unfolding, in the sense that we can construct the unfolding from it as the least fixpoint of a suitable operation. This property does not hold if we only require every reachable marking to be represented. For instance, the net system of Figure 2(a) has Figure 2(b) as unfolding. Figure 2(c) shows a prefix of the unfolding in which every reachable marking is represented. The prefix has lost the information indicating that t 2 can occur from the initial marking. Observe that the prefix is not complete. Since an n-safe net system has only finitely many reachable markings, its unfolding contains at least one complete finite prefix. We transform the algorithm above into a new one whose output is such a prefix. We need some preliminary notations and definitions: Given a configuration C, we denote by C \Phi E the fact that C [ E is a configuration such that C " We say that is an extension of C, and that E is a suffix to C. Obviously, if C ae C 0 then there is a suffix of C such that C \Phi Let C 1 and C 2 be two finite configurations such that Mark (C 1 It follows easily from the definitions that * Cut(C i ) is isomorphic to the 8 J. Esparza, S. R-omer, W. Vogler unfolding of \Sigma are isomorphic. Moreover, there is an isomorphism I C2 C1 from *Cut(C 1 ) to *Cut (C 2 ). This isomorphism induces a mapping from the finite extensions of C 1 onto the extensions of C1 (E). We can now introduce the three basic notions of the algorithm: Definition 3.3 A partial order OE on the finite configurations of a branching process is an adequate order if: ffl OE is well-founded, ffl OE refines ae, i.e. C ffl OE is preserved by finite extensions, meaning that if C 1 OE C 2 and C1 (E).Definition 3.4 Local configuration The local configuration [e] of an event of a branching process is the set of events e 0 such that e 0 - e. 2 3.4 Definition 3.5 Cut-off event Let fi be a branching process and let OE be an adequate partial order on the configurations of fi. An event e is a cut-off event (with respect to OE) if fi contains a local configuration [e 0 ] such that (a) (b) [e].The new algorithm has as parameter an adequate order OE, i.e. every different adequate order leads to a different algorithm. Algorithm 3.6 The complete finite prefix algorithm input: An n-safe net system g. output: A complete finite prefix Fin of Unf. begin Fin pe := PE cut-off := ;; 2 It is immediate to prove that [e] is a configuration. An Improvement of McMillan's Unfolding Algorithm 9 while pe 6= ; do choose an event in pe such that [e] is minimal with respect to OE; if [e]" append to Fin the event e and a condition (s; e) for every output place s of t; pe := PE if e is a cut-off event of Fin then cut-off := cut-off [feg endif else pe := pe n feg endif endwhile endMcMillan's algorithm in [10] corresponds to the order It is easy to see that OE m is adequate. The reason of condition (a) in the definition of cut-off event is intuitively clear in the light of this algorithm. Since Mark ([e 0 Mark([e]), the continuations of Unf from Cut([e]) and Cut([e 0 ]) are isomorphic. Then, loosely speaking, all the reachable markings that we find in the continuation of Unf from Cut([e]) are already present in the continuation from Cut([e 0 ]), and so there is no need to have the former in Fin. The r-ole of condition (b) is more technical. In fact, when McMillan's algorithm is applied to "ordinary" small examples, condition (b) seems to be superfluous, and the following strategy seems to work: if an event e is added and Fin already contains a local configuration [e 0 ] such that Mark mark e as cut-off event. The following example (also independently found by K. McMillan) shows that this strategy is incorrect. Consider the 1-safe net system of Figure 3. The marking fs 12 g is reachable. Without condition (b) we can generate the prefix of Figure 4. The names of the events are numbers which indicate the order in which they are added to the prefix. The events 8 and 10 are cut-off events, because their corresponding markings fs 7 are also the markings corresponding to the events 7 and 9, respectively. This prefix is not complete, because fs 12 g is not represented in it. Observe that Fin contains all the events of the set cut-off. We could modify the algorithm to remove all these events, and the prefix so obtained would still enjoy the property that every reachable marking is represented in it. However, the prefix would not be necessarily complete. Consider for J. Esparza, S. R-omer, W. Vogler 3. A 1-safe net system example the net system of Figure 2(a). Algorithm 3.6 generates the branching process of Figure 2(b), and one of the two events of the process (the maximal one with respect to OE) is a cut-off event. If this event is removed, we obtain an incomplete prefix. We now prove the correctness of Algorithm 3.6. Proposition 3.7 Fin is finite. Proof: Given an event e of Fin, define the depth of e as the length of a longest chain of events the depth of e is denoted by d(e). We prove the following results: (1) For every event e of Fin, d(e) is the number of reachable markings of \Sigma. Since cuts correspond to reachable markings, every chain of events contains two events e i , and OE refines ae, we have is a cut-off event of Unf. Should the finite prefix algorithm generate e j , then it has generated e i before and e j is recognized as a cut-off event of Fin, too. (2) For every event e of Fin, the sets ffl e and e ffl are finite. By the definition of homomorphism, there is a bijection between denotes the homomorphism of Fin, and similarly for ffl p(e) and p( ffl e). The result follows from the finiteness of N . An Improvement of McMillan's Unfolding Algorithm 11 4. A prefix of the net system of Figure 3 (3) For every k - 0, Fin contains only finitely many events e such that d(e) - k. By complete induction on k. The base case, be the set of events of depth at most k. We prove that if g. By (2) and the induction hypothesis, k is finite. Since ffl E k+1 ' we get by property (ii) in the definition of a branching process that E k+1 is finite. It follows from (1) and (3) that Fin only contains finitely many events. By (2) it contains only finitely many conditions. 3.7 Proposition 3.8 Fin is complete. Proof: We first prove that every reachable marking of \Sigma is represented in Fin. Let M be an arbitrary reachable marking of \Sigma. There exists a configuration C of Unf such that Mark If C is not a configuration of Fin, then it contains some cut-off event e, and so set of events E. By the definition of a cut-off event, there exists a local configuration [e 0 ] such that [e 0 ] OE [e] and Mark ([e 0 Consider the configuration C [e] (E). Since OE is preserved by finite extensions, we have C 0 OE C. Morever, Mark(C 0 C 0 is not a configuration of Fin, then we can iterate the procedure J. Esparza, S. R-omer, W. Vogler and find a configuration C 00 such that C 00 OE C 0 and Mark (C 00 The procedure cannot be iterated infinitely often because OE is well- founded. Therefore, it terminates in a configuration of Fin. Now we show that Fin is complete. We have to prove that for every reachable marking M there exists a configuration C in fi such that: ffl for every transition t enabled by M there exists a configuration 2 C and e is labelled by t. Let M be an arbitrary reachable marking of \Sigma. Since M is represented in Fin, the set of configurations C of Fin satisfying Mark(C) nonempty. By well-foundedness, this set has at least a minimal element Cm with respect to OE. If Cm would contain some cut-off event, then we would find as above another configuration C 0 satisfying which contradicts the minimality of Cm . So Cm contains no cut-off event. Let t be an arbitrary transition enabled by M . Then there exists a configuration Cm [ feg of Unf such that 2 Cm and e is labelled by t. Assume that Cm [ feg is not a configuration of Fin. Since Fin contains all the events of the set cut-off in Algorithm 3.6, it also contains a cut-off event e 0 ! e. This implies e 0 2 Cm , which contradicts that Cm contains no cut-off event. So Cm [ feg is a configuration of Fin. 3.8 4 An Adequate Order for the 1-Safe Case As we mentioned in the introduction, McMillan's algorithm may be inefficient in some cases. An extreme example, due to Kishinevsky and Taubin, is the family of systems on the left of Figure 5. While a minimal complete prefix has size O(n) in the size of the system (see the dotted line in Figure 5), the branching process generated by McMillan's algorithm has size O(2 n ). The reason is that, for every marking M , all the local configurations [e] satisfying have the same size, and therefore there exist no cut-off events with respect to McMillan's Our parametric presentation of Algorithm 3.6 suggests how to improve this: it suffices to find a new adequate order OE r that refines McMillan's . Such an order induces a weaker notion of cut-off event; more precisely, every cut-off event with respect to OE m is also a cut-off event with respect to OE r , but maybe not the other way round. Therefore, the instance of Algorithm 3.6 which uses the new order generates at least as many cut-off events as McMillan's instance, and maybe more. In the latter case, Algorithm 3.6 generates a smaller prefix. An Improvement of McMillan's Unfolding Algorithm 13 sk sk sk sk sk copies of sk Minimal complete prefix 5. A Petri net and its unfolding The order OE r is particularly good if in addition it is total. In this case, whenever an event e is generated after some other event e 0 such that Mark [e] (because events are generated in accordance with the total order OE r ), and so e is marked as a cut-off event. So we have the following two properties: ffl the guard "e is a cut-off event of Fin" in the inner if instruction of Algorithm 3.6 can be replaced by "Fin contains a local configuration ffl the number of events of the complete prefix which are not cut-off events cannot exceed the number of reachable markings. In the sequel, let fixed net system, and let - be an arbitrary total order on the transitions of \Sigma. We extend - to a partial order on sets of events of a branching process as follows: for a set E of events, let '(E) be that sequence of transitions which is ordered according to - and contains each transition t as often as there are events in E with label t. Now we say that they have the same length but '(E 1 ) is lexicographically smaller than '(E 2 ). Note that E 1 and are incomparable with respect to - iff In particular, if are incomparable with respect to -, then jE We now define OE r more generally on suffixes of configurations of a branching process (recall that a set of events E is a suffix of a configuration if there exists a configuration C such that C \Phi E). Definition 4.1 Total order OE r be two suffixes of configurations of a branching process fi and let Min(E 1 ) and Min(E 2 ) denote the sets of minimal elements of with respect to the causal relation. We say 14 J. Esparza, S. R-omer, W. Vogler ).Notice that this definition would not be correct for configurations only, because need not be a configuration even if E is one. The second condition of this definition could be expressed as: the Foata- Normal-Form of E 1 is smaller than that of E 2 with respect to -, cf. e.g. [3]. Theorem 4.2 Let fi be a branching process of a 1-safe net system. OE r is an adequate total order on the configurations of fi. Proof: a) OE r is a partial order. It is easy to see by induction on jEj that OE r is irreflexive. Now assume For such triples with these equalities we apply induction on the otherwise we apply induction to E i n Min(E i ), which are also suffixes of configurations. r is total on configurations. Assume that C 1 and C 2 are two incomparable configurations, i.e. prove by induction on jC 1 The base case gives C We first prove Min(C 1 Assume without loss of generality that contains an event e 2 such that p(e 1 and ffl Min(C 2 ) are subsets of Min(N ), and all the conditions of different labels by Proposition 2.1, we have ffl e This contradicts condition (ii) of the definition of branching process. are configurations of the branching process *Cut(Min(C 1 )) of (Proposition 2.2); by induction we conclude c) OE r is well-founded. In a sequence C the size of the C i cannot decrease infinitely often; also, for configurations of the same size, An Improvement of McMillan's Unfolding Algorithm 15 decrease infinitely often with respect to -, since the sequences are drawn from a finite set; an analogous statement holds for Min(C i ). Hence, we assume that all jC i j, all '(C i ) and all '(Min(C i are equal and apply induction on the common size. For jC 0, an infinite decreasing sequence is impos- sible. Otherwise, we conclude as in case b) that we would have which is impossible by induction. d) OE r refines ae. Obvious. OE r is preserved by finite extensions. This is the most intricate part of the proof, and here all the complications in Definition 4.1 come into play. Take C 1 OE r C 2 with Mark We have to show that C 1 \Phi I C2 C1 (E), and we can assume that apply induction af- terwards. The case C 1 - C 2 is easy, hence assume '(C 1 and in particular jC show first that e is minimal in only if I C2 C1 (e) is minimal in C 0 (e)g. let e be minimal in C 0 i.e. the transition p(e) is enabled under the initial marking. Let s 2 ffl p(e); then no condition in ffl 1 is labelled s, since these conditions would be in co relation with the s-labelled condition in ffl e, contradicting Proposition 2.1. Thus, C 1 contains no event e 0 with s 2 ffl p(e 0 ), and the same holds for C 2 since Therefore, the conditions in Cut(C 2 ) with label in ffl p(e) are minimal conditions of fi, and I C2 . The reverse implication holds analogously, since about C 1 and C 2 we have only used the hypothesis '(C With this knowledge about the positions of e in C 0 1 and I C2 C1 (e) in C 0 we proceed as follows. If then we now see that so we are done. If '(Min(C 1 and e 2 Min(C 0 hence C 0 2 . Finally, if '(Min(C 1 1 ), we again argue that Min(C 1 are configurations of the branching process with an inductive argument we get C 0 are also done in this case. 4.2 We close this section with a remark on the minimality of the prefixes generated by the new algorithm, i.e. by Algorithm 3.6 with OE r as adequate order. Figure 1(b) and (c) are a minimal complete prefix and the prefix J. Esparza, S. R-omer, W. Vogler generated by the new algorithm for the 1-safe system of Figure 1(a), re- spectively. It follows that the new algorithm does not always compute a minimal complete prefix. However, the prefixes computed by the algorithm are minimal in another sense. The algorithm stores only the reachable markings corresponding to local configurations, which for the purpose of this discussion we call local markings. This is the feature which makes the algorithm interesting for concurrent systems: the local markings can be a very small subset of the reachable markings, and therefore the storage of the unfolding may require much less memory than the storage of the state space. In order to find out that the prefix of Figure 1(b) is complete, we also need to know that the initial marking fs appears again in the prefix as a non-local marking. If we only store information about local markings, then the prefix of Figure 1(c) is minimal, as well as all the prefixes generated by the new algorithm. The reason is the observation made above: all the local configurations of Fin which are not induced by cut-off events correspond to different mark- ings; therefore, in a prefix smaller than Fin we lose information about the reachability of some marking. 5 Implementation Issues and Experimental Results The implementation of the Algorithm 3.6 has been carried out in the context of the model checker described in [5], which allows to efficiently verify formulae expressed in a simple branching time temporal logic. For the storage of Petri nets and branching processes we have developed an efficient, universal data structure that allows fast access to single nodes [14]. This data structure is based on the underlying incidence matrix of the net. Places, transitions and arcs are represented by nodes of doubly linked lists to support fast insertion and deletion of single nodes. The computation of new elements for the set PE involves the combinatorial problem of finding sets of conditions B such that transition t. We have implemented several improvements in this combinatorial determination, which have significant influence on the performance of the algorithm. The interested reader is referred to [6]. Algorithm 3.6 is very simple, and can be easily proved correct, but is not efficient. In particular, it computes the set PE of possible extensions each time a new event is added to Fin, which is clearly redundant. Similarly to McMillan's original algorithm [10], in the implementation we use a queue to store the set PE of possible extensions. The new events of Fin are extracted from the head of this list, and, when an event is added, the new possible extensions it generates are appended to its tail. The simplest way to organize the list would be to sort its events according to the total order OE r . However, this is again inefficient, because it involves An Improvement of McMillan's Unfolding Algorithm 17 6. n-buffer for Original net Unfolding time [s] 1. Results of the n buffer example 3 . performing unneccessary comparisons. The solution is to sort the events according to the size of their local configuration, as in [10], and compare events with respect to OE r only when it is really needed. With this implementation, the new algorithm only computes more than McMillan's when two events e and e 0 satisfy ]j. But this is precisely the case in which the algorithm behaves better, because it always identifies either e or e 0 as a cut-off event. In other words: when the complete prefix computed by McMillan's algorithm is minimal, our algorithm computes the same result with no time overhead. The running time of the new algorithm is O(( jBj is the set of conditions of the unfolding, and - denotes the maximal size of the presets of the transitions in the original net (notice that this is not a measure in the size of the input). The dominating factor in the time complexity is the computation of the possible extensions. The space required is linear in the size of the unfolding because we store a fixed amount of information per event. Finally, we present some experimental results on three scalable exam- ples. We compare McMillan's algorithm and the new algorithm, both implemented using the universal data structure and the improvements in the combinatorial determination mentioned above. The first example is a model of a concurrent n-buffer (see Figure 5). The net has 2n places and is the buffer's capacity. While the number of reachable markings is 2 n , Fin has size O(n 2 ) and contains one single cut-off event (see Table 1). In this example, the complete prefix computed by McMillan's algorithm is minimal. The new algorithm computes the same prefix without time overhead, as expected. Our second example, Figure 5, is a model of a slotted ring protocol taken from [13]. Here the size of the prefix produced by the new algorithm grows J. Esparza, S. R-omer, W. Vogler GiveFreeSlot1 P11 GiveFreeSlot2 P12 Free2 Used2 GoOn2 Owner2 Used1 Other1 GoOn1 Other2 7. Slotted ring protocol for 2. Original net McMillan's algorithm New algorithm 9 90 90 3:8 2. Results of the slotted ring protocol example; more slowly than in the case of McMillan's algorithm. For the output is already one order of magnitude smaller. The slow growth in size can cause an even more dramatic reduction in the running time. Original net McMillan's algorithm New algorithm 43 94 44 8 0:02 52 23 4 0:00 9 71 53 7423 5686 2834 512 22:90 3. Results of Milner's cyclic In Table 3, we give the times for an example taken from [2] that models Milner's cyclic scheduler for n tasks. While the size of the unfolding produced by the McMillan's algorithm grows exponentially with the number of tasks, we get linear size using our new one. 3 All the times have been measured on a SPARCstation 20 with 48 MB main memory. 4 These times could not be calculated; for we interrupted the computation after more than 12 hours. An Improvement of McMillan's Unfolding Algorithm 19 6 Conclusions We have presented an algorithm for the computation of a complete finite prefix of an unfolding. We have used a refinement of McMillan's basic notion of cut-off event. The prefixes constructed by the algorithm contain at most non-cut-off events, where n is the number of reachable markings of the net. Therefore, we can guarantee that the prefix is never larger than the reachability graph, which does not hold for the algorithm of [10]. Recently, Kondratyev et al. have independently found another partial order between events which permits to obtain reduced unfoldings [9]. Their technique works for bounded nets. However, the partial order is not total, and so the upper bound on the size of the unfolding cannot be derived. Acknowledgements We thank Michael Kishinevsky, Alexander Taubin and Alex Yakovlev for drawing our attention to this problem, Burkhard Graves for detecting some mistakes, and an anonymous referee for helpful comments. --R Nonsequential Processes - A Petri Net View Evaluating Deadlock Detection Methods. Combinatorics on Traces. Branching processes of Petri nets. Model Checking Using Net Unfoldings. An improvement of McMillan's unfolding algorithm. Concurrent Hardware: The Theory and Practice of Self-Timed Design Verification of speed-independent circuits by STG unfoldings Analysis of Petri Nets by Ordering Relations. A Technique of a State Space Search Based on Unfolding. Trace theoretic verification of asynchronous circuits using unfoldings. Petri Nets Petri Net Analysis Using Boolean Manipulation. Implementation of a Compositional Partial Order Semantics of Petri Boxes. --TR Combinatorics on traces Branching processes of Petri nets Executions: a new partial-order semantics of Petri nets Model checking using net unfoldings A technique of state space search based on unfolding An Improvement of McMillan''s Unfolding Algorithm Using Unfoldings to Avoid the State Explosion Problem in the Verification of Asynchronous Circuits Trace Theoretic Verification of Asynchronous Circuits Using Unfoldings Petri Net Analysis Using Boolean Manipulation Calculating Place Capacity for Petri Nets Using Unfoldings --CTR Alessandro Giua , Xiaolan Xie, Control of Safe Ordinary Petri Nets Using Unfolding, Discrete Event Dynamic Systems, v.15 n.4, p.349-373, December 2005 Victor Khomenko , Maciej Koutny, Verification of bounded Petri nets using integer programming, Formal Methods in System Design, v.30 n.2, p.143-176, April 2007 Victor Khomenko , Maciej Koutny , Alex Yakovlev, Logic synthesis for asynchronous circuits based on STG unfoldings and incremental SAT, Fundamenta Informaticae, v.70 n.1, p.49-73, March 2006 Victor Khomenko , Maciej Koutny , Alex Yakovlev, Logic Synthesis for Asynchronous Circuits Based on STG Unfoldings and Incremental SAT, Fundamenta Informaticae, v.70 n.1,2, p.49-73, April 2006 Victor Khomenko , Maciej Koutny , Alex Yakovlev, Detecting State Encoding Conflicts in STG Unfoldings Using SAT, Fundamenta Informaticae, v.62 n.2, p.221-241, April 2004 Fabre, Trellis Processes: A Compact Representation for Runs of Concurrent Systems, Discrete Event Dynamic Systems, v.17 n.3, p.267-306, September 2007 Stefan Haar, Probabilistic cluster unfoldings, Fundamenta Informaticae, v.53 n.3,4, p.281-314, December 2002 Stefan Haar, Probabilistic Cluster Unfoldings, Fundamenta Informaticae, v.53 n.3-4, p.281-314, August 2002
partial-order semantics;petri nets;unfolding
599492
Logical fusion rules for merging structured news reports.
Structured text is a general concept that is implicit in a variety of approaches in handling information. Syntactically, an item of structured text is a number of grammatically simple phrases together with a semantic label for each phrase. Items of structured text may be nested within larger items of structured text. Much information is potentially available as structured text including tagged text in XML, text in relational and object-oriented databases, and the output from information extraction systems in the form of instantiated templates. In previous papers, we have presented a logic-based framework for merging items of potentially inconsistent structured text [Data Knowledge Eng. 34 (2000) 305-332, Data Knowledge Eng. 2002 (in press)]. In this paper, we present fusion rules as a way of implementing logic-based fusion. Fusion rules are a form of scripting language that define how structured news reports should be merged. The antecedent of a fusion rule is a call to investigate the information in the structured news reports and the background knowledge, and the consequent of a fusion rule is a formula specifying an action to be undertaken to form a merged report. It is expected that a set of fusion rules is defined for any given application. We give the syntax and mode of execution for fusion rules, and explain how the resulting actions give a merged report. We illustrate the presentation with examples of fusion rules for an application for merging weather reports.
Introduction Syntactically, an item of structured text is a data structure containing a number of grammatically simple phrases together with a semantic label for each phrase. The set of semantic labels in a structured text is meant to parameterize a stereotypical situation, and so a particular item of structured text is an instance of that stereotypical situation. Using appropriate semantic labels, we can regard an item of structured text as an abstraction of an item of free text. For example, news reports on corporate acquisitions can be represented as items of structured text using semantic labels including buyer, seller, acquisition, value, and date. Each semantic label provides semantic information, and so an item of structured text is intended to have some semantic coherence. Each phrase in structured text is very simple - such as a proper noun, a date, or a number with unit of measure, or a word or phrase from a prescribed lexicon. For an France Telecomi hheadquarters hheadquarters Figure 1: An example of a news report in the form of structured text. application, the prescribed lexicon delineates the types of states, actions, and attributes, that could be conveyed by the items of structured text. An example of structured text is given in Figure 1. Much material is potentially available as structured text. This includes items of text structured using XML tags, and the output from information extraction systems given in templates (see for example [CL96, Gri97, ARP98]). The notion of structured text also overlaps with semi-structured data (for reviews see [Abi97, Bun97]). Whilst structured text is useful as a resource, there is a need to develop techniques to handle, analyse, and reason with it. In particular, we are interested in merging potentially inconsistent sets of news reports [Hun00a, Hun02b], and deriving inferences from potentially inconsistent sets of news reports [Hun00b, Hun00c, BH01, Hun02a]. 1.1 Our approach to fusion In order to merge items of structured text, we need to take account of the contents of the structured text. Different kinds of content need to be merged in different ways. To illustrate, consider Examples 1.1 - 1.3 below. Example 1.1 Consider the following two conflicting weather reports which are for the same day and same city. hweatherreport: hweatherreport: hsource: TV1i hsource: TV3i hdate: 19.5.1999i hdate: 19.5.1999i htoday: suni htoday: suni htomorrow: suni htomorrow: raini We can merge them so that the source is TV1 and TV3, and the weather for today is sun, and the weather for tomorrow is sun or rain. hweatherreport: hsource: TV1 and TV3i hdate: 19.5.1999i htoday: suni htomorrow: sun or raini An alternative way of merging these reports may be possible if we have a preference for one source over the other. Suppose we have a preference for TV3 in the case of conflict, then the merged report is: hweatherreport: hsource: TV1 and TV3i hdate: 19.5.1999i htoday: suni htomorrow: raini Example 1.2 Consider the following two structured reports which are for the same day but different regions. Here we may wish to take the union of the two regionalreport features in the merged report, giving the following merged report, Example 1.3 Consider the following two weather reports for the same day and same city. hweatherreport: hweatherreport: hsource: TV1i hsource: TV3i hdate: 1.8.1999i hdate: 1.8.1999i hmiddayweather: hmiddayweather: hprecipitation: inclementi hprecipitation: showersi htemperature: 20Ci htemperature: 18Ci Here we may wish to take the conjunction of inclement and showers, and range of 18-20C in the merged report. hweatherreport: hsource: TV1 and TV3i hdate: 1.8.1999i hmiddayweather: hprecipitation: inclement and showersi htemperature: 18C-20Ci There are many further examples we could consider, each with particular features that indicate how the merged report should be formed. In our approach to merging items of structured text, in particular structured news reports, we draw on domain knowledge to help produce merged reports. The approach is based on fusion rules defined in a logical meta-language. These rules are of the form ff ) fi, where if ff holds, then fi is made to hold. So we consider ff as a condition to check the information in the structured reports and in the background information, and we consider fi as an action to undertake to construct the merged report. To merge a pair of structured news reports, we start with the background knowledge and the information in the news reports to be merged, and apply the fusion rules to this information. For a pair of structured news reports and a set of fusion rules, we repeatedly apply the fusion rules until no more rules apply. The application of the fusion rules is then a monotonic process that builds up a set of actions that define how the structured news report should be merged. The information in this fixpoint is then used to construct a merged structured news report. In order to merge more than two reports, we can repeat the merging process iteratively. 1.2 Other approaches to fusion Our logic-based approach differs from other logic-based approaches for handling inconsistent information such as belief revision theory (e.g. [Gar88, DP98, KM91, LS98]), knowledgebase merging (e.g. [KP98, BKMS92]), and logical inference with inconsistent information (e.g. [MR70, Bre89, These proposals are too simplistic in certain respects for handling news reports. Each of them has one or more of the following weaknesses: (1) One-dimensional preference ordering over sources of information - for news reports we require finer-grained preference orderings; (2) Primacy of updates in belief revision - for news reports, the newest reports are not necessarily the best reports; and (3) Weak merging based on a meet operator - this causes unnecessary loss of information. Furthermore, none of these proposals incorporate actions on inconsistency or context-dependent rules specifying the information that is to be incorporated in the merged information, nor do they offer a route for specifying how merged reports should be composed. Other logic-based approaches to fusion of knowledge include the KRAFT system and the use of Belnap's four-valued logic. The KRAFT system uses constraints to check whether information from heterogeneous sources can be merged [PHG knowledge satisfies the constraints, then the knowledge can be used. Failure to satisfy a constraint can be viewed as an inconsistency, but there are no actions on inconsistency. In contrast, Belnap's four-valued logic uses the values "true", "false", "unknown" and "inconsistent" to label logical combinations of information (see for example [LSS00]). However, this approach does not provide actions in case of inconsistency. Merging information is also an important topic in database systems. A number of proposals have been made for approaches based in schema integration (e.g. [PM98]), the use of global schema (e.g. [GM99]), and conceptual modelling for information integration based on description logics These differ from our approach in that they do not seek an automated approach that uses domain knowledge for identifying and acting on inconsistencies. Heterogeneous and federated database systems also could be relevant in merging multiple news reports, but they do not identify and act on inconsistency in a context-sensitive way [SL90, Mot96, CM01], though there is increasing interest in bringing domain knowledge into the process (e.g. [Cho98, SO99]). Our approach also goes beyond other technologies for handling news reports. The approach of wrappers offers a practical way of defining how heterogeneous information can be merged (see for example [HGNY97, Coh98, SA99]). However, there is little consideration of problems of conflicts arising between sources. Our approach therefore goes beyond these in terms of formalizing reasoning with inconsistent information and using this to analyse the nature of the news report and for formalizing how we can act on inconsistency. 1.3 The rest of the paper In the rest of the paper, we develop the approach of logic-based fusion of news reports. In Section 2, we review the definitions for formalizing structured text. This includes coverage of timestamps and sourcestamps. It also includes coverage of some concepts for describing the structure of structured text. In Section 3, we present the syntax for fusion including fusion rules and background knowl- edge. Then, in Section 4, we define how a set of fusion rules together with background knowledge can be executed to generate a set of actions that can be used to build a merged structured news report. We explain how to use these actions to build a merged structured news report in Section 5. Then, in Section 6, we consider some properties of fusion systems based on fusion rules. Formalizing structured text In this section, we formalize the composition and structure of structured news reports. 2.1 Structured text Here we adopt some basic definitions that should be easy to view as an adaptation of ideas in a variety of fields in XML, relational and object-oriented databases, language engineering, and knowledgebased systems. Definition 2.1 A word is a string of alphanumeric characters, and a phrase is a string of one or more words. A text entry is either a phrase or a null value. A semantic label is a phrase. In this paper, we assume the set of semantic labels and the set of text entries are disjoint. Example 2.1 Examples of words include John, France, drive, happy, 23, and 3i, and examples of phrases include University of London, John, 23 April 1999, and warm and sunny. Definition 2.2 If OE is a semantic label, and / is a text entry, then hOE : /i is an atomic feature. The complex features are defined as follows: (1) if hOE : /i is an atomic feature, then hOE : /i is a complex feature; and (2) if OE is a semantic label and oe 1 ; :::; oe n are complex features, then is a complex feature. The type of a complex feature is the semantic label OE. An item of structured text is just a complex feature. Definition 2.3 Let be a complex feature. The sub function is defined as follows: ng [ For complex features ff; fi, ff is a complex feature in fi iff ff 2 Sub(fi). We can consider a complex feature as a tree where the semantic labels are non-leaf nodes and the text entries are leaves. be a complex feature. The semantic label OE is the parent of the complex features oe 1 ; ::; oe n . The elements of are the offspring of OE. The function Root is defined as: Root(hOE Definition 2.5 The complex features, have the same structure iff oe 1 and / 1 have the same structure, ., and oe n and /n have the same structure. The atomic features have the same structure. We assume that for an application, some complex features will be classified as structured re- ports. These will be complex features with some minimum structure such as illustrated in Examples 1.1 - 1.3. We do not however assume any general conditions for classifying items of structured text as structured reports. 2.2 Timestamps and sourcestamps There are four types of timestamp that we will consider for structured reports, namely an atomic pointbased timestamp, an atomic intervalbased timestamp, a complex pointbased timestamp, and a complex intervalbased timestamp, and we define these below. Definition 2.6 The set of temporal semantic labels is a subset of the set of semantic labels used for structured news reports. Example 2.2 The set of temporal semantic labels includes time, date, publicationdate, and year. Definition 2.7 The set of temporal text entries is a subset of the set of text entries used for structured news reports. A temporal text entry may refer to a point or interval in a clock and/or calendar. A temporal text entry is called a pointbased text entry if it refers to a point in a clock. And a temporal text entry is called an intervalbased text entry if it refers to an interval in a clock and/or calendar. Example 2.3 Temporal text entries include 14.00hrs, 19 April 2000, and 19/4/00. Temporal text entries may or may not include the units of time used. For example, both 14.00 and 14.00hrs are temporal text entries. We will look more closely at the nature of points and intervals in the following definitions. Definition 2.8 An atomic pointbased timestamp is an atomic feature hff : fii where ff is a temporal semantic label referring to a particular clock and/or a particular calendar and fi is a pointbased text entry with a value denoting a point in that clock and/or calendar. Example 2.4 Examples of atomic pointbased timestamps include: We assume the background knowledge includes axioms that make different formats for temporal text entries interchangeable, so that for example 19 April 2000 is equivalent to 19/4/2000. Definition 2.9 An atomic intervalbased timestamp is an atomic feature hff : fii where ff is a temporal semantic label referring to a particular clock and/or a particular calendar and fi is a intervalbased text entry with a value denoting an interval in that clock and/or calendar. We view time intervals as being either implicitly given as an interval with the start and end points being inferred, or explicitly given in terms of a start point and an end point. Definition 2.10 An explicit intervalbased text entry is of the form X-Y, where X and Y denote points, and an implicit intervalbased text entry of the form X where X describes a period of time without using explicit end points. Example 2.5 Examples of atomic intervalbased timestamps with explicit intervalbased text entries include: Example 2.6 Examples of atomic intervalbased timestamps with implicit intervalbased text entries include: for 2004, the inferred start point in days is 1/1/2004 and the inferred endpoint in days is It can appear difficult to distinguish some implicit intervalbased text entries from pointbased text entries. We address the problem of handling implicit intervals by reducing each intervalbased text entry to pointbased text entries. We assume that the background knowledge includes axioms for this (as discussed in [Hun02b]). Definition 2.11 A complex pointbased timestamp is either an atomic pointbased timestamp or a complex feature h/ is a temporal semantic label refering to a particular clock and/or a particular calendar and OE 1 ; ::; OE n are complex pointbased timestamps that describe the point in that clock and/or calendar. In this paper, we will assume atomic and complex pointbased timestamps should be interchangeable by appropriate axioms in the background knowledge. Example 2.7 An example of a complex pointbased timestamp is: hdate: hday: hyear: 2000i; So we can assume this complex pointbased timestamp is equivalent to hdate: 23 April 2000i. Definition 2.12 A complex intervalbased timestamp is either an atomic intervalbased timestamp or a complex feature h/ is a temporal semantic label refering to a particular clock and/or a particular calendar and OE 1 ; ::; OE n are complex pointbased timestamps that describe the interval in that clock and/or calendar. Also, in this paper, we will assume atomic and complex intervalbased timestamps should be interchangeable by appropriate axioms in the background knowledge. Example 2.8 An example of a complex intervalbased timestamp is: huniversity term: hfirst day of term: 10/1/2000i; hlast day of term: 29/3/2000i; :university termi So we assume this complex intervalbased timestamp is equivalent to huniversity term: 10/1/2000-29/3/2000i In the rest of this paper, we assume each news report may have a timestamp which has type date, and may be pointbased or intervalbased, and complex or atomic. It may also have a sourcestamp which is an atomic feature of type source and text entry that describes what the source of the news report is. For example, for a weather report, we may have the atomic feature hsource : BBC TVi. Whilst we take a restricted position on timestamps and sourcestamps in this paper, we believe that the approach presented here can be extended to further types and combinations of timestamps and sourcestamps in structured text. For more information on using temporal knowledge in structured news reports see [Hun02b]. 2.3 Structural information about structured news reports In order to compare items of structured text on the basis of their structure, we will use the following notion of a skeleton. Definition 2.13 A skeleton is a tree (N; E; S) defined as follows: N is the set of nodes where each node is a semantic label; E is a set of edges represented by pairs of nodes; and S is the set of sibling neighbours represented by pairs of nodes such that (x; y) 2 S iff (i) x and y are siblings (i.e. x and y have the same parent) and (ii) x is to the left of y. According to Definition 2.13, the relative positions of siblings is important in a skeleton. So if x and y are siblings in a skeleton T , such that x is left of y, then we can form a different skeleton is left of x. Since a skeleton is essentially a complex feature without the text entries, a skeleton can be formed from an item by just removing the text entries. In other words, we use the semantic labels in a item of structured text as the name of the nodes in the skeleton. We call each such name, the simple name of the node. However, to obviate any problems arising from multiple occurrences of a semantic label in a complex feature, and hence the same name being used for different nodes, we can adopt the following definition for pedantic names for nodes. This definition uses the sequence of semantic labels used on the path from the root to the particular occurrence of a semantic label in a feature. Definition 2.14 The pedantic name for any node in a structured news report is defined inductively as follows: The pedantic name for the root of a structured news report is the semantic label for the report. For a nested feature let the pedantic name for OE be ff=OE, then the pedantic name for the root of each / i is ff=OE=Root(/ i ). (If there is more than one / i with the same semantic label at the root, then the occurrences can be differentiated by adding a superscript to the semantic label in the pedantic name.) Example 2.9 The pedantic name for source in Figure 1 is bidreport/reportinfo/source. Essentially, a pedantic name is like a unix file name that can be given by the path of directories from the root. But where we do not have ambiguity, we will just use the simple name. Definition 2.15 The skeleton function, denoted Skeleton, is applied to a complex feature ' and returns the skeleton (N; E; S) for ', where the set of nodes N is the set of names (simple or pedantic) formed from the semantic labels used in ', and E and S are defined as follows, where are either the simple names or pedantic names (as required) for the semantic labels OE, and the roots of / 1 ,.,/ n , respectively: ng and i ! jg So the skeleton function is defined to extract the tree structure of each item of structured text. skeletons and let - be a preordering over skeletons such customer \Gamma\Psi name @ @ @ @R address customer \Gamma\Psi name age @ @ @ @R address @ @ @ @R number street city Figure 2: Assume T3 and T4 are both skeletons. Here, T3 - T4 holds. then the set of edges in T i is a subset of the edges in T j , and for all sibling nodes x; y in T i , if x is left of y in T i , then x is left of y in T j . An example of a pre-ordering is given in Figure 2. Definition 2.17 Let ' be a complex feature and let S be a skeleton. An instantiation of S by ' is defined as follows: If Skeleton(') - S then ' is a partial instantiation of S If Skeleton(') - S and S - Skeleton(') then ' is a full instantiation of S If ' is an instantiation of S, this is denoted by S('). With reference to Definition 2.5, structured reports ' 1 and ' 2 have the same structure iff Definition 2.18 Let F and F' be features such that F 2 Sub(F') and let A position of F in F' is a pedantic name for the root of F in Skeleton(N; E; S). be a complex feature. The anchor for each complex feature / i is OE. So each of / 1 ; ::; /n is anchored at OE. The anchor is the position from which one or more complex features hang. In this way, the anchor gives the connection to the rest of structured text. Example 2.10 Consider Figure 1. Here we can see hbid date: May 2000i is at position bidreport/biddate and it is anchored at bidreport. In this way, we are using the notions of nodes in skeletons and semantic labels in structured reports interchangeably. 3 Syntax for fusion In this section, we give the syntax for the fusion rules and associated background knowledge for defining fusion systems. We assume fusion is undertaken on pairs of structured news reports, and that these reports are represented as logical terms in the logical fusion rules. Definition 3.1 Each complex feature is equivalent to a ground term called a feature term. is a complex feature, and / 0 1 is a feature term that represents / 1 , ., and / 0 is a feature term that represents /n , then OE(/ 0 ) is a feature term that represents is a complex feature, then OE(/) is a feature term that represents it. Definition 3.2 Each text entry is equivalent to a constant symbol called a text entry constant. So if T is a text entry, then T is a text entry constant. Example 3.1 Consider the following item of structured text. This can be represented by the feature term: In defining fusion rules, we require three kinds of atom. These are structural atoms, background atoms, and action atoms. The structural atoms capture information about the structure and type of complex features, and the type and text entries for the atomic features, in individual structured news reports, and between paris of structured news reports. The background atoms relate information in individual structured news reports to the domain knowledge. Finally, action atoms capture instructions for building merged structured news reports. Definition 3.3 The structural atoms are atoms that include the following definitions: 1. FeatureType(F,T) where T is the type of feature F. 2. Report(R) where R is a structured news report. 3. TextEntry(A,E) where E is the text entry for the atomic feature A. 4. IncludeFeature(F,F') where F' is a feature in F, and so F' 2 Sub(F). 5. AtomicFeature(F,A) where A is an atomic feature in F. 6. Position(F,P,R) where P is a position of the feature F in the report R. 7. Anchor(F,P,R) where P is a position of an anchor of the feature F in the report R. 8. SameSkeleton(F,F') where the features F and F' are such that 9. SameTextEntry(A,A') where the atomic features A and A' have the same text entry. 10. NextSibling(P,P',R) where position P is an immediate sibling to the left of P' in report R. We denote the set of structural atoms by S. Example 3.2 To illustrate some of these atoms, consider the following: Example 3.3 Consider Figure 1. Let this report be denoted R, and let hbid date: May 2000i be denoted F. For this, we have The structural atoms are evaluated by the underlying implementation for fusion. In other words, for any pair of structured news reports, the set of ground structural atoms that hold is completely determined. These atoms can be viewed as "built-in" predicates by analogy with Prolog. We also require atoms that relate the contents of structured text to the background knowledge. These are background atoms and a partial list is given below. Definition 3.4 The background atoms are atoms that include the following definitions: 1. SameDate(F,F') where F and F' are timestamps that refer to the same time point. 2. SameSource(F,F') where F and F' are sourcestamps that refer to the same source. 3. SameCity(F,F') where F and F' are features that refer to the same city. 4. Source(R,F) where F is the sourcestamp in the report R. 5. Date(R,F) where F is the datestamp in the report R. 6. Coherent(F,F') where the features F and F' are coherent. 7. Prefer(F,F') where the feature F is preferred to the feature F'. We denote the set of background atoms by B. Example 3.4 To illustrate background atoms consider the following literals that may be included in the background knowledge: Background atoms like SameDate(F,F'), SameSource(F,F'), and SameLog(F,F') are useful to determine when two features are equivalent and thereby indicate whether the features they come from are on the same topic. For example, if we have two reports, we can use these atoms to determine that the two reports have SameCity and SameDate holding, as a precondition before merging. We will use them as conditions in fusion rules below for this purpose. The coherent relation captures when two features are mutually consistent. The simplest form of inconsistency is between a pair of atomic features. Consider two structured reports, ' 1 and ' 2 , where the atomic feature hff : OEi is in item ' 1 and the atomic feature hff : /i is in item ' 2 and OE 6= /. For some semantic labels, this inequality would suggest an inconsistency with the domain knowledge, as illustrated by Example 3.5. Obviously different text entries for the same semantic label do not always suggest an inconsistency, as illustrated by Example 3.6. Example 3.5 Let ' 1 and ' 2 be two structured reports. Suppose hweather : suni is an atomic feature in ' 1 and hweather : raini is an atomic feature in ' 2 , and ' 1 and ' 2 are on the topic "weather reports for London on 1 August 1999". Example 3.6 Let ' 1 and ' 2 be two structured reports. Consider hcity : Londoni is an atomic feature in ' 1 and hcity : Parisi is an atomic feature in ' 2 , and ' 1 and ' 2 are on the topic "weather reports for 1 August 1999". An example of a definition for the coherent relation is given below. Example 3.7 Let us assume we have the following background knowledge for identifying pairwise inconsistency in atomic features of type weather in weather reports: This is likely to be only a partial list of literals required for this purpose. In addition, we will need various further formulae to define Coherent for other types of atomic feature. The background atoms are evaluated by querying background knowledge. In the simplest case, the background knowledge may be just a set of ground background atoms that hold. However, we would expect the background knowledge would include classical quantified formulae that can be handled using automated reasoning. In any case, the background knowledge is defined by a knowledge engineer building a fusion system for an application. Definition 3.5 The set of check atoms, denoted C, is the union of the structural atoms and the background atoms. We now consider the syntax for action atoms, and this requires the definition for action functions. Definition 3.6 The set of action functions include the following functions that can be used as terms in the action atoms. 1. Interval(X,Y) where X and Y are text entries and the function returns an interval X-Y. 2. Conjunction(X,Y) where X and Y are text entries and the function returns a text entry X and Y. 3. Disjunction(X,Y) where X and Y are text entries and the function returns a text entry X or Y. We assume action functions are defined in the underlying implementation that uses the actions as instructions to build a merged report. Example 3.8 The following are examples of definitions for action functions: We now consider a basic set of action atoms. In Section 6, we consider extending the set of action atoms. Definition 3.7 The action atoms are atoms that include the following definitions: 1. CreateSkeleton(R) where R is a report. The resulting action is to create the skeleton for the merged report. The postcondition of this action is Skeleton(R) holding. 2. AddText(E,P) where E is a text entry, and P is a tree position. The resulting action is to add the text entry to the tree in position P. The precondition of this action is that there is no offspring, or text entry, for the semantic label at P. The postcondition of this action is that E is the text entry for the semantic label at P. 3. ExtendFeature(F,P) where F is a feature and P is a position. The resulting action is to extend the tree with F at position P. The preconditions for this are that the semantic label for Root(F) should equal the semantic label at P and there is no offspring, or text entry, for the semantic label at P. The postcondition of this action is that Root(F) is at P. 4. AddFeature(F,P) where F is a feature and P is a position. The resulting action is to add F to the tree in position P. The precondition of this action is that there is no text entry for the semantic label at P. The postcondition of this action is that the semantic label at position P is the anchor for F. 5. Populate(F,P) where F is a feature and P is a position. If there is a Skeleton(F) attached to position P in the tree, then the resulting action is to add the text entries in F to the vacant slots in Skeleton(F) in the tree. The preconditions of this action are that there are no text entries in the offspring of the semantic label at P and the skeleton rooted at P equals Skeleton(F). The postcondition of this action is that Root(F) is at P. We denote the set of action atoms by A. Example 3.9 Let R be the report on the left below. Then Skeleton(R) gives the item on the right below: hweatherreport: hweatherreport: hsource: TV1 and TV3i hsource: i hdate: 19.5.1999i hdate: i htoday: suni htoday: i htomorrow: sun or raini htomorrow: i Example 3.10 Consider AddText(BBC TV,weatherreport/source). This instruction applied to the item below on the left gives the item below on the right. hweatherreport: hweatherreport: hdate: Example 3.11 Consider the item on the left, and the feature F on the right: hweatherreport: hweathertoday: hdate: i htemp: 0Ci The instruction ExtendFeature(F,weatherreport/weathertoday) when applied to the item on the left above gives the following item: hweatherreport: hdate: i hprecipitation: snowi htemp: 0Ci Implicit with the definition for ExtendFeature is the requirement to turn an atomic feature into a complex feature. This is also possible with AddFeature though not necessarily. Example 3.12 Consider the item on the left, and the feature F on the right: hweatherreport: hprecipitation: hdate: i hamount: 2cmi Then the instruction AddFeature(F,weatherreport) gives the following item: hweatherreport: hdate: i htype: snowi Example 3.13 Consider the item on the left, and the feature F on the right. hweatherreport: hweathertoday: hdate: i htemp: 0Ci Then the instruction Populate(F,weatherreport/weathertoday) gives the following hweatherreport: hdate: i hprecipitation: snowi htemp: 0Ci The action atoms cause a structured news report to be constructed. They define the structure of the report, and the text entries in the report. We will explain how this can be done in Section 5. In the remainder of this section, we explain how we use these atoms in fusion rules. Definition 3.8 The set of atoms is C [A. An atom is ground if each term in the atom is ground. If an atom is not ground, then it is unground. The set of ground atoms is denoted G. Definition 3.9 Let f:; -g be the set of classical logical connectives. The set of ground formulae, denoted F , is the set of all classical formulae that can be formed from G and the set of logical connectives using the usual inductive definition for classical logic. We leave consideration of quantification to Definitions 3.11 and 3.12. So in the above definition, if a formula contains an unground atom, then the formula will not be a well-formed formula of classical logic, because the free variable(s) will be unbound. Definition 3.10 A check formula is a formula composed from one or more check atoms and zero or more classical logical connectives using the usual inductive definition for classical logic formulae. An action formula is a formula composed from one or more action atoms and zero or more classical logical connectives using the usual inductive definition for classical logic formulae. In the following definition, we introduce a non-classical form of implication that is denoted by the Definition 3.11 A fusion rule is a rule of the following form where ff is a check formula and fi is an action formula. We assume that each variable in each rule is implicitly universally quantified, with the universal quantifiers outermost (i.e. if are the free variables in ff ) fi, then the explicitly quantified version is Normally, fi will be an atom or a conjunction of atoms. However, if it incorporates disjunction, then it captures non-determinism in the intended actions, and if it incorporates negation, then the negation captures a form of preclusion in the intended action. Example 3.14 The following are four examples of fusion rules. E) The action formulae give a logical specification that we can reason with. So for example, if we have an action :ff given by one fusion rule, and we have an action ff - fi given by another fusion rule, then taking these together we are obliged to undertake the action fi. Definition 3.12 The set of background formulae is formed from the check formulae and the classical universal quantifier, denoted 8, so that any unbound variable is bound by universal quan- tification. Any subset of the background formulae is called background knowledge. Definition 3.13 A fusion system is a pair (\Delta; \Gamma) where \Gamma is a set of fusion rules and \Delta is background knowledge. We explain how to use a fusion system in the next section. Executing fusion rules In order to use a set of fusion rules, we need to be able to execute them. We need a fusion system and a pair of structured news report to do this. Definition 4.1 A fusion call is a triple (\Delta; \Gamma; fR1; R2g) where (\Delta; \Gamma) is a fusion system, and and are structured news reports. Suppose we want to merge the reports R1 and R2. To do this, we use the background knowledge and the atoms Report(R1) and Report(R2), and then attempt to apply each of the fusion rules by a form of modus ponens, adding the consequent of each applied rule to the current execution state, until no more fusion rules apply. Definition 4.2 An execution state is a subset of F . An execution state lists the action formulae that hold at each point in an execution of a fusion call. Definition 4.3 The starting execution state for a fusion call (\Delta; \Gamma; fR1; R2g) is fg. So at the start of an execution, all we know is the background knowledge, and the two reports. An execution step for a fusion call takes an execution state and a fusion rule and creates a new execution state. The new execution state is the old execution state plus a grounded version of the consequent of one of the fusion rules. For this we need a form of substitution. Definition 4.4 A substitution - for a fusion rule ff ) fi is an assignment - of ground terms to variables in ff and fi such that -(ff) and -(fi) are ground formulae. Example 4.1 Consider the first fusion rule in Example 3.14, where R1 and are grounded by feature terms. A substitution - is Definition 4.5 An execution step for a fusion call (\Delta; \Gamma; fR1; R2g) is a triple (X; ff where X is an execution state, ff ) fi is a fusion rule, Y is an execution state, and the following two conditions hold where - is a substitution for ff ) fi: 1. 2. Each execution step can be regarded as an application of a form of modus ponens. Definition 4.6 An execution sequence for a fusion call (\Delta; \Gamma; fR1; R2g) is a sequence of execution states where the following conditions hold: 1. 2. for all 3. for all an execution step (X for the fusion call (\Delta; \Gamma; fR1; R2g) 4. there is no execution step for the fusion call (\Delta; \Gamma; fR1; R2g) such that conditions 1 to 3 hold. An execution sequence for a fusion call therefore ensures that: (1) the execution sequence has the starting execution state in the first execution step; (2) each execution step results in an expanded execution state; (3) each execution step follows from the previous step and uses a fusion rule from the fusion system; and (4) the execution sequence is maximal in the sense that it cannot be extended without violating the other conditions. By definition, an execution sequence is a monotonically increasing sequence of sets. Each X i in the sequence has one more action formula than the previous set X i\Gamma1 in the sequence. Definition 4.7 An action sequence for an execution sequence hX is a sequence of action g. An action sequence in just the sequence of action formulae that are added to the execution state by each execution step. The action sequence summarizes the actions to be taken to construct the merged news report. Example 4.2 Consider the following pair of reports. hweatherreport: hweatherreport: hsource: TV1i hsource: TV3i hdate: 19.5.1999i hdate: 19.5.1999i hweather: suni hweather: showersi And a set of fusion rules that includes the following rules: A fusion call with these fusion rules and news reports together with appropriate background knowledge can give the following actions: The complete action sequence is then given by: In the next section, we consider how we can use an action sequence for constructing a merged structured news report. 5 Acting on fusion rules Since we are building a merged structured news report in a number of steps, we need to first clarify the nature of the intermediate stages in the construction process. To help, we adopt the following definition of a fusion tree. Definition 5.1 A fusion tree is a tree of the form (N; is a skeleton, T is a set of text entries, and B is a subset of N \Theta T . The set of nodes of the tree is N [ T and the set of edges of the tree is E [ B. contains the edges that attach the text entries in T to the skeleton. If a fusion tree T; B) is a skeleton, then fg. If a fusion tree is an item of structured text, then T is the set of text entries used in the structured text, and B specifies which atomic features they instantiate. In any case, a fusion tree is a partial instantiation of a skeleton. Definition 5.2 A construction sequence hT 1 ; ::; for an action sequence hA 1 ; ::; An i is a sequence of fusion trees such that 1. If T then 2. T 1 is the result of carrying out A 1 on the fusion tree (fg; fg; fg; fg; fg). 3. T i+1 is the result of carrying out A i+1 on T i . So an action sequence is a sequence of instructions to build a merged structured news report by acting incrementally on a fusion tree. To illustrate, consider the following example. Example 5.1 Continuing example 4.2, we have the action sequence where the first instruction is CreateSkeleton(R) which results in the following fusion tree. hweatherreport: hdate: i The second instruction is AddText(Conjunction(TV1,TV3),weatherreport/source) which updates the above fusion tree to give the following fusion tree. hweatherreport: hsource: TV1 and TV3i hdate: i The third instruction is AddText(19.5.99,weatherreport/date) which updates the above fusion tree to give the following fusion tree. hweatherreport: hsource: TV1 and TV3i hdate: 19.5.1999i The fourth instruction is AddText(London,weatherreport/city) which updates the above fusion tree to give the following fusion tree. hweatherreport: hsource: TV1 and TV3i hdate: 19.5.1999i The fifth instruction is AddText(sun,weatherreport/weather) which updates the above fusion tree to give the following fusion tree. hweatherreport: hsource: TV1 and TV3i hdate: 19.5.1999i hweather: suni The net result is a merged structured news report. In Example 5.1, we start by constructing a skeleton, and then adding text entries. So for the fusion tree (N; T; B), we start by defining (N; E; S), and then incrementally add to T and B until we have a fusion tree that defines an item of structured text. In the next example, we form a merged structured news report from some complex features. Example 5.2 Consider R1 being the first report given in Example 1.2. Now consider the action sequence where For the first instruction, CreateSkeleton(R1), we get the following fusion tree: hdate :i For the second instruction, AddText(5 Nov 99; weatherreport=date), we update the above fusion tree to get the following: hregion :i For the third instruction, Populate(F1,weatherreport/regionalreport) we update the above fusion tree to get the following: For the fourth instruction, AddFeature(F2,weatherreport) we update the above fusion tree to get the following: If an action sequence is non-conflicting and complete, then the set of instructions can be used to build a fusion tree and they leave no gaps in the text entries in the fusion tree. If the action sequence is incomplete, then the fusion tree will have text entries missing, and if the action sequence is conflicting then there will be instructions for putting more than one text entry into the same position or instructions for putting both a text entry and a complex feature into the same position. Before defining when an action sequence is complete and non-conflicting, we consider when an action sequence is consistent. Definition 5.3 An action sequence hA 1 ; ::; An i is consistent iff fA 1 ; ::; Ang 6' ?. This definition takes a direct interpretation of consistent. It just means an action sequence is consistent if there is not an instruction to do both an action ff and an action :ff. An action sequence can be checked for consistency before an attempt to construct a merged report is made. Since, an action sequence is a specification for a merged structured news report, we can determine whether a particular structured news report meets the specification. We define this as follows: Definition 5.4 The meets relation is a binary relation between items of structured text and action sequences, and is defined as follows: R meets . and R meets An So by recursion, we need to consider the meets relation for action formulae. For action formulae A i that are atoms, we require the following rules: R meets AddText(E; P) if 9A s.t. TextEntry(A,E)- Position(A,P,R) holds R meets AddFeature(F; P) if Anchor(F,P,R) holds R meets ExtendFeature(F;P) if Position(F,P,R) holds R meets Populate(F; P) if Position(F,P,R) holds For action formulae A i that are not atoms, we require the following rules: R meets ff - fi iff R meets ff or R meets fi R meets ff - fi iff R meets ff and R meets fi R meets :ff iff it is not the case that R meets ff Definition 5.5 An action sequence hA 1 ; :::; An i is non-conflicting iff there is a construction sequence However, the meets relation is a little too relaxed in the sense that a report may meet an action sequence but may also include extra information that has not been specified. Definition 5.6 The matches relation is defined as follows where R is a structured news report and is an action sequence. R matches iff R meets The matches relation identifies the minimal structured news report(s) that meet(s) the action sequence. In other words, it identifies the news reports that do not include any superfluous information Definition 5.7 An action sequence hA 1 ; :::; An i is unambiguous iff there is only one construction sequence If an action sequence hA 1 ; ::; An i is unambiguous, there is exactly one structured news report R such that R matches Definition 5.8 An action sequence hA 1 ; ::; An i is complete iff the construction sequence hT 1 ; ::; for is such that Tn is a structured news report. In other words, an action sequence is a complete if it is not the case that the fusion tree that results has missing text entries. 6 Properties of fusion rules We now consider a few properties of fusion rules to clarify the nature of the syntax and execution. Proposition 6.1 Assuming the actions are only composed from the action atoms defined in Definition 3.7. An action sequence hA 1 ; ::; An i is non-conflicting implies the following conditions: 2. :9 P s.t. 3. :9 P s.t. Proof: Consider condition 1. The result of AddText(E,P) is a fusion tree with E being the text entry for the atomic feature at P. By the definition of atomic features, there can only be one text entry at P. So it is not possible to have both E and E' at P when E . So there is no construction sequence The cases for Conditions 2 and 3 are essentially the same. A fusion call does not necessarily produce a unique action sequence. In other words, normally there is some non-determinism in which fusion rules are applied. Proposition 6.2 Let (\Delta; \Gamma; fR1; R2g) be a fusion call. It is not necessarily the case that there is a unique action sequence hA 1 ; ::; An i that is generated. Proof: Consider Example 4.2, in which the action sequence hA 1 ; ::; A 5 i is generated. This fusion call could equally generate the following action sequence hA 0 There can also be some non-determinism in an action sequence. Proposition 6.3 Let hA 1 ; ::; An i be an action sequence, and let A i be an action formula in that sequence. If A i can be rewritten into disjunctive normal form, so A i is equivalent to a formula there may be more than one structured news report R such that R matches Proof: Consider a report R1 where and a report for each A i , Now consider an A i of the form of ff - fi. Clearly does not meet fi. Also suppose, does not meet ff and The length of an execution sequence, i.e. the number of execution steps undertaken for a fusion call is constrained by the number of fusion rules, and the nature of the inferences from the domain knowledge, and the size of the structured news reports. In order to get a useful boundary on the length of an execution sequence, we adopt the following definition. Definition 6.1 A fusion rule ff ) fi is capped iff the only possible substitutions - are such that assigns feature terms to the free variables in fi. All the fusion rules in this paper are capped. Proposition 6.4 For any fusion call (\Delta; \Gamma; fR1; R2g), if j\Gammaj is finite, and each fusion rule is capped, then the execution sequence Proof: The constraints in Definition 4.6 ensure that there are no cycles in an execution sequence. So there is no execution sequence such that there is an X i and X j where X j. Hence, there is no sequence of execution steps where the same instantiated form of a fusion rule is used twice. The only way that we can get an infinite sequence there are infinitely many -(fi) generated for some rule ff ) fi 2 \Gamma. However, if each fusion rule in \Gamma is capped, then there are only finitely many -(fi) that can be generated for each fusion rule, since the only substitutions for the variables in fi come from the feature terms generated from the structured news reports in the fusion call, and there are only finitely many feature terms that can be generated from each fusion call. So it is not possible to generate an infinite execution sequence The assumption that the fusion rules are capped seems quite reasonable if the aim of fusion is to only include information from the original reports being merged. Indeed if we assume the rules are capped, we can identify a tighter bound based directly on the size of the structured reports being merged. However, the computational viability of a fusion system depends on more than the number of execution steps taken. Indeed there are a number of factors that need to be considered: executing fusion rules ffl reasoning with background knowledge ffl acting on fusion rules We can regard each of these activities being a form of classical logic inferencing, and hence the computational viability is bounded by the computational viability of classical logic. Whilst in general, reasoning with classical logic is difficult to automate, implementation based on Prolog is feasible. Another practical question is whether the syntax can express everything that we want or need to express. This includes: ffl Location completeness of structural atoms. This is the ability to describe any structural relationship in a report in terms of the nesting and sequence of semantic labels and text entries. Comparison completeness of background atoms. This is the ability to compare any combination of text entries with respect to the background knowledge. Clearly the background atoms presented are only indicative of the possible atoms that may be defined for an application. ffl Fusion completeness of action atoms. This is the ability to describe how any structured news report can be constructed. In one sense, the current set of action atoms is sufficient for this. However, further actions atoms would allow reports to be constructed with fewer instructions. For example, currently the action atoms cannot directly specify the sequence in which siblings occur. The notion of structured news reports that we reviewed in Section 2 provides a rich structural representation. The check and action atoms that we define in Section 3, do not draw on the full expressivity of structured new report. However, it is straightforward to add further check and action atoms to extend the basic fusion framework that we have presented here. To illustrate, we could introduce the following actions. Definition 6.2 Further action atoms include: 1. LeftAdd(F,P) where F is a feature and P is a position. The resulting action is to add F to the fusion tree to the left of the existing feature at P. 2. RightAdd(F,P) where F is a feature and P is a position. The resulting action is to add F to the fusion tree to the right of the existing feature at P. To use these actions, we also introduce the following structural atoms. Definition 6.3 Further structural atoms include: 1. LeftNeighbour(F',F,P,R) where F' and F are features with the anchor at position P in R and F' is immediately to the left of F. 2. RightNeighbour(F,F',P,R) where F' and F are features with the anchor at position P in R and F' is immediately to the right of F. We illustrate the first of these structural atoms below. Example 6.1 Let R be the news report given in Figure 1. Also consider the following: For this report, LeftNeighbour(F',F,P,R) holds. Now we illustrate the action atoms given in Definition 6.2. Example 6.2 Consider the following fusion tree T. Now consider the following instructions: where For the instruction, LeftAdd(F,weatherreport/regionalreport), applied to the fusion tree T, we get the following: But suppose we ignore the previous instruction, and return to the original state T of the fusion tree. For the instruction RightAdd(F,weatherreport/regionalreport), applied to the fusion tree T, we get the following: It is straightforward to extend the framework that we have presented in this paper to accommodate these atoms. Clearly, we can greatly extend the set of background atoms depending on the application. Some further discussion of formulae for the background knowledge including discussion of inconsistency, temporal knowledge, and domain knowledge is given in [Hun00a, Hun02b], and for further discussion of lexical and world knowledge see also [Hun01, HM99, Hun96]. Also of relevance are the options of using ontologies for structured text (see for example [ES01]) and using comprehensive semantic networks such as WordNet [Mil95]. More generally, it may be appropriate to harness typed-feature structures [Car92] and machine readable dictionaries [WSG96] for representing and reasoning with lexical knowledge. Structured text is a general concept implicit in many approaches to handling textual information in computing, including tagged text in XML, text in relational and object-oriented databases, and output from information extraction systems. Structured text can be naturally viewed in logic. Each item of structured text can be represented by a formula of classical logic. This means that consistency checking and inferencing can be undertaken with structured text using domain knowledge We have proposed fusion rules as a scripting language for defining how to merge news reports. It may be appropriate to develop syntactic sugar and other notational conveniences to enhance this proposal. This may include using symbols such as AND, OR, and NOT. It may also include priority ordering over fusion rules to dictate the preferred ordering in which they should apply so as to allow for simpler antecedents. Further assumptions could also be used about the process to simplify the notation. For example, each rule has Report(R1) - Report(R2) in the antecedent, and yet we may assume two reports which are always referred to as R1 and R2, and thereby not need in the antecedent. The definition for a fusion call suggests an implementation based on existing automated reasoning technology and on XML programming technology. The most obvious route for representing each structured news report is to represent it as an XML document. Once information is in the form of XML documents, a number of technologies for managing and manipulating information in XML are available [Bra00]. Possibilities for representing and reasoning with background knowledge include relational databases, Datalog, and Prolog. Possibilities for implementing an inference engine for executing fusion rules include a meta-level program in Prolog, or an implementation in a imperative programming language such as Java. Another possibility is to present fusion rules in RuleML and harness one of the Java rule engines that are currently being proposed 1 . Finally, an action engine for acting on the instructions given by the fusion rules, could be implemented in an imperative programming language such as Java that can manipulate XML. An action engine would need to take each instruction in an action sequence and construct a construction sequence. We have not formalized the relationship between the structural atoms and XML technology. How- ever, there is clearly an overlap in functionality with technologies including the XPath language and proposals for the XML Query Algebra 2 . However, the main points we want to stress in any comparison is that: (1) fusion rules offer a logical bridge between logical reasoning with background knowledge, structural information about news reports to be merged, and logical specifications of the instructions for producing the merged report; and (2) fusion rules offer a higher-level scripting language for handling structured text than available with XPath or XML Query Algebra, and so fusion rules can be used on top of XML technology. In this sense, fusion rules and XML technology are complementary. Given that information extraction may be the technology for providing structured news reports for merging, integration of a fusion system with information extraction technology may be ap- propriate. The GATE System provides an implemented architecture for managing textual data storage and exchange, visualization of textual data structures, and plug-in modularity of text processing components 96]. The text processing components includes LaSIE which performs information extraction tasks including named entity recognition, coreference resolution, template element filling, and scenario template filling. --R Querying semi-structured data Inconsistency management and prioritized syntax-based entailment Semantic integration of heterogeneous information sources. How to infer from inconsistent beliefs without revising. A logic-based theory of deductive arguments Combining knowledgebases of consisting of first-order theories The XML Companion. Preferred subtheories: An extended logical framework for default reasoning. Semistructured data. The Logic of Typed Feature Structures. Description logic framework for information integration. Source integration in data warehousing. Reasoning with data provided by federated databases. Information extraction. Merging databases: Problems and examples. Management of preferences in assumption based reasoning. Handbook of Defeasible Resoning and Uncertainty Management Systems How to structure and access XML documents with on- tologies A data warehouse conceptual data model for multidimensional aggregation. Knowledge in Flux. GATE:an environment to support research and development in natural language engineering. Tableau techniques for querying information sources through global schemas. Information extraction techniques and challenges. Developing finite domain constraints - a data model approach Intelligent text handling using default logic. Merging potentially inconsistent items of structured text. Ramification analysis using causal mapping. Reasoning with inconsistency in structured text. A default logic-based framework for context-dependent reasoning with lexical knowledge Hybrid argumentation systems for structured news reports. Merging structured text using temporal knowledge. On the difference between updating a knowledgebase and revising it. On the logic of merging. Integration of information in four-valued logics under non-uniform assumptions A lexical database for English. Cooperative database systems. On inferences from inconsistent information. The KRAFT architecture for knowledge fusion and transformation. A general formal framework for schema transforma- tion Query processing in the TAMBIS bioinformatics source integration system. Building light-weight wrappers for legacy web data-sources using W4F Federated database systems for managing distributed Unpacking the semantics of source and usage to perform semantic reconciliation in large-scale information systems Electric Words: Dictionaries --TR Federated database systems for managing distributed, heterogeneous, and autonomous databases The logic of typed feature structures WordNet Electric words Information extraction Template-based wrappers in the TSIMMIS system Semistructured data A Web-based information system that reasons with structured collections of text Reasoning About Data Provided By Federated Deductive Databases A general formal framework for schema transformation Unpacking the semantics of source and usage to perform semantic reconciliation in large-scale information systems Ramification analysis using causal mapping Merging potentially inconsistent items of structured text A Default Logic Based Framework for Context-Dependent Reasoning with Lexical Knowledge Semantic integration of heterogeneous information sources How to structure and access XML documents with ontologies A logic-based theory of deductive arguments The XML Companion Merging structured text using temporal knowledge Arbitration (or How to Merge Knowledge Bases) Querying Semi-Structured Data Tableau Techniques for Querying Information Sources through Global Schemas Management of Preferences in Assumption-Based Reasoning Information Extraction Building Light-Weight Wrappers for Legacy Web Data-Sources Using W4F Developing Finite Domain Constraints - A Data Model Approach Source Integration in Data Warehousing Query Processing in the TAMBIS Bioinformatics Source Integration System Intelligent Text Handling Using Default Logic Integration of Information in Four-Valued Logics under Non-Uniform Assumptions --CTR Anthony Hunter, How to act on inconsistent news: ignore, resolve, or reject, Data & Knowledge Engineering, v.57 n.3, p.221-239, June 2006 Anthony Hunter , Weiru Liu, Merging uncertain information with semantic heterogeneity in XML, Knowledge and Information Systems, v.9 n.2, p.230-258, February 2006 Anthony Hunter , Rupert Summerton, Merging news reports that describe events, Data & Knowledge Engineering, v.59 n.1, p.1-24, October 2006 Emma Byrne , Anthony Hunter, Evaluating violations of expectations to find exceptional information, Data & Knowledge Engineering, v.54 n.2, p.97-120, August 2005 Emma Byrne , Anthony Hunter, Man bites dog: looking for interesting inconsistencies in structured news reports, Data & Knowledge Engineering, v.48 n.3, p.265-295, March 2004 Anthony Hunter , Weiru Liu, Fusion rules for merging uncertain information, Information Fusion, v.7 n.1, p.97-134, March, 2006 Anthony Hunter, Merging structured text using temporal knowledge, Data & Knowledge Engineering, v.41 n.1, p.29-66, April 2002 Carlos Ivn Chesevar , Ana Gabriela Maguitman , Guillermo Ricardo Simari, Argument-based critics and recommenders: a qualitative perspective on user support systems, Data & Knowledge Engineering, v.59 n.2, p.293-319, November 2006
conflict resolution;merging information;logic-based fusion;heterogenous information;logic-based inconsistency management;structured text;semi-structured text;inconsistency handling
599497
Analysis and optimization of active databases.
We introduce a new formal semantics for active databases that relies on a transaction rewriting technique. A user-defined transaction, which is viewed here as a sequence of atomic database updates forming a semantic atomic unit, is translated by means of active rules into induced one(s). These transactions embody active rule semantics which can be either immediate or deferred. Rule semantics, confluence, equivalence and optimization are then formally investigated and characterized in a solid framework that naturally extends a known model for relational database transactions.
Introduction Active databases are based on rules that allow us to specify actions to be taken by the system automatically, when certain events occur and some conditions are met. It is widely recognized that these active rules provide a powerful mechanism for the management of several important database activities (e.g., constraint maintenance and view materialization [6, 7]), and for this reason, they are now largely used in modern database applications and have been extensively studied in the last years [2, 4, 5, 9, 12, 14, 21, 22, 23]. However, in the various approaches, active rule execution is generally specified only by informal, natural-language descriptions. It follows that very often, when the number of rules increases, active rule processing becomes quickly complex and unpredictable, even for relatively small rule sets [23]. The goal of this paper is to provide a formal approach to active rule processing that relies on a method for rewriting user defined transactions to reflect the behavior of a set of active rules, and to show how known results for transaction equivalence can be extended in this framework to pre-analyze properties of transactions and rules. We start by introducing a simple transaction language, based on a well known model for relational databases [1] in which a transaction is viewed as a collection of basic update operations forming a semantic unit, and a quite general active rule language, whose computational model is set-oriented (like in [23] and differently from other approaches [22]). We consider two different execution models for active rules: immediate and deferred (or delayed) [8, 14]. The former has no temporal decoupling between the event, condition and action parts. The latter has a temporal decoupling between the event part on one side and the condition and action parts on the other side. We then define in this context a rewriting process that takes as input a user defined transaction t and a set of active rules and produces a new transaction t 0 that "embodies" active rule semantics, in the sense that explicitly includes the additional updates due to active processing. Under the deferred modality, the new transaction is the original one augmented with some induced actions, whereas, under the immediate modality, the new transaction interleaves original updates and actions defined in active rules. It follows that the execution of the new transaction in a passive environment corresponds to the execution of the original transaction within the active environment defined by the given rules. Other approaches consider rewriting techniques [11, 22], but usually they apply in a restrictive context or are not formal. Con- versely, we believe that this formal and simple approach can improve the understanding of several active concepts and make it easier to show results. As we have said, the execution model of our transactions extends a relational trans-action model which has been extensively investigated [1]. The reason for this choice is twofold. Firstly, we wish to use a well known framework having a formal setting and a solid transaction execution model. Secondly, we wish to take full advantage of the results already available on transaction equivalence and optimization [1, 13]. In this way, we are able to formally investigate statically several interesting properties of active rule process- ing. First, we can check whether two transactions are equivalent in an active database. Then, due to the results on transaction equivalence, we are also able to provide results on confluence. Finally, optimization issues can be addressed. As a final remark, we note that, with this approach, active rule processing does not require any specific run-time support, and so it is simpler to implement than others which are built from scratch [10]. The remainder of this paper is organized as follows. In Section 2, a detailed overview Relational Database System Confluence/Optimization Transaction Rewriting Loop Checking Figure 1: Components of the approach of the approach is presented by using several practical examples. In Section 3 we define the basic framework. In Sections 4 and 5, we introduce, in a systematic way, the notion of active database and the rewriting transaction technique, respectively. The property of equivalence is investigated in Section 6. From this study, several results on active rule processing are derived in Section 7. Finally, in Section 8, we draw some conclusions. An overview of the approach In this section we informally present our approach. As described in Figure 1, the basic idea is to express active rule processing as a four step computation. Given a user defined transaction t and a set of active rules P , the first step checks whether P presents some kind of recursion. For the time being, we present a simple characterization and we will not address this issue in detail in the present paper. The second step takes P and t, and transforms the transaction t into an induced one(s) that "embodies" the semantics of the rules in P . In general, during this step several transactions can be generated. These different induced transactions take into account the fact that an update of the original transaction may trigger several rules at the same time, and so the corresponding actions can be executed in different orders yielding different results. In the third step, confluence and optimization issues of active rule processing are investigated by analyzing the transactions computed during the second step. This is done by extending known techniques for testing equivalence of database transactions [1, 13]. Then, in the last step, according to the results of this analysis, one transaction is finally submitted to a relational database management system. We point out two important aspects of this approach. Firstly, it relies on a formal basis that allows us to derive solid results. Secondly, the rewriting and confluence/optimization steps can be done statically, without accessing the underlying database, and therefore they can be performed very efficiently at compile time. As we have said, we will consider the immediate and deferred active rule execution models: the immediate modality reflects the intuition that rules are processed as soon as they are triggered, while deferred modality suggests that a rule is evaluated and executed after the end of the original transaction [14]. Thus, two different rewriting procedures will be given. Specifically, consider a user defined transaction as a sequence of updates: This transaction is transformed under the immediate modality into an induced one: i denotes the sequence of updates computed as immediate reaction of the update with respect to a set of active rules P . This reaction can be derived by "matching" the update u i with the event part of the active rules. Clearly the obtained updates can themselves trigger other rules, hence this reaction is computed recursively. As noted above, several transactions can be obtained in this way. Note that under the immediate modality the induced transaction is an interleaving of user defined updates with rule actions. Under the deferred modality, the induced transaction has the form: Hence the reaction is deferred (or postponed) until the end of the user transaction. Here again the induced updates can themselves trigger other rules, and so the reactions of the original updates are recursively computed, but using the immediate modality. We now give a number of practical examples to clarify the above discussion. The following active rules react to updates to a personnel database composed by two relations: emp(name,dname,sal) and dep(dname,mgr). Rules are expressed here in a generic language that does not refer to any specific system but whose intended meaning should be evident (indeed, those rules can be easily expressed in any practical active rule language). r1: When DELETED d FROM dep Then DELETE FROM emp WHERE dname=d.dname r2: When INSERTED new-e INTO emp Then WHERE name=new-e.name AND dname!?new-e.dname r3: When INSERTED new-e INTO emp new-e.sal ? 50K Then INSERT INTO dep VALUES (dname=new-e.dname, mgr=new-e.name) Intuitively, the first rule states that when a department is deleted then all the employees working in such a department must be removed (cascading delete). The second one serves to enforce the constraint that an employee can work in one department only, and states that when an employee tuple, say (john,toy,40K) is inserted into the relation emp, then the old tuples where john is associated with a department different from toy must be deleted. Finally, the last rule states that if an inserted employee has a salary greater than 50k then he is eligible to be a manager of the department in which he works and so, according to that, a tuple with the name of the department and the new employee is inserted in the relation dep. Now, we provide the following simple user defined transaction where first the toy department is removed and then an employee is added to this department with a salary of 60K. INSERT INTO emp VALUES (name='bill',dname='toy',sal=60K); By inspecting the given active rules, we can easily realize that, at run time, the first update in t1 will trigger rule r1, whereas the second update will trigger rules r2 and r3. Therefore, under immediate modality, t1 can be rewritten, at compile time, into the following transaction t1I (where I denotes immediate modality), by "unfolding" t1 with respect to the active rules. In this new transaction, the prefix * denotes an induced update. INSERT INTO emp VALUES (name='bill',dname='toy',sal=60K); *INSERT INTO dep VALUES (dname='toy',name='bill'); The obtained transaction describes the behavior of the transaction t1 taking into account the active rules under the immediate modality. Note that there is another possible translation in which the last two updates are switched. This is because the second update of the original transaction triggers two rules at the same time (namely r2 and r3) and therefore we have two possible execution orders of the effects of these rules. It follows that, in general, a user defined transaction actually induces a set of transactions. One of the goals of this paper is to show that, in many cases, it is possible to statically check whether these transactions are equivalent. If all the induced transactions are equivalent we can state that the active program is "confluent" with respect to the transaction t1. In this case the execution of one of the obtained transactions implements the expected behavior of the user defined transaction within the active framework. Note that we do not assume the presence of a (partial) ordering on the rules, but the framework can be easily extended to take it into account. Let us now turn our attention to the deferred execution model. Assume that we want to move the employee John from the toy to the book department. This can be implemented by means of the following transaction. t2: INSERT INTO emp VALUES (name='john',dname='book',sal=50K); By inspecting transaction and rules, we can statically decide that the first update in t2 will not trigger rule r3 since its condition will not be satisfied (the salary of the new employee is not greater than 50K). Thus, if we rewrite this transaction taking into account our active rules under the deferred modality, we have the following possible translation t2D (D denotes deferred modality), in which the effect of the rules is postponed to the end of the transaction. before executing the above transaction, we can observe the fact that the second update can be discarded without altering the overall effect of the transaction, since its effect is "included" in the effect of the third update. This shows how some optimization can be performed on those induced transactions. The transaction that implements the expected behavior is then as follows. In contrast to a user defined transaction, the updates in the induced transactions are not independent, as some updates are indeed "induced" by others. This fact has a consequence on the execution semantics of an induced transaction. Assume for instance that at run-time the execution of an update u in a induced transaction t has a null effect on the database (because, for example, its condition does not hold or its effect is invalidated by a subsequent update). Then, it is reasonable that the updates in t induced (directly or indirectly) by u are not executed as well. Under this interpretation, we need to define a new transaction semantics that takes into account the inducer/induced relationship among updates. Clearly, the techniques to achieve confluence and optimization must take into account this fact. To clarify the point, consider the transformation of the transaction t1 under the deferred modality. According to the previous discussion, the rewriting process should generate the following transaction. INSERT INTO emp VALUES (name='bill',dname='toy',sal=60K); *INSERT INTO dep VALUES (dname='toy',name='bill'); However, it is easy to see that the third update invalidates the effect of second one. It follows that the last two updates of the transaction t1D, which are induced by such an update, must not be executed at run time. So, the rewriting of the transaction t1 under the deferred modality can be simplified as follows: Thus, we need to develop specific techniques to check equivalence and to optimize induced transactions. This will be done by extending an already existing framework for equivalence and optimization in relational databases. The rest of the paper is devoted to the formalization and characterization of the issues discussed in this section. 3 A model for Transactions The notion of transaction we use in this paper is based on a model for relational transactions introduced by Abiteboul and Vianu [1]. Informally, for transaction we mean a sequence of basic update operations (namely, insertions and deletions of tuples) viewed as a semantic unit. Specifically, we will restrict our attention to the important class of "domain-based" transactions, where the selection of tuples involves the inspection of individual values for each tuple. Differently from the model described in [1], we also allow comparisons predicates. 3.1 Preliminaries Let U be a finite set of symbols called attributes and, for each A 2 U , let dom(A) be an infinite set of constants called the domain of A. As usual, we use the same notation A to indicate both the single attribute A and the singleton fAg. Also, we indicate the union of attributes (or sets thereof) by means of the juxtaposition of their names. Moreover, we assume, for technical reasons, that the domains are disjoint and totally ordered. A relation scheme is an object R(X) where R is the name of the relation and X is a subset of U . A database scheme S over U is a collection of relation schemes fR 1 (X with distinct relation names such that the union of the X i 's is U . A tuple v over a set of attributes X is a function from X to the union of all the domains such that, for each A 2 X, v(A) is in dom(A). A relation over a relation scheme R(X) is a finite set of tuples over X. A database instance s over a database scheme S is a function from S such that, for each R(X) 2 S, s(R(X)) is a relation over R(X). We will denote by Tup(X) the set of all tuples over a set of attributes X and by Inst(S) the set of all database instances over a database scheme S. Throughout the rest of the paper, we will always refer to a fixed database scheme over a set of attributes U . 3.2 Conditions Let X be a set of attributes and A be an attribute in X. An atomic condition over X is an expression of the form: (1) A'c, where c 2 dom(A) and ' is a comparison predicate (=; 6=; !; -; ?), or (2) A 2 . The meaning of the symbols \Gamma1 and +1 is evident: A 2 (\Gamma1; c 2 ) is equivalent to A ! c 2 . The reason for allowing this form of atomic condition will be clarified shortly. Definition 3.1 (Condition) A complex condition (or simply a condition) over a set of attributes X is a finite set of atomic conditions over X. A tuple v over X satisfies an atomic condition A'c condition C if it satisfies every atomic condition occurring in C. We assume that conditions are always satisfiable, that is, they do not contain atomic conditions that are always false (e.g., A 2 there is no c 2 dom(A) such that atomic conditions that are mutually exclusive (e.g., both A condition C over a set of attributes X uniquely identifies a set of tuples over X: those satisfying the condition. This set is called the target of C. Definition 3.2 (Target of a condition) The target of a condition C over a set of attributes X, denoted by Targ(C), is the set of tuples fv 2 Tup(X) j v satisfies Cg. Note that Targ(C) is not empty if and only if C is satisfiable. We say that a condition specifies a complete tuple if a 3.3 Transactions Let us first introduce the basic update operations. Definition 3.3 (Insertion) An insertion over a relation scheme R j is an expression of the form +R j [C], where C is a condition over X j that specifies a complete tuple. The effect of an insertion +R j [C] is a mapping Eff (+R j [C]) from Inst(S) to Inst(S) defined, for each R i Definition 3.4 (Deletion) A deletion over a relation scheme R j is an expression of the form \GammaR j [C], where C is a condition over X j . The effect of a deletion \GammaR j [C] is a mapping Eff (\GammaR j [C]) from Inst(S) to Inst(S) defined, for each R i An update over a relation scheme is an insertion or a deletion. Note that, for sake of simplicity, we do not consider modify operations here. Actually, similarly to [1], modifications can be accommodated in our framework but the complexity of notation would increase dramatically. Update operations are generally executed within transactions, that is, collections of data manipulation operations viewed as a semantic atomic unit. Definition 3.5 (User transaction) A user transaction is a finite sequence of updates. The effect of a transaction is the composition of the effects of the updates it contains, that is, is the mapping: Eff Example 3.1 The SQL transactions described in Section 2 can be easily expressed using the notation introduced above. For instance, transaction t1 at page 6, can be expressed as follows: Two user transactions are equivalent when they always produce the same result if applied to the same database instance, that is, when they have the same effect. Definition 3.6 (Equivalence of user transactions) Two user transaction t 1 and t 2 are equivalent (denoted it is the case that Eff (t 1 3.4 Normalization of transactions According to [1], we describe and characterize in this section transactions satisfying a property called normal form. In such transactions, syntactically distinct updates have disjoint targets (and therefore do not interfere). This is a very convenient form since it simplifies results and algorithms. Moreover, it will make easier the specification of the reaction of active rules to updates involved in a transaction. We also show that any transaction can be brought to this special form by means of a "preprocessing" phase called normalization, and that this operation can be performed in polynomial time. Definition 3.7 (Normal form) A transaction t is in normal form if, for each pair of updates u i and u j in t that are over the same relation and have conditions C i and C j such that C i 6= C j , it is the case that Targ(C i The following result easily follows by definitions and states that, in a transaction in normal form: (1) if two updates have different targets, then these targets have an empty intersection, and (2) if two updates have the same target, then they have the same condition. Lemma 3.1 In a transaction in normal form: (1) the targets of a pair of updates are either identical or disjoint, and (2) the conditions of a pair of updates having the same target are syntactically equal. Proof. (1) Assume by way of contradiction that in a transaction in normal form there are two updates u i and u j with conditions C i and C j such that Targ(C i the targets of u i and u j are different, C i 6= C j , but by Definition 3.7, this implies that their targets are disjoint - a contradiction. (2) Assume that in a transaction in normal form two updates with the same target have different conditions. By definition of transaction in normal form, this implies that their targets are indeed disjoint - a contradiction. 2 Each transaction can be transformed into an equivalent transaction in normal form by "splitting" the target of each condition into sufficiently many targets. To this end, we now introduce a number of axioms, called Split Axioms, that can be used to transform a transaction into an equivalent transaction in normal form. Intuitively, these axioms show: (1) how we can transform a transaction in an equivalent transactions that contains only atomic conditions of the form (axioms SA2-SA4), and (2) how we can further transform a transaction in such a way that possible interferences between pair of updates of these two forms can be avoided (axioms SA5 and SA6). 1 Axioms SA1 and SA7 are useful in order to apply the others. Specifically, the former shows how we can generate conditions composed by singletons over the various attributes, the latter shows how we can add a condition over an attribute to a condition that does not mention it. Definition 3.8 (Split Axioms) In the following axioms, called the Split Axioms, C is a condition over X, A 2 X, and Cj Y denotes the set of atomic conditions in C that are 1 Clearly, this is just one of the possible way to enforce the normal form. A g] A g and C (i) A , for is an atomic condition. cg. cg. cg. c is the only element in dom(A) such that c 1 The following result can be easily proved. Lemma 3.2 The split axioms are sound, that is, Proof. Let us consider, for instance, axiom SA2. Let and let It is easy to see that Definitions 3.4 and 3.5, we have that Eff Similar considerations apply to the other axioms. 2 We now show how these axioms can be practically used to normalize transactions. Let us first introduce a property of conditions to be used in the algorithm that follows. Property 3.1 Let C be a condition over X, Z be a set of attributes and C be a finite set of constants. Then, for each attribute A 2 X " Z (1) CjA has the form )g, then there is no c 2 dom(A) " C such that The split algorithm that can be used to normalize transactions is reported in Figure 2. We have the following result. Theorem 3.1 Let t be a transaction, C be the set of all constants appearing in t, and Z be the set of all attributes mentioned in t. Then, (1) Algorithm Split terminates over t, C and Z and generates a transaction t split in polynomial time, 2 (2) t split - t, and (3) t split is in normal form. 2 Hereinafter, polynomial time means time polynomial with respect to the length of the transaction. Algorithm Split Input: A transaction t, a set of constants C and a set of attributes Z; Output: A new transaction t split ; begin while (there is an update u over R i whose condition does not satisfies Property 3.1 for the sets of attributes X i and Z and the set of constants C) the transaction obtained from t i by splitting u according to some split axiom; \Gammafupdates with unsatisfiable conditionsg end. Figure 2: Algorithm Split Proof. (1) Assume that contains just one update). By the structure of the split axioms, at each iteration of the loop in Algorithm Split, we have jt Moreover, the algorithm tries to enforce Property 3.1 that allows only updates having atomic conditions of the form It follows that the number of different forms that each atomic condition in t i+1 can take during the execution of the algorithm is bounded by: 2. This corresponds to the number of ordered pairs of k symbols (for the atomic conditions of the form A 2 plus the cardinality of C (for the atomic conditions of the form A = c). Since each update is not split more than once with respect to the same constant, it follows that for every i, jt i j is bounded by m jU j , that is, by the number of complex conditions over the universe U of attributes that can be formed with m different atomic conditions. Thus, the sequence of the t i 's is strictly increasing and bounded and therefore the algorithm terminates. If t contains multiple updates, the Split algorithm can be applied separately to each update in t and the results can be then concatenated to obtain t split . It follows that Algorithm Split terminates over any transaction and generates the output transaction in polynomial time. (2) This part can be easily shown on the basis of Lemma 3.2, by induction on the number of transformations applied to t by Algorithm Split. (3) By way of contradiction, assume that t split is not in normal form, that is, there is a pair of updates over the same set of attributes X with syntactically different conditions, say C whose targets are not disjoint. Now let A be an attribute in X such that Condition (1) of Property 3.1 (being the output of the algorithm Split) we have that both C i j A and C j j A are of the form Then, we have two possible cases : (a) C i j A has the form A has the form the targets would be disjoint), and (b) C i j A has the form A 2 (c A has the form A 2 (c (as above). In both cases, at least one of the two conditions does not satisfy Condition (2) of Property 3.1, and this contradicts that t split is the output of Algorithm Split. 2 Example 3.2 Let domains over the integers and consider the transaction This transaction is not in normal form since the tuple is in both the targets of the two updates it contains. By applying Algorithm Split we obtain: 1. 2. (by axiom The algorithm terminates at the second step and outputs which is in normal form. Let us now consider the transaction t which is not in normal form. Note that t 0 does not satisfies Property 3.1 since the first update does not even mention attribute B. By applying Algorithm Split we then obtain: 1. t 0 The algorithm terminates at the first step and outputs t 0 1 which is indeed in normal form. 4 Active Databases In this section we introduce formally the notions of active rule and program. We will consider a simple form of active rules that however captures a considerable portion of rules described in the literature and implemented in the systems. In particular, in [19] we have considered the core of several concrete active rule languages whose rule execution is specified only by informal descriptions, and have shown that with our framework it is possible to describe the main features of these languages. 4.1 Active Rules and Programs We represent an active rule by using the same notation introduced to express transactions. This allows us to easily describe the way in which updates and active rules interact. Specifically, the event and the condition parts of a rule are described by an update whereas the action part is described by a transaction according to the definitions of Section 3.3, with the only difference that variables can be used in the place of constants. These variables are used to describe bindings that are passed from the event and the condition to the action of a rule. 3 For simplicity, in this example we write A ! 1 Thus, let us fix a set of symbols called variables. We call generalized update an update having a condition in which variables can occur in the place of constants, and generalized transaction a transaction composed by generalized updates. Active rules are then defined as follows. Definition 4.1 (Active rule) An active rule has the form: where: (1) u e is a generalized update such that, in the case of an insertion, the condition does not necessarily specify a complete tuple; and (2) t a is a generalized transaction such that each variable occurring in t a also occurs in u e . The left hand side and the right hand side of the rule are also called the event part and the action part , respectively. Definition 4.2 (Active database) An active program P is a set of active rules. An active database is a pair (s; P ) where s is a database instance and P is an active program. Note that, the event part of an active rule allows us to specify both the update triggering the rule and the condition to be met for the effective execution of the rule [23]. The intuitive semantics of a rule as above is then as follows: if an update u "matching" with u e is executed on the database, then perform the transaction t a using the bindings of the matching between u and u e . Example 4.1 The active rules described in Section 2 (page 5) can be easily expressed using the notation introduced above: As we have said, one important point here is the temporal relationship between the execution of the components of a rule. The event and the action have a temporal decoupling under the deferred execution model, whereas, under the immediate execution model there is no temporal decoupling. In our approach, the semantics of an active database with respect to a transaction t is given in terms of the execution of a new transaction induced by t, and so it will be defined in Section 5 along with the definition of the rewriting technique. 4.2 Triggering of rules We now describe how updates and active rules interact. We first introduce some preliminary notions. Let D be the union of all the domains of the attributes in U and V be the set of variables. A substitution oe is a function from D [ V to D [ V that is the identity on constants. Then, the matching between atomic conditions is defined as follows: a ground atomic condition CA (that is, an atomic condition without variables) over A matches with a generalized atomic conditions C 0 A over the same attribute if: either (1) C 0 A contains variables and there is a substitution oe, called binding, such that A ), or (2) C 0 A is ground and there is at least one tuple v over X, such that v satisfies both CA and C 0 A (that is, Targ(CA Let C 1 be a (ground) condition and C 2 be a generalized condition over the same set of attributes X. We say that for each attribute A 2 X occurring in both of them, C 1 j A matches with C 2 j A . If so, the composition of the bindings (if any) of the various atomic conditions forms the binding of C 1 and C 2 . It is easy to show that if two condition match, then the matching is unique up to renaming of variables. Definition 4.3 (Triggering) Let be an update and r be an active rule u e ) t a , where we say that (that is, u and u e perform the same type of operation on the same relation), and (2) C matches with C e . If an update u triggers a rule r : u e ) t a and oe is their binding, then we say that u induces the sequence of updates oe(t a ) because of the rule r. Note that because of the condition on the variables in an active rule (see Definition 4.1), a ground update always induces ground updates. Example 4.2 The update +emp[name=bill,dname=toy,sal=60k] triggers the following active rule: because of the binding that associates bill to the variable N and toy to the variable D (note that sal=60k matches with sal?50k). It follows that the update induces the update +dep[dname=toy,mgr=bill]. 5 Transaction transformation In this section we present the algorithms that transform a user defined transaction into an induced one that embodies the active rules behavior. We consider both the immediate and deferred cases. 5.1 Transaction transformations In Figure 3 is reported the recursive algorithm that computes the reaction of a single update. In the algorithm, the symbol ffl denotes the concatenation operator of sequences. Note that, in general, different outputs can be generated by this algorithm depending on the order in which triggered rules are selected in the first step of the while loop. Clearly the algorithm can be generalized in such a way that all the possible reactions of an update are generated. Moreover, according to several approaches described in the literature, the algorithm can me modified (first step of the while loop) in order to take into account a (partial) order on rules. Unfortunately, the algorithm is not guaranteed to terminate over any possible input since some kind of recursion can occur in the active program. However, syntactical restriction can be given so that Algorithm Reaction is guaranteed to terminate. The result that follows is based on the construction of a special graph G P describing the relationship between the rules of P . The construction of this graph is based on the notion of "unification" between updates that generalizes the notion of matching as follows. We Algorithm Reaction Input: An update u, an active program P , a set of constants C, and a set of attributes Z. Output: A sequence - P of updates induced directly or indirectly by u and P . begin Triggered triggered by ug; while Triggered (u; P ) is not empty do pick a rule r a from Triggered (u; P ) and let oe be the binding of u and u e ; for each u i in t do - ffl end. Figure 3: Algorithm Reaction say that two generalized updates u 1 and u 2 (possibly both containing variables) unify if there is a ground substitution oe (called unifier) such that Targ(oe(u 1 Then, in the graph G P the nodes represent the rules in P and there is an edge from a a to a rule r a if there is an update in t a that unifies with u 0 e . Lemma 5.1 If the graph G P is acyclic then the algorithm Reaction is guaranteed to terminate over P and any update u k . Proof. Algorithm Reaction performs a recursive call for each update oe(u), where u in an update that occurs in the action part of a triggered rule r and oe is the matching that causes the triggering. This call causes in turn the triggering of a set of rules and, for each of these rules, a number of further recursive calls of the Algorithm Reaction. Let a be a rule triggered by oe(u). By Definition 4.3, this means that there is a substitution oe 0 such that the targets of oe(u) and oe 0 e ) have a nonempty intersection. Since we can assume that all the rules have different variables, we have that oe ffi oe 0 is a unifier of r and r 0 . Therefore, two rules of P cause a recursive call if there is an edge from r to r 0 in G P . Since G P is acyclic, it follows that the number of recursive calls is always finite and so the algorithm terminates. 2 Hereinafter, we consider only active program P such that the graph G P is acyclic. Indeed, less restrictive conditions can be given to achieve termination. Also, the algorithm can be modified in order to take into account the presence of some kind of recursion. We have discussed these issues elsewhere [18]. We are now ready to present the notion of induced transactions. Definition 5.1 (Induced transaction) Let t be a user defined transaction, P be an active program, C be a set of constants that includes the constants occurring in t and the constants occurring in P , Z be a set of attributes that includes the attributes mentioned in t and the attributes mentioned in P , and t be the output of Algorithm t, C and Z. Then, consider the following transactions: We say that t I and t D are induced by t because of P , under the immediate and deferred modality respectively. Actually, in the following we will refer to induced transactions without making any explicit reference to the modality under which the transaction transformation has been computed since the various results hold independently from this aspect. For induced transactions, the following property holds. Lemma 5.2 Let t be a user defined transaction and P be an active program. Then, any transaction induced by t because of P is in normal form and can be computed in polynomial time. Proof. By Definition 5.1, each update occurring in a transaction t 0 induced by t is split, using Algorithm Split, either in the preprocessing step or during the execution of Algorithm Reaction, with respect to a set of constants and a set of attributes that include those occurring in t. Therefore, by Theorem 3.1, t 0 is in normal form. Let us now consider the complexity of the construction of t 0 . By the hypothesis on the acyclicity of the graph G P , it easily follows that one execution of Algorithm Reaction requires, in the worst case, a number of recursive calls equals to jP j the number of rules in P , and so bounded by jP j 2 . Moreover, each call of Algorithm Reaction involves one execution of Algorithm Split, which requires polynomial time by Theorem 3.1, and a number of concatenation operations bounded by the maximum number of updates occurring in the action part of a rule of P . It follows that Algorithm Reaction requires polynomial time and, since this algorithm is used once for each up-date occurring in the original transaction, we have that an induced transaction can be computed in polynomial time. 2 We point out that given a user defined transaction and an active program, we may have several different induced transactions, depending on the possible different outputs of Algorithm Reaction, and even if the number of those induced transactions is always finite, it may be very large. However, this number can be reduced by checking for instance when certain ones are "obviously" equivalent, e.g., when certain rules trivially commute. The problem of the efficient generation of induced transactions and their management is beyond the goal of this paper and has been addressed elsewhere [18]. 5.2 Semantics of induced transaction As we have said in Section 2, an induced update in an induced transaction is executed only if: (1) the inducing update has been effectively executed or (2) it has not been invalidated afterwards. Then, a new notion of effect of a transaction needs to be defined according to that. We call this new semantics the active effect of an induced transaction since it takes into account the relationship between "inducing" updates and the "induced" ones due to the active rules. This relationship has to be known always and can be made explicit, during the generation of the induced transaction, in several ways, for instance, by means of a labeling technique, as described in [18]. let u be an update and s be a database instance. We say that the effect of u is visible in s if: Also, let be a transaction and 1 - j - n. We denote by tj j the transaction composed by the first j components of t. Definition 5.2 (Active effect) The active effect Eff ff of an induced transaction is a mapping Eff ff (t) from Inst(S) to Inst(S), recursively defined as follows, for is induced by an update u i in t and the effect of u i is not visible in Eff ff We are finally ready to define the semantics of a transaction with respect to an active database. Definition 5.3 (Effect of a transaction in an active database) A potential effect of a user transaction t in an active database (s; P ) coincides with Eff ff (t 0 )(s), where t 0 is a transaction induced by t because of P . 6 Equivalence of active databases Many interesting problems can be systematically studied in the formal framework we have defined. Among them: equivalence, optimization and confluence of active databases. In this section we shall consider equivalence and show that this property is decidable in polynomial time. 6.1 Equivalence of induced transactions Transaction equivalence has been extensively investigated in the relational model [1, 13]. The major results of this study concern deciding whether two transactions are equivalent and transforming a transaction into an equivalent, but less expensive one. Unfortunately, these results cannot be directly used within our framework because of the different semantics defined for transactions. So, let us introduce a new definition of equivalence that refers to induced transactions. Definition 6.1 (Equivalence of induced transactions) Two induced transactions t 1 and t 2 are equivalent (denoted t 1 - ff t 2 ) if it is the case that Eff ff Algorithm Summary Input: An induced transaction Output: The summary \Sigma t ) of t. begin for each do if (u i is induced by u not embedded in then \Sigma i := \Sigma else case u i of end. Figure 4: Algorithm Summary We now present a simple method for testing equivalence of induced transaction. Actu- ally, the method works for any transaction in normal form and is based on a representation of the behavior of a transaction that we call summary. An annotated condition has the following syntax: hR; Ci, where R is a relation and C is a complex condition. Then, the summary of an induced transaction t is a pair t ) of sets of annotated conditions generated by the Summary algorithm reported in Figure 4. In the algorithm we make use of the following notion: given a summary \Sigma we say that an update u with condition C is embedded in \Sigma t if either t or t . The summary \Sigma describes, in a succinct way, the behavior of an induced transaction t. Specifically, let m and n be the cardinalities of \Sigma t and \Sigma \Gamma respectively and consider a transaction b t defined as follows: for each hR; Ci 2 has an update \GammaR[C] in one of its first n positions, and for each hR; Ci has an update +R[C] in one of the positions from m. Actually, since both \Sigma t and \Sigma \Gamma are sets, we have several different way to build b t ; however, since the transactions we obtain have always the same deletions followed by the same insertions, their (non-active) effects are always the same. Thus, the order in which the updates occur in b t is immaterial and we can consider deterministic its construction. We now have the following. Lemma 6.1 Eff ff Proof. The proof proceeds by induction on the length n of t. The basis since in this case it is easy to see that and so, by Definition 5.2, Eff ff With regard to the induction step, assume that Eff ff Definition 5.2, for any instance s, the update u j is not executed on Eff ff (tj j \Gamma1 )(s) if and only if it is induced by an update u i occurring in tj j \Gamma1 that is not visible on Eff ff this condition, by the inductive hypothesis u i is not visible also on Eff ( b t construction, this simply implies that u i does not occur in b tj j \Gamma1 . But this means that u i is not embedded in so, in the execution of the Algorithm Summary, the annotated condition corresponding to u j is not included in \Sigma j and therefore u j does not occur in b t j j . It follows that, for any instance s, u j is effectively executed on Eff ff under the active effect semantics if and only if u j occurs in b tj j , and so we have: Eff ff (tj this completes the induction part. For Theorem 6.1 Let t 1 and t 2 be two induced transaction over the same set of constants and the same set of attributes. Then, we have that t 1 - ff t 2 if and only if \Sigma t 1 Proof. (If) Let \Sigma t 1 . We can assume, without loss of generality, that b by Lemma 6.1, Eff ff (Only if) Let Eff ff be an instance and, for some relation scheme R(X), let v be a tuple in s(R(X)) such that v 62 Eff ff (t 1 )(s)(R(X)). Clearly, we have also that v 62 Eff ff (t 2 )(s)(R(X)). Now consider the transactions b there is an update u and an update u are induced transaction over the same set of constants and the same set of attributes and therefore their concatenation t 1 t 2 is a transaction in normal form. Since have a non empty intersection, by Lemma 3.1, it follows that . Thus, the annotated condition hR; C 1 i occurs in both \Sigma \Gamma and . The same considerations apply for insertions. It follows that, by . 2 An interesting aspect to point out is that the notion of active effect of an induced transaction indeed generalizes the notion of effect of a user-defined transaction. This implies that the above characterization of equivalence also hold for ordinary transactions in passive environments. 6.2 Equivalence of user transactions The notion of equivalence of user transactions, can be naturally extended in an active environment. Since we have seen that a transaction can potentially produces different results on an active database (depending on the different induced transactions that can be generated from it), we can assume that two transactions are equivalent when they are able to produce always the same results on any database instance. Definition 6.2 (Equivalence of transactions in an active framework) Two user transactions t 1 and t 2 are equivalent with respect to an active program P if for each transaction t 0 induced by t 1 because of P there is a transaction t 0 induced by t 2 because of P such that t 0 2 , and vice versa. By the results of the above section, we can state the following result. Theorem 6.2 The equivalence of two user transactions in an active framework can be decided in polynomial time. Proof. Given a user transaction t, by Lemma 5.2 we can construct the transactions it induces in polynomial time. The number of transactions that can be induced by a single update because of an active program P is bounded by a constant that depends only on the size of P . Specifically, it is bounded by denotes the cardinality of P . Then, the number of transactions that can be induced by t is bounded by k \Theta jtj. By Definition 6.2, the equivalence of two user transactions t 1 and t 2 requires a test for the equivalence of each pair of transactions induced by t 1 and t 2 respectively, that is, a number of tests bounded by k 2 \Theta jt 1 j \Theta jt 2 j. Now, by Theorem 6.1, equivalence of two induced transactions requires: (1) the construction of their summaries by means of Algorithm Summary, which requires time linear with respect of the length of the transaction (bounded by jtj \Theta jP j 2 ), and (2) the test for the equality of two summaries, which requires time proportional to jt 1 j \Theta jt 2 j \Theta jP j 4 . It follows that the equivalence of t 1 and t 2 can be decided in polynomial time. 2 6.3 Axiomatization of transaction equivalence Before closing this section, we present two simple and intuitive axioms for proving equivalence of induced transactions, which provide much insight into the relationship between updates in an induced transaction. Since these axioms show how transactions can be manipulated without altering their overall effect, we call them Manipulation Axioms. We will also show that these axioms suggest a way to optimize efficiently transactions in an active environment. In order to present those axioms, we need to introduce some preliminary notions. First, we use the notation Induced(u) to denote the updates induced directly or indirectly by the update u in an induced transaction. Moreover, we say that two updates collide if they are over the same relation scheme and their conditions are identical. Finally, we introduce the notion of validity of an update in a transaction, which is the syntactical counterpart of the notion of visibility and is recursively defined as follow: an update u i in an induced transaction t is valid if: (1) it is not induced, or (2) it is induced directly by an update u j preceding u i in t, and there is not a valid update u k in t between u j and that collides with u j . Definition 6.3 (Manipulation Axioms) The following axioms are called Manipulation Axioms and involve induced transactions in which - 1 and - 2 are (eventually empty) subtransactions: [Switching Axiom] where: (1) u i and u j do not collide, (2) u i is a valid update, and (3) u j does not collide with any update u k occurring in - 1 such that u [Merging Axiom] where: (1) u i and u j collide, (2) u j is a valid update, and (3) - 0 the updates in Induced(u i Intuitively, axiom (MA1) states that if the updates u i and u j do not collide, and u j cannot invalidate the effect of the updates inducing u i (if any), then they can be switched. Instead, Axiom (MA2) states that if u i collides with u j then their execution is equivalent to execute only u j , provided that: (1) all the updates induced (directly or indirectly) by are not executed as well, and (2) the updates induced (directly or indirectly) by both are however executed (this happens when u j is induced by u i and so Lemma 6.2 The manipulation axioms are sound, that is t 1 - man t 2 implies t 1 - ff t 2 . Proof. Let us first consider MA1: since u i and u j do not collide, u i cannot invalidate u j if we execute the latter first. Moreover, by Definition 5.2, before the switching the effective execution of u i depends on the updates occurring in - 1 and if u j does not collide with any update inducing u i , we have that after the switching the execution of u i still depends on the updates occurring in - 1 . Finally, before the switching the effective execution of u j depends on the updates occurring in - 1 ; u i . Therefore, if u j is not induced by u i , after the switching the effective execution of u j still depends on the updates occurring in - 1 . On the other hand, if u j is induced by u i , no problem arises since u i is valid and so u j has to be executed anyway. It follows that, under the given conditions, the active effect of coincides with the active effect Let us now consider MA2: since u i and u j collide and u j is valid, we have that u j invalidates u i and therefore u i can be deleted without altering the effect of the transaction . Moreover, since u i is invalidated by u j , its effect is not visible during the execution of - 2 , and so all the updates induced directly or indirectly by u i can be deleted from - 2 , except those induced also by u j (in the case in which u j is induced by u under the given conditions, we have that the active effect of - coincides with the active effect Theorem 6.3 MA is a sound and complete set of axioms for proving equivalence of induced transactions. Proof. By Lemma 6.2, MA is sound. To prove the completeness of these axioms, consider two induced transaction t 1 and t 2 such that t 1 - ff t 2 . Then, using the manipulation axioms, we can transform these transactions in two new transactions t 0 all the deletions are performed before all the insertions. This can be done in two steps: in the first one all the updates in the transaction that collide with another update are deleted and in the second one all the deletions are moved to the front of the transaction, before all the insertions. The first step can be performed by using the manipulation axioms as follows. Starting from the second update and iterating over the updates in the transaction, we move forward, using axiom MA1, the updates preceding the one currently under consideration that collide with it. Then, these updates are deleted using axiom MA2. It is easy to show that this work can always be done. After the first step, there is no pair of updates in the transaction that collide and so, in the second step, we can easily move the deletions to the front of the transaction using axiom MA1. Since the axioms are sound by Lemma 6.2, we have 2 and so t 0 . Also, since no pair of updates in both t 0 collide, it easily follows that t 0 since t 0 , by Theorem 6.1 we have \Sigma t 0= \Sigma t 0. Then, by construction, we have that b coincide up to a permutation of the deletions and a permutation of the insertions. It follows that b 1 can be transformed into b using repeatly axiom MA2. In sum we have: man t 0 man man t 2 . 2 7 Analysis of active rule processing On the basis of the results on transaction equivalence, we derive in this section a number of results about important properties of active databases. 7.1 Confluence Confluence is a strong property and some applications may actually need a weaker notion [2]. We then propose two notions of confluence. The former is weaker than the latter since refers to a specific transaction. However, this notion can be nicely characterized and turns out to be of practical importance. Definition 7.1 (Weak confluence) An active program P is confluent with respect to a user transaction t if all the transactions induced by t because of P are equivalent. Definition 7.2 (Strong confluence) An active program P is (strongly) confluent if it is confluent with respect to any user transaction. The following result show that there is a practical method for testing weak confluence. Theorem 7.1 Weak confluence is decidable and can be tested in polynomial time. Proof. Given a user transaction t, by Lemma 5.2, we can construct the transactions induced by t in polynomial time. By Definition 7.1, the confluence of t with respect to P , requires to test for equivalence of each pair of transactions induced by t. The number of tests to be done is bounded by the square of the maximum number of transactions that can be induced by t, that is, by k 2 \Theta jtj 2 , where k is a constant that depends only on the size of P (see the proof of Theorem 6.2). Since, by Theorem 6.1, testing for equivalence of two induced transactions requires polynomial time, it follows that the confluence of t with respect to P can be also performed in polynomial time. 2 We now introduce another interesting notion of confluence that is independent of a specific transaction. Let P be an active program, C be the set of constants occurring in P and r : u e ) t a be a rule of P . We denote by U r the set of updates obtained from r as follows. For each atomic condition CA in u e involving a variable x, let A be the set of intervals and (2) there is no constant c 2 CA such that c 2 since CA is finite, \Psi A is actually a finite partition of dom(A). Now, let K / be a set of constants that contains one element (whichever it be) in every . Note that since \Psi A is a finite partition of dom(A), KA is always finite. Then, the set U r contains all the possible updates that can be obtained by applying to u e a substitution that, for each attribute A occurring in u e , maps variables of u e occurring in CA to constants in KA . Intuitively, the set U r contains all the "representatives" of triggering updates for the rule r, and specify the different ways in which the rule r can be triggered by an update. Definition 7.3 (Local confluence) An active program P is locally confluent on a rule confluent with respect to any update in U r . An active program P is locally confluent if it is confluent on every rule in P . Note that, by Theorem 7.1, it follows that we can check for local confluence of an active program in polynomial time. The following result states that local confluence, although restrictive, is a desirable property for an active program. Theorem 7.2 If an active program is locally confluent then it is strongly confluent. Proof. Let t be a user transaction in normal form with respect to the set of constants occurring in t and P and the set of attributes mentioned in t and P . Note that this is not a restrictive hypothesis since, by Theorem 3.1, any transaction can be transformed in a transaction satisfying this property using Algorithm Split. The proof proceeds by showing that, for each update u in t triggering a rule r 2 P and each sequence of updates - induced by u, there is a mapping over constants ' such that: (1) '(u) 2 U r , and (2) '(u) induces a sequence of updates - 0 such that - 0 ). Specifically, this mapping is defined as follows: for each atomic condition CA occurring in u, ' is the identity on the constants in KA and maps each constant c 62 KA to the constant c 0 2 KA that belongs to the interval containing c. Clearly, '(u) 2 KA . Moreover, by Definition 4.3 (triggering) and by Algorithm Split, it is easy to show, by induction on the number of step of Algorithm Reaction, that for each sequence of updates - generated by this algorithm starting from u, the same algorithm is able to generate the sequence '(-) starting from '(u). But, by definition of local confluence, we have that all the sequences of updates induced by '(u) are equivalent. It easily follows that all the sequences of updates induced by u are also equivalent. Thus, we have that P is confluent with respect to each sequence of updates induced by an update in t (if any). Now it can be easily shown that, given a transaction t, if there is a partition of t in sequences of adjacent updates is confluent with respect to each - i , confluent with respect to t. Therefore, by Definition 5.1 of induced transaction, it follows that, independently from the modality, for any transaction t, P is confluent with respect to t and so P is strongly confluent. 2 It is possible to show that, while local confluence implies strong confluence, the converse in not true in general even for weak confluence. That is, there are active programs that are not locally confluent but are confluent with respect to certain transactions. The notion of local confluence gives us a sufficient condition for confluence that can be checked very efficiently. Let P be an active program and P conf be the set of rules on which P is locally confluent. Note that this set can be derived one for all, at definition time. The following characterization of weak confluence simply requires, for each update in a transaction, one test of matching with the event part of the rules in P . Corollary 7.1 Let P be an active program and t be a user defined transaction. Then, P is confluent with respect to t if each update in t triggers only rules in P conf Proof. P conf is indeed a strongly confluent program and therefore, by Theorem 7.2, t is confluent with respect to P conf and so with respect to P . 2 7.2 Optimization A major objective of our research is to provide tools for optimizing induced transac- tions. This is particularly important since, in our approach, an optimization technique for induced transactions yields a method for optimizing the overall activity of active rule processing. According to [1], two types of optimization criteria for transactions can be considered. The first is related to syntactic aspects (e.g., length and complexity of updates) of a transaction, whereas the second is related to operational criteria such as the number of atomic updates performed by a transaction. Both criteria are formally investigated in this section. Let us first introduce a preliminary notion. Let P be a partition of the tuple space, that is, a partition of the set of all tuples v 2 Tup(X) for every R(X) in the scheme S: we say that a transaction t is based on P if, for each condition C occurring in an update of t, Targ(C) 2 P. According to most implementations, we assume that a deletion operation is more complex than an insertion operation (denoted u ordering may be invalid for certain implementation of the updates. However, changing the ordering does not affect the results that follow. Definition 7.4 A transaction based on P is syntactically optimal if for every transaction t 0 based on P equivalent to t, t exists a permutation - of Given a transaction t, we denote by Nop(t) a mapping from Inst(S) to IN \Theta IN that associates to an instance s the pair (i; d) where i is the number of tuples inserted by t into s, and d is the number of tuples deleted by t from s. Moreover, we denote by - the order relation on IN \Theta IN defined as follows: where k is the ratio between the cost of an insertion operation and the cost of a deletion operation. Intuitively, the order relation - takes into account the number of update operations, together with the preference attributed to insertions over deletions. Definition 7.5 A transaction t based on P is operationally optimal if for every transaction based on P equivalent to t, for each instance s 2 Inst(S). Note that the above definitions do not refer to any possible pair of equivalent transactions but rather to transactions that are based on the same partition of the tuple space. This however is a more convenient form since it is possible to show that if the transactions are not based on the same partition, syntactically and operationally optimality cannot be attained simultaneously in general. Definition 7.6 A transaction t is optimal if it is operationally and syntactically optimal. Let us consider the manipulation axioms introduced in the previous section (Defini- tion 6.3). It is easy to see that one application of the Merging Axiom yields a strictly simpler transaction, whereas the Switching Axiom does not affect the complexity of the translation, but is however useful in order to apply the Merging Axiom. This simple observation leads to a method for optimizing induced transactions. Intuitively, this method consists of applying a number of times the Switching Axiom followed by an application Algorithm Optimize Input: An induced transaction Output: A new transaction t opt . begin repeat if collides with some update u j (j ! i) that precedes u i in t i ) then t i+1 := the transaction obtained from t i by deleting u j and all the updates in Induced(u j else t until (all the updates in t i have been examined) end. Figure 5: Algorithm Optimize of the Merging Axiom, until no modification can be performed. The method can be effectively implemented in a very simple way by means of the algorithm in Figure 5 (recall that Induced(u) denotes, in an induced transaction, all the updates induced directly or indirectly by the update u). The following theorem confirms that the algorithm always terminates (in polynomial time) and produces an optimal transaction. Theorem 7.3 Let t be an induced transaction. Then, (1) Algorithm Optimize terminates over t and generates a transaction t opt in polynomial time, (2) t opt - ff t, and (3) t opt is optimal. Proof. (1) The algorithm simply involves an iteration over the updates in t and so requires, in the worst case, time linear in the length of the transaction. Note however that some step can involve a reduction of t and so, on the average, the execution of the algorithm is even more efficient. (2) This part can be proved by showing that, at each step of the loop in the algorithm, when the new transaction (t i+1 ) it is not equated to transaction of the previous step (t i ), it can be obtained from it through a number of applications of the Switching Axiom (to move close to u i ) followed by one application of the Merging Axiom. To show this, we note that the algorithm eliminates collisions between updates as soon as they are encountered while iterating over the updates of the transaction. This implies that, at each step, in the sequence of updates - 1 preceding the update u i under consideration, there is no pair of updates that collide and so all the updates are valid. Therefore, at each step, we can freely use the Switching Axiom in - 1 (see Definition 6.3) and, in particular, if there is an update u j in - 1 that collides with u i , we can move u j close to u i . Then, we can apply the Merging Axiom thus obtaining exactly the transaction t i+1 . By Lemma 6.2, it follows that, for each i, t i - ff t and so, at termination, t opt - ff t. (3) First note that, as a consequence of what shown in part (2), in t opt there is no pair of updates that collide. Now assume, by way of contradiction, that t opt is not syntactically optimal and let t 0 be a transaction based on the same partition P and equivalent to t opt that has less update operations than t opt (according to the order -). This implies that, for each update u of t opt with condition C that is visible on Eff ff (t opt )(s), for some instance s, there must be an update u 0 with condition C 0 in t 0 such that Therefore, since t opt has more updates than t 0 , there is at least an update u x in t opt that is not visible on s, and this is possible only if u x is invalidated by another update in t opt . But t opt is in normal form as it is obtained by just deleting updates from a transaction in normal form. By Lemma 3.1, this implies that there are two updates in t opt that collide - a contradiction. Assume now, again by way of contradiction, t opt is not operationally optimal and let t 0 be a transaction based on the same partition P and equivalent to t opt such that Nop(t 0 opt )(s) for some instance s 2 Inst(S). This implies that t opt either perform two times the insertion/deletion of the same tuple or a tuple is first inserted (or deleted) and then deleted (inserted). But t opt is in normal and so, by Lemma 3.1, this is possible only if there are two updates in t opt that collide - again a contradiction. 2 Conclusions We have presented a formal technique that allows us to reduce, in several important cases, active rule processing to passive transaction execution. Specifically, user defined transactions are translated into new transactions that embody the expected rule semantics under the immediate and deferred execution modalities. We have shown that many problems are easier to understand and to investigate from this point of view, as they can be tackled in a formal setting that naturally extends an already established framework for relational transactions. In fact, it turns out that several important results derived for transactions in a passive environment can be taken across to an active one. Firstly, we have been able to formally investigate transaction equivalence in the framework of an active database. Secondly, results on transaction equivalence have been used to check for interesting and practically useful notions of confluence. Finally, optimization issues have been addressed. We believe that this approach to active rule processing is suitable for further interesting investigations. From a practical point of view, we have studied efficient ways to generate and keep induced transactions, in the context of an implementation of the method on the top of a commercial relational DBMS [18]. From a theoretical point of view, we believe that the various results can be extended in several ways to take into account more general frameworks. Finally, the rewriting technique can be applied to other data models such as one based on objects [16]. --R Equivalence and optimization of relational transactions. Static analysis techniques for predicting the behavior of active database rules. A model for active object-oriented database Automatic generation of production rules for integrity maintenanace. Chimera: a model and language for active DOOD Sys- tems Deriving production rules for constraint maintenance. Deriving production rules for incremental view maintenance. A structured approach for the definition of the semantics of active databases. ODE as an active database: constraints and triggers. Design and implementation of Chimera's active rule language. Combining theory and practice in integrity control: a declarative approach to the specification of a transaction modification subsystem. Rule processing in active database systems. Simplification rules and complete axiomatization for relational update transactions. The architecture of an active data base management system. Active databases as a paradigm for enhanced computing environ- ments A rewriting technique for implementing active object systems. A rewriting technique for the analysis and the optimization of active databases. A transaction transformation approach to active rule processing. A framework for the specification of active rule language semantics. Implementing large production systems in a DBMS environment: concepts and algorithms. The integration of rule systems and database systems. On rules --TR Equivalence and optimization of relational transactions The architecture of an active database management system A theory for rule triggering systems Deriving production rules for constraint maintenance Set-oriented production rules in relational database systems On rules, procedure, caching and views in data base systems Simplification rules and complete axiomatization for relational update transactions Rule processing in active database systems Termination and confluence of rule execution Automatic generation of production rules for integrity maintenance Static analysis techniques for predicting the behavior of active database rules A structured approach for the definition of the semantics of active databases A logic-based integration of active and deductive databases Design and implementation of Chimera active rule language Active rule analysis and optimisation in the rock MYAMPERSANDamp; roll deductive object-oriented database Foundations of Databases The Integration of Rule Systems and Database Systems Refined Triggering Graphs A Transaction Transformation Approach to Active Rule Processing A Rewriting Technique for the Analysis and the Optimization of Active Databases Expressiveness and Complexity of Active Databases Ode as an Active Database Deriving Production Rules for Incremental View Maintenance On Implementing a Language for Specifying Active Database Execution Models An Algebraic Approach to Rule Analysis in Expert Database Systems Using Delta Relations to Optimize Condition Evaluation in Active Databases Investigating Termination in Active Database Systems with Expressive Rule Languages A Rewriting Technique for Implementing Active Object Systems A Framework for the Specification of Active Rule Language Semantics Combining Theory and Practice in Integrity Control Termination Analysis in Active Databases --CTR Burcin Bostan-Korpeoglu , Adnan Yazici, A fuzzy Petri net model for intelligent databases, Data & Knowledge Engineering, v.62 n.2, p.219-247, August, 2007
optimization;rule semantics;confluence;active databases;transaction equivalence
599526
Models and motion planning.
We study the complexity of the motion planning problem for a bounded-reach robot in the situation where the n obstacles in its workspace satisfy two of the realistic models proposed in the literature, namely unclutteredness and small simple-cover complexity. We show that the maximum complexity of the free space of a robot with f degrees of freedom in the plane is (nf/2 + n) for uncluttered environments as well as environments with small simple-cover complexity. The maximum complexity of the free space of a robot moving in a three-dimensional uncluttered environment is (n2f/3 n). All these bounds fit nicely between the (n) bound for the maximum free-space complexity for low-density environments and the (nf) bound for unrestricted environments. Surprisingly--because contrary to the situation in the plane---the maximum free-space complexity is (nf) for a three-dimensional environment with small simple-cover complexity.
Introduction It is well known that the maximum complexity of the free space of a robot with f degrees of freedom moving in a scene consisting of n disjoint obstacles of constant complexity can be # n f ). Consequently, exact motion-planning algorithms often have a worst-case running time of at least the same order of magnitude. This is probably one of the reasons that most of the exact algorithms were never implemented. One exception is Ba-non's implementation [3] of the O(n 5 ) algorithm of Schwartz and Sharir [14] for a ladder moving in a two-dimensional workspace, which performs surprisingly well, and much better than the worst-case theoretical analysis predicts. The reason is that the running time of the algorithm is sensitive to the actual complexity of the free space, and this is in practice far less than the #(n f ) worst-case bound. These observations inspired research [1, 2, 4, 7-11, 13, 15, 16, 19-21] where geometric problems are studied under certain (hopefully realistic) assumptions on the input-in the case of motion planning: the environment in which the robot is moving. The goal of this line of research is to be able to predict better the practical performance of algorithms. For instance, van der Stappen et al. [16] studied the free-space complexity for a bounded-reach robot moving in environments consisting of fat obstacles. robot has bounded reach if it is not too large compared to the obstacles in its workspace; an obstacle is fat if it has no long and skinny # Institute of Information and Computing Sciences, Utrecht University, P.O.Box 80089, 3508 the Netherlands. Email: {markdb,markov,frankst,jules}@cs.uu.nl. Department of Mathematics and Computer Science, Ben-Gurion University of the Negev, Beer-Sheva 84105, Israel. Email: [email protected]. Supported by the Israel Science Foundation founded by the Israel Academy of Sciences and Humanities. parts.) They showed that in this restricted type of environments the worst-case free-space complexity is only #(n). Van der Stappen [17, 18] also proved that in such environments naive and slightly adapted versions of Schwartz and Sharir's ladder algorithm run in O(n 2 ) and O(n log n) time, respectively, which is more in line with the experimental results of Ba-non. der Stappen and Overmars [19] used the linear free-space complexity result to obtain an e#cient general approach to robot motion planning amidst fat obstacles. These results were extended to the more general setting of low-density environments by van der Stappen et al. [20]. De Berg et al. [5] brought together various of the realistic input models that were proposed in the literature, namely fatness, low density, unclutteredness, and small simple-cover complexity-see Section 2 for formal definitions of these models. They showed that these models form a strict hierarchy in the sense that fatness implies low density, which in turn implies unclutteredness, which implies small simple-cover complexity, and that no other implications exist between the models. A natural question that arises is whether the results of van der Stappen et al. [20] remain valid when, instead of a low-density scene, we assume a more general setting, like an uncluttered scene or a scene with small simple-cover complexity. In other words, does the complexity of the free space of a bounded-reach robot with f degrees of freedom moving in an uncluttered scene (alternatively, in a scene with small simple-cover complexity) remain O(n)? The main result of this paper is a negative answer to this question. We prove that the maximum complexity of the free space of a bounded-reach robot moving in either an uncluttered scene or a scene with small simple-cover complexity is #(n f/2 n) when the workspace is two-dimensional. These bounds fit nicely between the #(n) bound for low-density scenes and the #(n f ) bound for general scenes. For three-dimensional uncluttered scenes the bound becomes #(n 2f/3 n). Contrary to the planar case, small simple-cover complexity does not result in a reduced maximum free-space complexity for three-dimensional workspaces: the maximum complexity is #(n f ). Our upper-bound proofs use the concept of guarding sets [6]. A guarding set for a collection of objects-in our case the obstacles in the robot's workspace-is, informally speaking, a set of points (sometimes referred to as guards) that approximates the spatial distribution of these objects. Guarding sets allow us to define a simplifying generalization [6] of unclutteredness that implies small simple-cover complexity in 3D and is even equivalent to it in the plane. Section 2 recalls the input models that play a role in this paper and briefly reviews the relations between these models and the concept of guarding sets. Section 3 establishes an upper bound on the number of large objects intersecting a hypercube given the number of guards in its vicinity. In Sections 4 and 5 we use the relations and the bound to obtain tight bounds on the maximum complexity of the free space for motion planning in uncluttered environments and environments with small simple-cover complexity in 2D and 3D, respectively. Section 6 concludes the paper. Before we briefly describe the input models that play a role in this paper we list a few important assumptions and definitions. The dimension of the (work)space is denoted as d. We shall be dealing a lot with squares, cubes, rectangles, and so on. These are always assumed to be axis-aligned. All geometric objects we consider are d-dimensional and open; in particular, if we talk about a point lying in a square or cube, we mean that the point lies in the interior of the square or cube. Furthermore, all objects we consider are assumed to have constant complexity. More precisely, each object is a compact connected set in R d , bounded by a constant number of algebraic surface patches of constant maximum degree. The size of a square (more generally, of a hypercube) is defined to be its edge length, and the size of an object is the size of a smallest enclosing hypercube for the object. An L-shape is the geometric di#erence of a hypercube # with a hypercube # of less than half its size and sharing a vertex with it. An L-shape can be covered by 2 d hypercubes contained in it: for each vertex v of # not shared with # , take the hypercube of maximal size with v as a vertex and contained in # . Although this paper concentrates on motion planning in uncluttered environments and environments with small simple-cover complexity, we also briefly describe the model of low density for the sake of reference. It is the weakest model for which the free space of a bounded- reach robot is known to have linear complexity [20]. We leave fatness [5, 18, 19] out of our discussion as it imposes stronger constraints on the environment while leading to the same bound as low density. The model of low density was introduced by van der Stappen et al. [20] and refined by Schwarzkopf and Vleugels [15]. It forbids any ball B to be intersected by many objects whose minimal-enclosing-ball radius is at least as large as the radius of B. In the definition, # meb (P) denotes the radius of the minimal enclosing ball of an object P. Definition 2.1 Let O be a set of objects in R d . We say that O has #-low-density if for any ball B, the number of objects intersect B is at most #. We say that a scene has low density if it has #-low-density for a small constant #. Unclutteredness was introduced by de Berg [4]. The model is defined as follows. Definition 2.2 Let O be a set of objects in R d . We say that O is #-cluttered if any hypercube whose interior does not contain a vertex of one of the bounding boxes of the objects in O is intersected by at most # objects in O. We call a scene uncluttered if it is #-cluttered for a small constant #. The following definition of simple-cover complexity is a slight adaptation of the original definition by Mitchell et al. [12], as proposed by de Berg et al. [5]. Given a scene O, we call a ball #-simple if it intersects at most # objects in O. Definition 2.3 Let O be a set of objects in R d , and let # > 0 be a parameter. A #-simple cover for O is a collection of #-simple balls whose union covers the bounding box of O. We say that O has (s, #)-simple-cover complexity if there is a #-simple cover for O of cardinality sn. We will say that a scene has small simple-cover complexity if there are small constants s and # such that it has (s, #)-simple-cover complexity. Guarding sets [6] against hypercubes 1 provide a generalization of unclutteredness that turns out useful in our proofs. A guarding set for a collection of objects is, loosely speaking, a set of points that approximates the distribution of the objects. More precisely, guarding sets are defined as follows. 1 In the paper by De Berg et al. [6] guarding sets are defined against an arbitrary family of ranges. It is su#cient for our purposes to concentrate on hypercubic ranges. Definition 2.4 Let O be a set of objects in R d , and let # be a positive integer. A set G of points is called a #-guarding set for O (against hypercubes) if any hypercube not containing a point from G intersects at most # objects from O. We will often call the points in G guards. We are particularly interested in scenes that admit a small #-guarding set for some small constant #, that is, a guarding set of size linear in the number of objects in O. Scenes that admit a linear-size guarding set fit nicely in the existing model hierarchy: a low-density scene is also an uncluttered scene, which, is a scene that admits a linear-size guarding set, which is a scene with small simple-cover complexity [5, 6]. In the plane admitting a linear-size guarding set is even equivalent to having small simple-cover complexity, but this is not the case in higher dimensions. A consequence of these hierarchical relations is that upper bounds for scenes with linear-size guarding sets immediately transfer to planar and 3D uncluttered scenes as well as to planar scenes with small simple-cover complexity. This conclusion will come to our help in Sections 4 and 5. 3 Guards and vicinities Guards provide information on the distribution of the objects in an environment. Let us assume we are given a #-guarding set for a collection of objects. A hypercube without any guards is, by definition, intersected by at most # objects. Moreover, a hypercube with exactly guards in its interior is intersected by O(#g) objects [6]. Theorem 3.4 below states another, more surprising, relation between the distribution of the objects and the distribution of the guards. Again we look at hypercubes, but this time we only look at objects that are at least as large as the hypercube, and not only consider the guards inside the hypercube but also the ones in its vicinity. We define the vicinity of a hypercube # to be the hypercube obtained by scaling # with a factor of 5/3 with respect to its center. Thus, if we partition the vicinity of # into 5 d equal-sized subhypercubes, then # consists of the 3 d middle subhypercubes. The planar case is illustrated in Figure 1. vicinity of # Figure 1: A square # and its vicinity. We will show that the number of objects intersecting a hypercube # in R d and at least as large as # cannot be more than (roughly) O(g 1-1/d ), where g is the number of guards in the vicinity of #. We first reduce the problem to a simpler problem on so-called 3-blocks. Define a 3-block to be the hyperrectangle obtained by scaling an axis-parallel hypercube by a factor of 1/3 along one of the coordinate axes. We say that an object crosses a given hyperrectangle if there exists a curve inside the intersection of the hyperrectangle and the object that connects the two largest (and opposite) faces of the hyperrectangle. First we prove that if a hypercube is intersected by many larger objects, then there must be a 3-block in its vicinity that is crossed by many objects. Lemma 3.1 Let # be a hypercube intersected by a collection O of m objects that are at least as large as #. Then there is a 3-block contained in the vicinity of # that is crossed by at least m/(2d3 d ) objects. Proof: Partition # into 3 d equal-sized subhypercubes. One of the subhypercubes, say # , intersects at least m/3 d objects. Denote the set of objects intersecting # by O # . Let # be the hypercube obtained by scaling # with a factor three with respect to its center. Consider the 2d 3-blocks that are contained in # and have one of the 2d sides of # as a face-see Figure 2 for an illustration of the planar case. Note that # and, hence, all 2d 3-blocks, are contained in the vicinity of #. We shall argue that one of the 3-blocks is crossed by at least the four 3-blocks Figure 2: Illustration of the planar case in the proof of Lemma 3.1. The hypercube # has the same size as the original hypercube #. Hence, each object in O is at least as large as # . This implies that the objects cannot be fully contained in # . Thus, each object in O # has a point inside # and a point outside # . But this means that inside each such object we can find a curve connecting the two largest faces of one of the 2d 3- blocks. Hence, one of the 3-blocks must be crossed by at least |O # The next step is to prove a relation between the number of crossing objects and the number of guards in a 3-block B. The following auxiliary lemma will be called for in the proof of Lemma 3.3. Lemma 3.2 For any given hypercube # intersected by a set O of m objects, and any constant b with 0 < b 6 m, we can identify more than #m/(2 d+1 - 2)b# disjoint hypercubes inside # each intersected by at least b objects from O. Proof: We construct a tree on # by recursively identifying between 2 and 2 d subhypercubes in the current hypercube if it is intersected by at least 2 d b objects. Assume that we have a hypercube # intersected by at least 2 d b objects and consider its decomposition into 2 d equal-sized subhypercubes (by means of the d hyperplanes perpendicular to the coordinate axes and cutting the hypercube into two equal halves). We call a (sub)hypercube crowded if it is intersected by at least b objects. Note that at least one of the subhypercubes of # is crowded. Note also that each object intersecting # intersects at least one of the 2 d subhypercubes (because the objects are d-dimensional and open). . If the number of crowded subhypercubes of # exceeds one, then each of these crowded subhypercubes becomes a child of # in our tree. We charge the objects that do not intersect one of the crowded subhypercubes, to #. The number of such objects is at most (2 d . If the number of crowded subhypercubes of # equals one, then this subhypercube # is shrunk towards the vertex it shares with # until # is intersected by at least (2 d objects but # is still intersected by at least b objects. (Note that this is always possible because the objects are d-dimensional.) Now consider the 2 d hypercubes of maximal size contained in # and sharing a vertex with # . Since these hypercubes jointly cover # , at least one of them, say # , is crowded. The crowded hypercubes # and # become the children of # in our tree. We charge the at most (2 d objects that do not intersect # or # to # . The leaves of the resulting tree correspond to disjoint hypercubes that are intersected by at least b objects. We will see that there are at least m/(2 d+1 leaves. Let L and I be the number of leaves and internal nodes of the resulting tree, respectively. As every internal node has at least two children the number of leaves is larger than the number of internal nodes, so L > I. We notice that the number of objects charged to an internal node is at most (2 d - 2)b and the number of objects intersecting a hypercube corresponding to a leaf is at most 2 d b - 1. Since the number of objects charged to all internal nodes plus the number of objects intersecting the hypercubes at the leaves should at least be equal to m we have that m. Using the inequality L > I we obtain Lemma 3.3 Let G be a #-guarding set for a collection O of objects in R d , with d > 2. Let B be a 3-block crossed by m objects from O, and let # < m. Then there must be at least d3 d-1 (2 d guards from G inside B. Proof: We assume withou loss of generality that the short side of B has unit length. We l d3 d-1 (2 d slices of height 1/l by means of hyperplanes parallel to its two largest faces, which are (d- 1)- dimensional hypercubes of side length 3. The two largest (and opposite) faces of the resulting slices are again (d - 1)-dimensional hypercubes of side length 3; see Figure 3 for a three-dimensional 3-block and the l slices. We observe that each of the objects from O crossing B Figure 3: A 3-block B (with a crossing object shown shaded) is cut into l slices; each slice S contains a certain number of cubes (sharing a face with the face g of S) that must contain at least one guard. also crosses each of the l slices. Consider a slice S and let g be one of its two largest faces. The intersections with g of the m objects crossing B are (d - 1)-dimensional objects. Lemma 3.2 states that we can identify at least #m/(2 d dimensional hypercubes inside g, each of which is intersected by at least # the (d-1)-dimensional volume of g is 3 d-1 , the number of (d-1)-dimensional hypercubes with a side length exceeding 1/l is less than (3l) d-1 , so at least #m/(2 d -2)(#+1)#-(3l) d-1 (which is positive) of such hypercubes have a side length of 1/l or less. For every such hypercube #, take the d-dimensional hypercube # with # as a face and contained in the slice S; this is possible because the side length of # is at most 1/l (see Figure 3). The hypercube # is intersected by at least # because # is intersected by # must contain a guard. It follows that we need at least #m/(2 d per slice, which sums up to a total of d3 d-1 (2 d guards for the entire 3-block B. Combining the two lemmas above, we now prove that the number of relatively large objects intersecting a hypercube cannot exceed (roughly) the number of guards in its vicinity to the Theorem 3.4 Let G be a #-guarding set for a set O of objects in R d , with d > 2. Any hyper-cube whose vicinity contains exactly g guards from G is intersected by O(#(1+g 1-1/d from O that are at least as large as #. denote the number of objects at least as large as # intersecting #. From Lemma 3.1 we know that there is a 3-block B in the vicinity of # that is crossed by at least curves. Lemma 3.3 now implies that there must be at least guards in B. Since B is in the vicinity of #, this number must be less than or equal to g, which (together with the fact that B can still be intersected by # objects if it contains no guards) implies the theorem. We now turn our attention to the complexity of motion planning in two-dimensional workspaces that are either uncluttered or have small simple-cover complexity, and then extend the obtained results to three dimensions in Section 5. 4 The complexity of motion planning in planar workspaces Let R be a robot with f degrees of freedom, moving in a two-dimensional workspace amidst a set O of n obstacles. The robot R can be of any type: it can be a free-flying robot, a robotic arm, and so on. The only restriction is that it must have bounded reach [16], which is defined as follows. Let p R be an arbitrary reference point inside R. Then the reach of R, denoted by reach(R), is defined as the maximum distance that any point of R can be from p R , taken over all possible configurations of R. For instance, if R consists of two links of length 1 that are both attached to the origin, and the reference point is the tip of one of the links, then the reach of R is 2. (If the reference point would be the origin then the reach would be 1. For any two reference points, however, the two values reach(R) can be at most a factor of two apart.) A bounded-reach robot is now defined as a robot R with C#O {size(C)}, where c is a (small) constant. In this section we study the complexity of the free space of a bounded-reach robot R under the assumption that the set of obstacles satisfies one of the models defined above. We prove an # f worst-case lower bound on the free-space complexity for the most restricted model, namely for #-cluttered scenes. Because unclutteredness implies small simple- cover complexity in the hierarchy of input models [5], this bound carries over to scenes with small simple-cover complexity. Moreover, we prove an O(# f ((sn) f/2 + sn)) upper bound for scenes with a #-guarding set of size s - n. By the conclusions from Section 2, the upper bound immediately carries over to uncluttered scenes and scenes with small simple-cover complexity. Hence, in both models we get a tight bound of #(n f/2 n). 4.1 A lower bound for uncluttered scenes The robot R in our lower bound example consists of f links, which are all attached to the origin. The links have length 1 #, for a su#ciently small # > 0. Obviously R has f degrees of freedom. The set of n obstacles for the case of a 2-cluttered planar scene is defined as follows. (Later we adapt the construction to get the bound for #-cluttered scenes for larger but still constant #.) Recall that our obstacles are presumed to be two-dimensional. Fix an integer (a) (b) (c) new obstacle # bounding box of current scene the robot Figure 4: (a) Part of the lower bound construction. (b,c) Adding bounding-box vertices to make the scene uncluttered. parameter m; it will turn out later that the appropriate value for m is roughly # n. For a given integer i, let C i be the horizontal rectangle of length 1 and small height # whose lower left corner lies on the unit circle and has a y-coordinate equal to i/m-see Figure 4(a) for an example. Let O 1 := {C i | 1 6 i 6 m}; this set forms a subset of the set of all obstacles. The remaining obstacles, which we describe later, are only needed to turn the environment into an uncluttered environment. Consider any subset of f rectangles from O 1 . It is easy to see that there is a semi-free placement of R such that each rectangle in the subset is touched by a link of R. Hence, the free-space complexity is # m f ). When m is large, however, the set O 1 does not form an uncluttered enviroment: the dashed square in Figure 4(a) for instance, m) obstacles without having a bounding-box vertex of one of the rectangles in its interior. This problem would disappear if between every pair of adjacent horizontal rectangles there would be a collection of #(m) equal-spaced bounding-box vertices, as in Figure 4(b). If the distance between consecutive vertices is set to 1/2m then no square without a bounding-box vertex in its interior will intersect more than one obstacle from O 1 . Notice that in total we need #(m vertices for this. We cannot add tiny obstacles between the rectangles to achieve this, because such obstacles would be much smaller than the robot, so the robot would no longer have bounded reach. There is no need, however, to add obstacles between the rectangles; we can also create bounding-box vertices there by adding obstacles outside the current scene. Suppose that we wish to have a bounding-box vertex at a given point suppose that the current set of obstacles is contained in the rectangle we add the right triangle # with vertices (p x , y as an obstacle-see Figure 4(c). The point p is a bounding-box vertex of #, and # is disjoint from the current set of obstacles. By iteratively adding obstacles that generate the necessary bounding-box vertices between the rectangles in O 1 we transform the cluttered environment into an uncluttered one. The added obstacles are collected in a set O 2 ; our final set of obstacles is O . It is not di#cult to see that these obstacles form a 2-cluttered environment in this manner: any square without bounding-box vertices intersects at most one obstacle from O 1 or two obstacles from O 2 . We now have a collection of #(m 2 ) obstacles forming a 2-cluttered scene such that the free-space complexity is # m f ). By choosing a suitable value for m (in the order of # n), we obtain a collection of n obstacles such that the free-space complexity is # n f/2 ). To get the general bound we replace each of the m rectangles in the set O 1 by # (even thinner) rectangles of length 1 that are quite close together. The lower left corners of these rectangles still lie on the unit circle; the new scene is #-cluttered. It is still possible to choose the value #, which determines the length of the links of R, small enough such that any f-tuple of rectangles in the new set O 1 can be touched by a semi-free placement. Hence, the number of f-fold contacts has increased to # f m f ). By again choosing m to be roughly # n we get a bound of # f n f/2 ). In the specific case that f = 1 the maximum complexity is clearly# n). Theorem 4.1 The free-space complexity of a bounded-reach robot with f degrees of freedom moving in a two-dimensional #-cluttered scene consisting of n obstacles can be # f n f/2 +n). 4.2 An upper bound for scenes with linear-size guarding sets We want to prove an upper bound on the complexity of the free space of a bounded-reach robot with f degrees of freedom moving in a scene with a linear-size #-guarding set. The global structure of our proof will be as follows. We construct a decomposition of the workspace into cells that are not much smaller than the robot. The decomposition will have the property that none of its cells can have too many obstacles close to it. This means that the robot cannot have too many f-fold contacts when its reference point lies inside any given cell. Summing the number of f-fold contacts over all the cells using Theorem 3.4 yields the desired bound on the number of features of the free space. The decomposition we use is obtained by adapting (the first stage of) the partitioning scheme described by de Berg [4]. First we describe the exact properties that we require, and then show how to obtain a decomposition with the desired properties. reach(R). Define the expansion - o of an object o to be the Minkowski sum of with a square of size 2# centered at the origin. Hence, - contains exactly those points that are at a L# -distance of less than # from o. Note that the expansion of a square # is another square, whose edge length is 2# more than the edge length of #. Let O := { b C | C # O} denote the set of expanded obstacles. Lemma 4.2 Let O be a set of obstacles in R 2 (or R 3 ), and let G be a #-guarding set for O. Then there exists a set S of cells that are either squares (or cubes) or L-shapes with the following properties: (P1) the cells in S form a decomposition of a su#ciently large bounding square (or cube) of the set O of expanded obstacles; (P2) the number of cells in S is O(|G|); every cell in S whose size is greater than 2# is intersected by O(#) expanded obstacles; every cell in S whose size is less than or equal to 2# is a square (or cube) of size at least #. Proof: We prove the lemma for the planar case; the generalization to three dimensions is straightforward. Let G denote the set of points obtained by adding to every guard g # G the four corner points of the square of size 2# centered at g. The set G contains 5|G| points. We enclose O (and by a su#ciently large square and recursively decompose this square based on the points of G, as follows. Let G # denote the subset of points from G contained in the interior of a square # at some stage in the (quadtree-like) subdivision process. The square # is handled according to the following set of rules. 1. If size(#) 6 2# or G # then # is one of the cells in S. 2. If size(#) > 2#, G #, and not all points of lie in the interior of a single quadrant of #, then # is subdivided into four quadrants, which are handled recursively. 3. If size(#) > 2#, G #, and all points of lie in the interior of a single quadrant of #, then # is subdivided as follows. Let # be the smallest square containing the points from G # in its closure that shares a vertex with #. (a) If size(# then # is handled recursively, and the L-shape # is a cell in S. (b) If size(# ) 6 #, then let # denote a square of size # contained in # and containing # . The square # and the L-shape # are cells in S. It follows immediately from the construction that the cells in S satisfy Properties (P1) and (P4). A subdivision according to rule 2 splits the set G # into two nonempty subsets; a subdivision according to rule 3 puts one of the points of G # onto the boundary of a subcell. Both subdivisions can therefore be performed at most | b times. As a result, the number of cells will be O(| which proves (P2). It remains to prove Property (P3). By construction, any cell of size more than 2# contains no point from G. We now prove that any square # of size at least # that does not contain any points from G intersects at most # expanded obstacles. If the cell under consideration is a square this immediately proves (P3), and if it is an L-shape then it also proves (P3) because an L-shape of size at least 2# can be covered by three squares of size at least #. So consider a square # without points from G and whose size is at least #. The fact that # contains no points from G implies that its expansion - # contains no guard from G-see Figure 5 for an illustration. This means that - # is intersected by at most # original obstacles, which implies points added for p Figure 5: A guard from G inside - # implies a point of G in #. that # is intersected by at most # expanded obstacles. Now that we have a suitable decomposition of the workspace, we can use Theorem 3.4 to prove our main result. Theorem 4.3 Let R be a bounded-reach robot with f degrees of freedom, with f a constant, moving in a two-dimensional workspace containing a set O of n obstacles. If the set of obstacles has a #-guarding set of size s - n, then the complexity of the free space is O(# f ((sn) f/2 +sn)). Proof: If R touches an obstacle C, its reference point must lie in the interior of C. (This is true because we defined # as twice the reach of R.) Therefore we can bound, for any the number of k-fold contacts of R by bounding the number of k-tuples of expanded obstacles with a non-empty common intersection. The idea of the proof is to decompose the workspace according to Lemma 4.2 and then sum the number of k-tuples over all cells of the decomposition using Theorem 3.4. Let G be a #-guarding set of size sn for the obstacle set O, and let S denote a decomposition having the properties stated in Lemma 4.2. To bound the free-space complexity we have to bound the number of simultaneous contacts involving k obstacles, for By Property (P1) this means that the free-space complexity is bounded by f denotes the number of expanded obstacles intersecting the cell #. The asymptotic value of this sum is dominated by the term where so we ignore the other terms from now on. Let S 1 be the subset of S consisting of the cells of size larger than 2#, and let S 2 be the subset of S consisting of the remaining cells. By Properties (P2) and (P3) we have Now consider the cells in S 2 . By Property (P4) these cells are squares whose size lies between # and 2#. Let # be such a square. We claim that the number of expanded obstacles intersecting # is O(#(1 # is the number of guards from G in the vicinity of the expansion - #. It is important to observe that 3# 6 size(-#) 6 4#. Furthermore, any expanded obstacle intersecting # corresponds to an original obstacle that intersects - #. Because # 6 2c - min{size(C) | C # O} for a constant c, we can partition - # into O(1) subsquares whose size is smaller than the size of the smallest obstacle. By Theorem 3.4, this means that the number of original obstacles intersecting - # is O(#(1+ # g # )), where g # is the number of guards in the vicinity of - #. Hence, the number of expanded obstacles intersecting # is bounded by this quantity as well. We conclude that the number of f-tuples of expanded obstacles with a non-empty common intersection in a cell of S 2 is bounded by where g # is the number of guards in the vicinity of the expansion - #. Since all squares have size at least # by Property (P4), the vicinity of an expanded square in S 2 intersects O(1) other vicinities of expanded squares. Hence, a guard from G lies in O(1) vicinities, and we have which leads to Therefore the total number of f-fold contacts of R is bounded by 5 The complexity of motion planning in 3D workspaces Having described the two-dimensional setting in the previous section, we now turn our attention to a robot R moving in a three-dimensional workspace amidst a set O of n obstacles. As in the two-dimensional case, the robot is allowed to be of any type-we only require that its reach is bounded. We prove an # 2f worst-case lower bound on the complexity of the free space for #-cluttered scenes, and an O(# f ((sn) 2f/3 + sn)) upper bound for scenes with a #-guarding of size s - n. As before, this results in a tight bound of #(n 2f/3 +n) for uncluttered scenes. We also prove an # n f ) worst-case lower bound on the complexity of scenes with small simple-cover complexity. The maximum free-space complexity for such scenes is therefore #(n f ) and thus equivalent to the complexity for unrestricted scenes. 5.1 Lower bounds A lower bound for scenes with small simple-cover complexity We consider the scene consisting of n rings y, z) | shown in Figure 6. It was shown [6] that a similar scene consisting of unit circles has small simple-cover complexity but requires a #-guarding set of for any constant #. It is clear that these properties carry over to our scene in which the circles are replaced by thin rings. Our robot R consists of f links, which are all attached to the point (0, 2, 0). Each link has length 2 and rotates about the axis y, z) | causing it to stay inside the xy-plane. Note that the size of the robot is comparable to the size of the obstacles so it has bounded reach. For any subset of f rings, there is a semi- the robot x z y Figure The lower-bound construction. placement of R such that each ring C i in the subset is touched by a link of R. As a consequence, the free-space complexity is # n f ). Theorem 5.1 The free-space complexity of a bounded-reach robot with f degrees of freedom moving in a three-dimensional scene with small simple-cover complexity consisting of n obstacles can be # n f ). A lower bound for uncluttered scenes Our approach to obtaining a worst-case lower bound for 3D #-cluttered scenes is similar to the planar case. We fix a parameter m and consider the set O 1 of m 2 thin unit-length rectangloids y, z) | #, Consider the m 2 planes through pairs of obstacles and choose a point that lies on none of these planes and satisfies 1/2 < x q , y q < 1/2 Our robot R has f links, which are all anchored at q. Each link has length 1 and is able to rotate about the axis y, z) | causing it to stay inside the plane z = 1/2; the choice of q allows it be placed in contact with each obstacle in O 1 . Figure 7(a) shows the intersection of the scene with the plane z = 1/2. The size of R is comparable to the size of the obstacles in the robot x z y x y obstacle (a) (b) points Figure 7: (a) Cross-section of the environment at z = 1/2. (b) Magnified portion of the scene showing a single obstacle and the four sequences of points (bounding-box vertices) immediately surrounding it. O 1 . For any subset of f obstacles there is a semi-free placement of R such that each obstacle C i,j in the subset is touched by a link of R. Hence, the complexity of the free space is # m 2f ). To prevent cubes from intersecting more than one obstacle from O 1 we put sequences of points on each of the lines l = {(x, y, z) | see Figure 7(b) for one obstacle and the points surrounding it. The distance between two consecutive points on a single line is again equal to 1/2m. We turn the #(m 3 ) points into bounding-box vertices by iteratively adding tetrahedral obstacles in a way similar to the planar case. The resulting #(m 3 ) obstacles are collected in O 2 , and our final set of obstacles is Any cube without bounding box vertices intersects at most one obstacle from O 1 or two obstacles from O 2 . As a result, we now have a collection of #(m 3 ) obstacles forming a 2-cluttered scene with a free-space complexity of # m 2f ). By choosing the free-space complexity becomes for the set of n obstacles. As in the two-dimensional example, we now replace each of the m obstacles in O 1 by # obstacles that are close together and arranged such that each of them can be touched by the links of R. The resulting scene is #-cluttered, and the number of f-fold contacts increases The theorem follows from again choosing n. By again choosing m to be roughly n 1/3 we get a bound of # f n 2f/3 ). Again the maximum complexity is # n) in the case that f = 1. Theorem 5.2 The free-space complexity of a bounded-reach robot with f degrees of freedom moving in a three-dimensional #-cluttered scene of n obstacles can be # f 5.2 An upper bound for scenes with linear-size guarding sets Proving an upper bound on the free-space complexity of a bounded-reach robot with f degrees of freedom moving in a scene with a linear-size guarding set is entirely analogous to the two-dimensional case. Theorem 5.3 Let R be a bounded-reach robot with f degrees of freedom, with f a con- stant, moving in a three-dimensional workspace containing a set O of n obstacles. If the set of obstacles has a #-guarding set of size s - n, then the complexity of the free space is Proof: Analogous to the proof of Theorem 4.3, except that which yields 6 Conclusion We have established that the maximum complexity of the free-space of a bounded-reach robot with f degrees of freedom moving in an uncluttered scene is #(n f/2 +n) in R 2 and #(n 2f/3 +n) in R 3 ; the planar bound also holds for scenes with small simple-cover complexity. These bounds fit nicely between the #(n) bound for low-density scenes-which are more restrictive- , and the #(n f ) bound for unrestricted scenes. Surprisingly, the maximum complexity of the space for a robot moving in a 3D scene with small simple-cover complexity is equal to #(n f )-the bound for unrestricted scenes. Motion planning in low-density environments can be solved in an amount of time that is almost equal to the maximum free-space complexity [20]. It is interesting to see if a similar result is possible for uncluttered scenes and scenes with small simple-cover complexity. --R Computing depth orders for fat objects and related problems. Approximate motion planning and the complexity of the boundary of the union of simple geometric figures. Implementation and extension of the ladder algorithm Linear size binary space partitions for uncluttered scenes Realistic input models for geometric algorithms Guarding scenes against invasive hypercubes On the union of Dynamic data structures for fat objects and their applications. Fat triangles determine linearly many holes Range searching and point location among fat objects "piano movers" Range searching in low-density environments The complexity of the free space for a robot moving amidst fat obstacles The complexity of the free space for motion planning amidst fat obstacles Motion planning amidst fat obstacles. Motion planning amidst fat obstacles Motion planning in environments with low obstacle density. On fatness and fitness-Realistic input models for geometric algorithms --TR Efficient hidden surface removal for objects with small union size Fat Triangles Determine Linearly Many Holes Motion planning amidst fat obstacles (extended abstract) The complexity of the free space for a robot moving amidst fat obstacles Computing depth orders for fat objects and related problems Range searching and point location among fat objects Range searching in low-density environments Realistic input models for geometric algorithms 3-D vertical ray shooting and 2-D point enclosure, range searching, and arc shooting amidst convex fat objects On the union of <italic>k</italic>-curved objects Dynamic data structures for fat objects and their applications --CTR Mark de Berg , Haggai David , Matthew J. Katz , Mark Overmars , A. Frank van der Stappen , Jules Vleugels, Guarding scenes against invasive hypercubes, Computational Geometry: Theory and Applications, v.26 n.2, p.99-117, October Esther Moet , Marc van Kreveld , A. Frank van der Stappen, On realistic terrains, Proceedings of the twenty-second annual symposium on Computational geometry, June 05-07, 2006, Sedona, Arizona, USA
motion planning;free space complexity;input models
599532
On the autocorrelation structure of TCP traffic.
The statistical characteristics of network traffic--in particular the observation that it can exhibit long range dependence--have received considerable attention from the research community over the past few years. In addition, the recent claims that the TCP protocol can generate traffic with long range dependent behavior has also received much attention. Contrary to the latter claims, in this paper we show that the TCP protocol can generate traffic with correlation structures that spans only an analytically predictable finite range of time-scales. We identify and analyze separately the two mechanisms within TCP that are responsible for this scaling behavior: timeouts and congestion avoidance. We provide analytical models for both mechanisms that, under the proper loss probabilities, accurately predict the range in time-scales and the strength of the sustained correlation structure of the traffic sending rate of a single TCP source. We also analyze an existing comprehensive model of TCP that accounts for both mechanisms and show that TCP itself exhibits a predictable finite range of time-scales under which traffic presents sustained correlations. Our claims and results are derived from Markovian models that are supported by simulations. We note that traffic generated by TCP can be misinterpreted to have long range dependence, but that long range dependence is not possible due to inherent finite time-scales of the mechanisms of TCP.
Introduction The existence of non-degenerate correlation structures over a range of timescales in network tra-c has been observed in a variety of network environments, such as Ethernet tra-c [1], Networks tra-c [2], and World Wide Web tra-c [3]. There have been recently many research eorts to investigate various aspects of this characteristics, for example, modeling techniques ([4, 5, 6, 7]), impact on network performance ([8, 9, 10]), and explanations for the presence of such correlation structures ([3, 11, 12, 13]). Several eorts to explain this correlation structure of the network tra-c have been made from dierent perspectives. Crovella et al. [3] conjectured that the strong correlated behavior in network tra-c is caused by the heavy-tailed distribution of WWW documents sizes, the eect of caching, and human thinking time. All these causes come from the application or user level perspectives and can generate self-similar data tra-c through the underlying transport protocols. In [11], the authors studied the chaotic behavior of TCP congestion control and concluded that the assumptions in [3] are not necessary to explain the origin of self-similarity in data tra-c. The authors argue that the \chaos" created by the TCP congestion control alone can generate self-similarity. The conclusions reached by the authors of [11] are puzzling as they report on TCP behavior that is periodic in nature, as the authors themselves point out (albeit with a possibly long period), and thus, not chaotic. Consequently, this behavior cannot generate self-similarity in network tra-c. The work also raises the question as to how and why exhibits the long term temporal correlations that they report. In this paper we provide another possible explanation for the non-degenerate correlation structure in network tra-c. In particular, we analyze the TCP protocol and show how its mechanisms can generate such tra-c patterns. These mechanisms do not by themselves give rise to self-similar tra-c. However, we show that the tra-c induced by these mechanisms has a similar correlation structure within similar timescales to that of measured Internet tra-c of previous studies. Since most applications use TCP as their data transport protocol and the majority of the network tra-c is carried by TCP, one can easily misinterpret the origin of these correlation structures. The eorts that have tried to explain self-similarity from an upper level perspective can just as well be explained by TCP itself. They are not necessary in order to generate the correlation structures in the network tra-c if TCP is used as the transport protocol. As a result, we point out that one should be careful when claiming to identify the cause of correlation structures observed in network tra-c. We now describe two dierent related works as follows. In a pioneering paper [12], Man- thorpe, et al. point out that real network tra-c is not strictly self-similar, but exhibits a correlation structure only over a nite range of timescales. They then introduce the terms pseudo self-similarity and local Hurst parameter to describe the correlation structure of data tra-c over a this range of timescales instead. A process is pseudo self-similar if the variance of the aggregated process over a nite range of timescales decays linearly in a log-log plot. The local Hurst parameter is dened to be a simple function of the slope in this range of timescales. Formal and precise denitions of a pseudo self-similarity and local Hurst parameter are given in [6] and [12], respectively. In this paper, we will adopt these terminologies to refer to the correlation structure of the network tra-c. This will allow a comparison between the local Hurst parameter and the Hurst parameter previously used in the literature. Also in [12], the authors discover through simulation that under certain conditions, TCP protocol can generate pseudo self-similar tra-c. They claim that the combination of TCP with the heavy-tailed distribution of round trip delays and the wide range of transmission rates seen in real networks are responsible for introducing pseudo self-similarity in data tra-c. In another related work [13], Guo et al. claim that the TCP congestion control mechanism generates heavy-tailed periods in the tra-c transmission pattern, which then introduces long-range dependence in the overall tra-c. The authors try to explain the self-similarity of TCP using the framework of multiplexing ON/OFF processes with heavy-tailed ON or OFF period, and also in terms of its chaotic behavior. We note that formally, the periods in the TCP congestion control mechanism are not heavy-tailed, since the maximum o period is bounded by the maximum timeout value. Hence it is erroneous to conclude that the TCP congestion control mechanism produces self-similar tra-c in the absence of other mechanisms. A limitation of their analysis is that the pseudo self-similarity only occurs when the loss probability is between 1/8 and 1/4. This is not consistent with observations of pseudo self-similarity in TCP tra-c under lower loss probabilities, as was also observed by the authors. In this paper we show that TCP protocol itself, in particular, its exponential back-o and congestion avoidance mechanisms, gives rise to pseudo self-similar tra-c over a range of timescales. We construct separate Markovian models for each of these mechanisms and present analytical results that support our claim. Simulation is also used to support our claim and validate the models. We show that the local Hurst parameter predicted by the models for typical network packet loss probabilities lies in the same range as the values obtained from previous measure- ments, for example [1, 3, 14]. Our analysis applies to a wide range of loss probabilities, including very low loss probabilities. We further demonstrate that the analysis of real TCP traces agrees with the range of timescales predicted by the analytical models. Moreover, under certain net-work conditions, we show that the local Hurst parameters obtained from the model are similar to the ones calculated from real traces. We relate the parameters of the timeout and congestion avoidance mechanisms to the local Hurst parameter and the timescales each mechanism exerts. Finally we provide a possible argument for the pseudo self-similarity of the aggregate TCP ows in real networks based on our model analysis. The rest of the paper is organized as follows. Section 2 describes the TCP timeout and congestion avoidance mechanisms and presents two Markov chains to model them. Section 3 presents the mathematical framework used to analyze the models, and demonstrates that both models give rise to pseudo self-similar tra-c over a certain range of timescales. Section 4 provides simulation results to validate our models and support the analytical results. Discussions on model parameters and remarks on the aggregation of TCP ows are given in Section 5. Finally, in Section 6 we present our conclusions. Congestion Avoidance Models In this section we describe the behavior of TCP timeout and congestion avoidance mechanisms via Markov chains. Our purpose here is not to provide a detailed or complete model of the TCP protocol, but rather to highlight and investigate the timeout and congestion avoidance mechanisms of TCP using dierent models to demonstrate that both features of TCP can lead to strong correlation over a nite range of time scales. TCP is a network transport protocol that provides reliable end-to-end data communication [15]. It is a window based protocol and performs ow control and congestion control, by regulating its sending window size through an additive increase/multiplicative decrease mechanism. includes dierent mechanisms inside its complex suite, among which Congestion Avoidance and Timeout Back-o can have an important eect in the tra-c pattern. 2.1 Timeout (TO) Model TCP uses a timeout mechanism to achieve reliable transmission of data and to avoid congestion collapse [15]. Each time a packet is sent out from the source, TCP starts a retransmission timer and waits for the acknowledgement from the receiver. TCP keeps a run time average of the round trip time (RTT) and sets the duration of its timer (RTO) based on the average and variance of the RTT estimate. If the packet is lost, the sender will not receive the acknowledgement for that packet and the timer will eventually expire, if no triple duplicate acks are received. Upon a timeout the packet is retransmitted and the sending window is set to one. This reduces the sending rate and hopefully relieves the network congestion. If the congestion continues and the retransmission is lost, TCP doubles the current timeout value of the next retransmission to further reduce the sending rate and adapt to the congested network. This exponential back-o continues for each potential retransmission after the rst timeout occurs. When the subsequent segment of data is successfully transmitted, TCP recomputes the RTT estimate, resets the timeout value accordingly and resumes the normal mode of operation. In most TCP implementations, the timeout is backed o to a maximum of 6 times, giving time-out values that are equal to 64 times the original timeout. After the timeout value reaches its maximum, it does not further increase and remains the same if loss continues. 4,5,1 Figure 1: TCP timeout model For both the TO model and the following congestion avoidance (CA) model, we assume the packet loss is described by a Bernoulli process with parameter p and that acknowledgement packets are never lost in the network. Based on the TCP timeout mechanism, we can construct a discrete time Markov chain illustrated in Figure 1 to model the timeout behavior. The single parameter of the model is the packet loss probability p). The detailed explanation of the chain is given as follows. Denition of the States: A state in the Markov chain is represented by the tuple where T indicates the time (RTT 2 T ) until the next packet transmission; E indicates the current value of the back-o exponent; and R indicates if the packet being sent is a retransmission (R = 1) or a new packet (R = 0). Note that both T and E range from 0 to 6, and that the time spent in each state is always a multiple of the RTT. Transition probability matrix: Once TCP enters the back-o mode of operation, if a retransmitted packet is lost, then the time until the next transmission is given by the current timeout value. If a packet is successfully transmitted, then the time until the next transmission is given by a single RTT. Note that it takes two consecutive successful packet transmissions in order for TCP to resume its normal mode of operation and reset its back- exponent. Moreover, every time a packet is lost, the back-o exponent is increased by one to double the timeout value. Figure 1 illustrates all the possible transitions in the model. 2.2 Congestion Avoidance (CA) Model We now focus on the congestion avoidance mechanism and ignore the presence of timeouts to better capture the behavior of the additive increase/multiplicative decrease mechanism of the window size. By changing the congestion control window size, TCP regulates the amount of data it injects into the network and, thus, adapts to dierent network conditions. TCP exits the slow start phase and enters congestion avoidance after the window size exceeds a certain threshold, which is set to one half of the maximal window size value that was reached before the previous congestion. In the congestion avoidance phase, the window size increases by one packet when all packets in the current window are successfully acknowledged. Hence, the window size grows linearly during the congestion avoidance phase. When a packet is lost, TCP decreases the size of the current congestion window to reduce the amount of tra-c it injects into the network. In most versions of TCP that are currently deployed, such as TCP Reno and TCP Sack, the window size is reduced by half if three duplicate acknowledges for the same packet are received. If a timeout occurs, the window size is reduced to one and, after resuming from the timeout mode of operation, TCP starts the window growth cycle again. Figure 2: TCP congestion avoidance model In the CA model, we only consider window reduction events that are due to triple duplicate ACKs, ignoring the timeout events and the slow start phase. Hence, the window grows linearly when no loss occurs and is reduced to half upon congestion. We also make the common assumption that the RTT is larger than the time required to send all packets in a window [16]. The model is very simple and has two parameters: the maximum window size (W max ) and the packet loss probability (p). The Markov chain for this model is illustrated in Figure 2 and is explained as follows. Denition of the states: The state is represented by a single variable that indicates the current window size of the TCP sender. This variable ranges from one to the maximum window size (W max ). The initial state depends on the value of the CA threshold, and can range from 1 to bW max =2c. Note that the time spent in each state is equal to one RTT. Transition probability matrix: During the CA phase, the window size increases by one packet when all packets in the current window have been successfully acknowledged, provided that the current sender window lies below its maximum value. Thus, the transitions occur after the window is fully transmitted. The probability that all w packets of the current window are successfully acknowledged is (1 p) w . Once the window size reaches its maximum value, it remains at this value until a packet is lost. Whenever a packet is lost, the TCP sender reduces the window size to half, causing a transition from state w to state bw=2c. The probability that at least one packet is lost among the w packets in the current window is just 1 (1 p) w . Therefore, (1) 3 Model Analysis In this section we rst describe the mathematical framework used to analyze the correlation structure of both the TO and CA models. We then demonstrate various analytical results that support our claim of sustained correlation in TCP tra-c over a nite range of timescales. To construct and analyze both models, we use the TANGRAM-II modeling tool 1 [17], which allows us to easily obtain, among other measures, the autocorrelation function for each model [18]. Using the autocorrelation function, we then perform the numerical procedure described below to obtain the local Hurst parameter estimate plot. With this plot, we can visually inspect the timescales over which the model generates pseudo self-similar tra-c. For simplicity, we let the value of the RTT be 1 in both the CA and TO models. 3.1 Estimation of local Hurst parameter A crucial step in validating our model is demonstrating the fact that it generates pseudo self- similarity. A technique frequently used in literature for estimating the (local) Hurst parameter is that based on wavelet analysis. Wavelet based estimators [19] are computationally very e-cient, and robust in the presence of non-stationarities in extracting out the \self-similar" nature of a given signal. The plot most frequently used to both demonstrate and estimate self-similarity in a given trace or time series is the energy scale plot. In these plots, the logarithm of the variance of the wavelet coe-cients of the analyzed signal in a particular scale, is plotted vs that particular scale. The x-axis in these plots is on a log 2 scale. Linear regions in these plots indicate \self- similarities", and the slope of the linear region gives an estimate of the (local) Hurst parameter. The variance of the wavelet coe-cients measures the \energy" in the signal in the given scale. If we go back to the analysis presented in [20], [19], we see that this \energy" is really an estimate of the power spectral density of the process about a frequency determined by the particular scale. The frequency progression in scales is logarithmic, i.e. the j th wavelet space, denoted by the scale 2 j , represents a frequency 2 j 0 , where 0 is determined by the sampling rate of the time series and the particular choice of the analyzing wavelet. The (local) Hurst parameter is then estimated by rst estimating the local polynomial decay coe-cient of the power spectral density ( 1=f ). Recall that in the energy scale plots the variance (\energy") is plotted on a log scale, and since the scales themselves represent a logarithmic progression of frequencies, the variance scale plot is essentially a double log plot of the power spectral density. Linear regions in such a plot represent polynomial decay of the power spectral density with a constant coe-cient . This is related to the local Hurst parameter via the relation 1)=2. Thus, the wavelet based estimators calculate the Hurst parameter implicitly, with the intermediate step of estimating the slope of the power spectral density on a double log plot. The power spectral density of a (stationary) stochastic process is dened as the Fourier transform of its autocorrelation function. Since we have a technique of calculating the auto-correlation functions of our Markovian models numerically, we can compute the power spectral 1 TANGRAM-II is publicly available at http://www.land.ufrj.br energy power spectral density Timescale Log(energy) Log(power spectral Octave Figure 3: Relating the variance scale plot to the double log plot of power spectral density density of the process by taking a discrete time Fourier transform of the autocorrelation func- tion. We can then plot the resultant power spectral density on a double log plot, revealing pseudo self-similarities and we can identify local Hurst parameters by calculating the slopes of the linear regions of those plots. We use wavelet based estimators later on in the paper to estimate local Hurst parameters of time series obtained from experiments and simulations, and to maintain consistency of presentation we plot the analytically obtained power spectral density using similar axes. That is, the x-axis is plotted using a log 2 scale of decreasing frequencies (recall that a wavelet space j corresponds to a frequency of 2 j 0 , and the energy scale plots have wavelet spaces and thus timescales increasing along the x-axis), and the y-axis plots log 10 of the power spectral density (the energy scale plots use log of the energies, which in turn are estimates of the power spectral density). We label the x-axis in the power spectral density plots by timescales rather than frequency, to both maintain consistency with the wavelet plots as well as to retain the intuitive nature of plots, in which quantities increase from left to right (timescale is the inverse of frequency, hence decreasing frequencies represent increasing timescales). Thus, the reader should visually interpret these plots the same way as the energy-scale plots commonly used in literature and elsewhere in this paper. An illustration is shown in Figure 3. Interpreting the left and bottom labelling as the y and x axes, the energy-scale plot is drawn by connecting the discrete points corresponding to the logarithm of the energies in scales 2 j by straight lines. Those energies and scales map on to power spectral densities and frequencies (timescales) and interpreting the right and top labelling as the axes, we obtain a smooth curve which goes along the points plotted in the energy-scale plot. 3.2 Analysis of the TO model We begin by presenting the results of the TO model. Figure 4 illustrates the local Hurst estimates obtained under dierent loss probabilities. The x-axis represents the timescales in units of RTT and in log 2 scale (i.e., RTT 2 x ). The y-axis represents the log of the power spectral density as discussed in the previous section. From the plot, we observe that all curves have a linear increasing part and then gradually become a at horizontal line. As described in the previous subsection, the local Hurst parameter can be related to the slope of the linear increasing part of the curve by is the slope of the linear part. The values of H for dierent packet loss probabilities can be observed in Figure 4, and they range from 0.5 to 0.8. These values are consistent with the results obtained from previous studies of real network tra-c [1, 3], where the value of H (greater than 0.5) is used to indicate the degree of self-similarity in tra-c. Note that as the loss probability increases, the local Hurst parameter also increases, provided the loss probability is kept under 30%. An intuitive explanation for the behavior is that, as the loss probability increases, the system is more likely to move to higher values of the back-o exponent (right-hand side of the model), instead of mostly staying in the rst few states when the probability is low. This is likely to introduce more correlation in the generated tra-c. From the results in Figure 4, we also observe that, as the loss probability increases, the timescales at which the process exhibits pseudo self-similarity increases. For low loss probabilities the model exhibits little correlation structure, which can be observed by the presence of a at horizontal line in the local Hurst parameter plot. Loss Probability 1% 5% 10% 20% 30% Timescale Log Figure 4: Analysis of the Timeout model -5 Loss Probability 50% 40% 30% Timescale Log Figure 5: Analysis of the Timeout model under high loss probability One could ask what would happen if the model was exposed to severe packet loss conditions and conjecture that the correlation structure would be more pronounced. Figure 5 illustrates this situation and presents the results seen by the model subjected to high loss rates. Note that as the loss probability increases past 30%, the time scales over which the model generates pseudo self-similarity decreases slowly. However, the local Hurst parameter obtained from the slope of the linear rise of the curves remain around 0.75. Intuitively, when the loss probability is high, the dynamics of our model drift to the states with high inter-packet delay. However, due to the nite state space of the model, the largest inter-packet delay is RTT 2 6 . The peaks in the linear rise of the local Hurst parameter curves are due to periodic behavior of the autocorrelation function. The autocorrelation function has periodic oscillations with period of 64 RTT, which is caused by the structure of the Markov chain. The reason that these peaks do not appear in wavelet analysis of measured traces is that wavelet analysis uses an average value of the energy around each octave. 3.3 Analysis of the CA model We now focus on the analysis of the CA model. Figure 6 illustrates the results obtained with the model under dierent loss probabilities. Here the maximum window size, W max , was set to 30. This is a typical value in TCP connections in real networks. From the results, we observe that all local Hurst estimate curves have a linear increasing part, similar to the previous model. Again, the slope of this linear part can be related to the local Hurst parameter. For all loss probabilities analyzed, the values for H range from 0.5 to 0.8, and are larger for smaller loss probabilities. It's worth noting that in all of the measures obtained, the local Hurst estimate plot stops increasing at a given timescale, and becomes a at horizontal line. This illustrates that the process is pseudo self-similar only over a certain range of timescales. This range of timescales also increases as the loss probability decreases. -5 1% 5% 10% 20% 30% Loss Probability Timescale Figure Analysis of the Congestion Avoidance model An interesting question is what happens to the range of timescales and the local Hurst parameter when the model is exposed to very low loss probabilities. Figure 7 illustrates the results of models with dierent low loss probabilities and dierent values of W max . We start by inspecting the results when the loss probability is 1%. In this case, the W max parameter has very little impact, for values of 30, 60 or 120. All three values exhibit exactly the same local Hurst estimate curve, as shown in Figure 7. As the loss probability decreases to 0.5%, we notice that the values for W max of 60 and 120 are indistinguishable, but the value of that larger timescale, over which the tra-c exhibits pseudo self-similarity. Decreasing the loss probability even further to 0.1%, we see that the timescales for W max of 60 and 120 dier, and that the latter has a longer range of timescales at which pseudo self-similarity exists. Intuitively, this behavior arises from the fact that model tends to drift to states with a larger window size when the loss probability is low. But since the chain is nite, this drift is inherently limited. Thus, larger values of W max allows the model to perform this drift to rightmost states of the chain. However, this drift only occurs with very low loss probabilities, since in this case the probability that the window increases past some large value is not negligible. 1% 0.1% Loss Probability 0.5% Timescale Log Figure 7: Analysis of the Congestion Avoidance model under very low loss probability We nish this section by outlining the behavior of both models under dierent loss probabil- ities. The local Hurst parameter and the range of timescales over which the TO model exhibits pseudo self-similarity increases as the loss probability increases. In contrast, the CA model predicts that the local Hurst parameter and the range of timescales increases as the loss probability decreases. A nal comment is that in the general case (i.e., W the range of timescales of the TO model is much larger than the range of timescales of the CA model. Thus, these two mechanisms combined play important roles at dierent timescales in the TCP protocol. 4 Simulation Scenario In this section we use simulation to support our claim that the TCP internal mechanisms can generate pseudo self-similar data tra-c over a nite range of timescales. We also validate both TO and CA models with results obtained from simulation. Loss Agent prop delay Figure 8: Simulation scenario All simulations in this work were performed using the NS-2 simulator [21]. A simple network topology, consisting of a single source, a queue and a receiver, was simulated to investigate the tra-c correlation structure generated by a single TCP session over a lossy link. A single TCP session allows us to easily control the loss rate of the packet ow. We note that in a multiple session scenario, a specic TCP ow will have similar behavior to the single session case. This holds if the loss process applied to both ows is the same. Thus, it su-ces to investigate the single session case. Figure 8 illustrates the model being simulated. The sender object acts as an innite source; thus it always wants to send as much data as possible. The queue object stores packets from the source and forwards them to the receiver. We assume that the queue has an innite buer space to minimize the correlation of packet losses. The loss agent is attached to the queue and drops packets randomly at the time of their arrival according to a Bernoulli process with parameter p. The receiver simply collects the data packets sent. The data transfer between sender and receiver is done using the SACK version of the TCP transport protocol [22]. We assume that the ack packets sent by the receiver are never lost. The parameters varied during our experiments are the loss probability, the link propagation delay (which is important to determine the RTT), and W max , the maximum window size of the TCP protocol. All other parameters were kept constant throughout the experiments. In all our simulation experiments, a single TCP ow is investigated and there is no background tra-c. All packets traversing the queue belong to the TCP session. In our experiments, the simulations were usually executed for 1 or 2 hours of simulation time, corresponding roughly to the transmission of 10000 to 300000 packets, but this strongly depends on the loss probability. After a simulation run, two time series of packet versus time can be collected from the traces. One time series corresponds to the link between the sender and the queue (before the loss agent), and the other between the queue and the receiver (after the loss agent). In all results presented, we analyze the rst time series. For purposes of our study, we veried that both time series have very similar behavior, thus our conclusions also hold for the latter time series. We used the Wavelet Analysis Method to analyze the time series generated by the simula- tion. Before performing the wavelet analysis, the time series was aggregated into bins with size smaller than one RTT. The aggregated time series was analyzed using the publicly available tool developed by Veitch and Abry [19]. It's important to note that the tool generates a wavelet graph where the x-axis represents timescales (AGR 2 x , where AGR is the aggregation level of the time series), and the y-axis represents the "energy" at that timescale with a 95% condence interval. 4.1 Observations from Simulation Figure 9 shows the results of the wavelet estimator for the single TCP session model shown in Figure 8 with dierent loss probabilities. The link propagation delay was set to 80ms, the link bandwidth to 1000 packets/sec and W max was set to 30. Notice that the time to transmit the maximum window (30ms) is smaller than the RTT (around 160ms), which agrees with previous assumption. The results shown are for TCP SACK, which is the deployment trend of TCP in the Internet []. However, we also simulated and analyzed TCP Tahoe, which generated results very similar to the ones shown here. Note that as the loss probability increases, the timescales over which pseudo self-similar tra-c is present increases. We also note that even for a low loss probability, the simulation results still exhibit some correlation structure for a small range of timescales. These two observations will be further discussed in the next section. Our rst observation is that a single TCP ow can exhibit pseudo self-similarity on the tra-c over a nite range of timescales. This is observed in Figure 9. The same observation was also made in [12] where the authors use a dierent simulator and a more complex network model (i.e., more protocol layers). In [13], the authors also made similar observation through NS simulations, using a sequence of short-lived (15 packets) TCP ows. We point out that the TCP TO and CA mechanisms are responsible for this pseudo self-similarity in the data tra-c Octave Octave Octave Loss probability: 2% Loss probability: 5% Loss probability: 30% Loss probability: 20% Figure 9: Wavelet analysis of the simulation traces over some range of timescales. 4.2 Model Validation In order to verify that the models proposed in section 2 actually capture the general behavior of the TO and CA mechanism, we validate some measures obtained from the models with simulation results. We start by validating the TO model and subsequently we present a validation for the CA model. Using the TO model, we can compute the limiting probabilities of the value of the timeout back-o exponent just before a packet is transmitted. Let B be a a random variable denoting this value. The probability density function, P can be obtained by solving the model numerically and analyzing the traces from the simulation. The values for B can be easily obtained in the simulation since TCP maintains this variable as part of its current state. Note that the timeout mechanism is well captured by the random variable B, and its value is independent of other internal mechanisms. Figure presents the results obtained for the model and the simulation with a 95% con- dence interval. The simulation setting had W propagation delay equal to 80ms. A total of 10 simulation runs were executed, each run lasting a few hours in simulation time, in order to obtain accurate estimates. The results from the model match the simulation results quite well for higher values of loss probability. But as the loss probability decreases, the simulation results starts to starts to deviate from the model. An explanation for this small discrepancy is that for low packet loss probabilities, it is likely Analytical Model Simulation Backoff Exponent [Backoff Exponent when a packet is Packet Loss Probability: 20% 10% 5% 2% Figure 10: Comparison between TO model and simulation results Loss probability E[W ]; W classical formula 30% 1.9 1.9 1.9 2.2 20% 2.4 2.4 2.4 2.7 1% 12.4 12.4 12.4 12.2 0.1% 26.6 38.6 40.8 38.7 Table 1: Expected value for window sizes in the CA model that a lost packet will not lead to a timeout in the simulation, while in the model every packet loss leads to a timeout. Note that in the simulation (as in the real TCP protocol) packets can be retransmitted due to triple duplicate acks, which occur more frequently under low loss probability. Thus, the model overestimates the limiting probabilities for values of B greater than zero. The discontinuity and the large condence intervals for the low packet loss probability are due to the fact that for low loss probabilities, the probability that B assumes a larger value is very small (i.e., 10 6 ), and cannot be easily obtained through traditional simulation techniques. The validation of the CA model with simulation results is more subtle, since the inner mechanisms of the TCP protocol that aect the window size cannot be easily isolated (i.e., slow start, TO mechanism, fast retransmit). Therefore, the validation with NS simulation is di-cult and not meaningful, since many functionalities of TCP would have to be disabled in order to obtain a correct and fair estimate of the window size. To cope with this problem, we investigate the expected window size when the model is in steady state, namely, E[W]. This result can be compared with the classical TCP formulas for throughput and expected window is the packet loss probability and k is a constant between 1 and We use the traditional value of 1:22. Note that this classical result models solely the CA phase of the TCP protocol and ignores the presence of slow start, timeouts and other enhanced features. The formula also assumes that W max will be large enough not to interfere or limit the expected value. Since the model isolates the CA mechanism from the complete protocol, we expect the model to agree with the classical formula. In Table 1 we present the values of E[W ] obtained from our CA model under dierent loss probabilities and with dierent values for W max , together with the results from the classical formula above. Note that the model and the classical formula yields similar results (W for various loss probabilities. However, for very small loss probabilities, W max parameter has a signicant impact, since it establishes an upper bound for the window size. But by increasing the W max parameter, out model is able to capture the value of E[W ] as predicted by the classical formula. In all cases where the maximum window size was large enough, the model presented results very similar to the classical E[W ] formula. The expected window size will also have a signicant impact on the range of timescales over which the model generate pseudo self-similar tra-c. This will be discussed in detail in the next section. For now, note that for very low loss probabilities, E[W ] depends on the value of parameter, and that decreasing the loss probability increases the E[W ]. This behavior is expected and can be observed both from the model and the classical formula results. Discussions In this section we rst investigate dierent aspects of the models contributing to the shape of the local Hurst estimate curve. In particular, we identify the timescales at which the models produce pseudo self-similar tra-c. We then provide a possible explanation for the pseudo self-similarity observed in real network tra-c based on our results for a single TCP ow. We start by revisiting the CA model and relate the knee of the local Hurst estimate curve where the linear increase starts to atten to a horizontal line. Figure 11 presents the same results obtained in Section 3 but with a cross at the end of the range of timescales over which the local Hurst estimate curve shows linear growth. These points were approximated by log 2 (RTT E[W ]), with RTT equal to 1. We observe that these cross points do establish a timescale beyond which the tra-c correlation structure disappears. This observation holds true for all the results obtained from our model. Since E[W ] from the model agrees with the classical TCP formula, as shown in Section 4, the classical formula can be used to predict the timescales at which one expects to see pseudo self-similar tra-c, provided that W max is large enough not to limit the TCP window growth. Interestingly, in [25], the authors analyze the congestion avoidance behavior of TCP from a control theoretic standpoint. One of their ndings is that the characteristic timescale 2 of TCP is directly proportional to E[W ]. Our observations are consistent with that result and could very well be explained by it. A similar observation can be drawn from the TO model. Revisiting the results presented in section 3, we would like to identify the range of timescales that the local Hurst estimate curves grows linearly, and relate this to the parameters of the model. From observation, we notice that for high loss probabilities, this value is RTT 2 6 , which is the largest timescale associated with the model. Note that the probability of an inter-packet delay being greater than RTT 2 6 is zero. Thus, all events in the model occur within this timescale, and this value can be seen as an upper bound. However, in the TCP protocol, the exponential back-o uses the RTO value as its basic unit, instead of the RTT value as used in our model. Therefore, the largest timescale associated with the pseudo self-similarity behavior is RTO 2 6 . It has been observed [16] that the RTO value ranges from 2.5 to 10 times the RTT value. We are still trying to obtain a simple relationship between the parameters (i.e., loss probability) and the range of timescales over which the pseudo self-similarity is present in the data tra-c. Until we do so, we use this intuitive upper bound for the range of timescales that the TO mechanism generates pseudo they refer to it as the "pole of TCP dynamics" Loss Probability Timescale Figure 11: Range of timescales of the CA model self-similar tra-c. In previous sections, we show that the exponential back-o and congestion avoidance mechanisms in TCP protocol lead to pseudo self-similarity in a single TCP ow. However, real Internet TCP tra-c can contain many TCP ows, each with dierent source-destination pairs. Our analysis does not immediately explain why aggregated TCP ows could exhibit pseudo self-similarity. Thus, we provide a plausible argument for the pseudo self-similarity of real aggregated TCP tra-c in Internet. If dierent TCP ows experiences dierent bottleneck links, the tra-c pattern of the TCP ows will then independent of each other and exhibit pseudo self-similarity. The assumption of independent bottleneck links is reasonable in the backbone tra-c, since most congestion occur at the edges of the network and the backbone links are usually underutilized. Intuitively, it is expected that pseudo self-similarity will be preserved when the independent ows are aggregated together. It has been shown that the aggregation of exact (asymptotic) self-similar processes is still an exact (asymptotic) self-similar process with Hurst parameter equal to the maximum among those of the individual processes [26]. We think this is one of the factors that contributes to the pseudo self-similarity in the data tra-c observed in real networks. In [14], the authors show how TCP congestion control can propagate pseudo self-similarity between ows traversing the same bottleneck link. Basically, if one of the ows traversing the link generates pseudo self-similar tra-c, then pseudo self-similarity can be passed on to other ows sharing that common bottleneck. In their paper, they measured a long-lived TCP ow over a trans-Atlantic link, and claim the TCP ow became pseudo self-similar by adapting to the background tra-c at the bottleneck link. Using the values of their experiment setting and the formula (eq. 29) in [16], also assuming the RTO to be in the range of 2.5 to 10 times the RTT, which is a common range as noticed in [16], we estimate the loss rate seen by the TCP ow to be in the range of 0.08 to 0.14. With this loss probability range our TO model predicts a local Hurst parameter of 0.69 to 0.72, which is comparable to the Hurst parameter reported by their trace analysis, 0.74. Moreover, our model predicts that the timescale for pseudo self-similarity goes up to 2 6 RTO, which corresponds to the range of 8 to 10 on the x-axis in Figure 1(c) in [14]. These timescales agree with the knee point where the wavelet analysis curve starts to turn at. It is surprising that the TO model can predict the local Hurst parameter and its timescales quite well. Therefore, another equally plausible explanation for the pseudo self-similarity observed in their experiment is the TCP TO mechanism itself. Trace Figure 12: Wavelet analysis of traces between North and South America We now investigate if our models are suitable in predicting the correlation structure of TCP tra-c in real networks. To accomplish this, we collect and analyze TCP traces from the Internet and compare the tra-c characteristics to the ones obtained from the models. A set of one-hour long TCP traces from east coast to west coast over vBNS and from North America to South America over international link were collected for seven consecutive days using tcpdump 3 . The packet loss probability observed in some of the traces from North to South America is around 0.13. Figure 12 illustrates the wavelet analysis for two representative traces with this loss probability. From the gure, we observe that the traces exhibits pseudo self-similarity with a local Hurst parameter of around 0.77 and largest timescales of 2 7 and 2 8 RTT, which corresponds to 9 and 10 on the x-axis. For a loss probability of 0.12, our TO model predicts a local Hurst parameter of 0.72 and largest timescale of RTO2 6 , which corresponds to 2 7 to 2 9 RTT, assuming that RTO takes values from 2.5 to 10 RTT. Note that the model again gives a good estimate for the local Hurst parameter and the largest timescales with respect to the trace analysis. The TO model is used here due to the high loss probability, under which the congestion avoidance mechanism seldom takes eect. As for the traces obtained between east and west coasts, many of them present a packet loss probability of around 0.018. Wavelet analysis of the traces show a local Hurst parameter around 0.86 and largest timescale about RTT 2 6 , for traces with this loss probability. However, our CA model predicts a local Hurst parameter of 0.75 and largest timescale of 2 4 RTT. This discrepancy is not surprising since even under low loss probabilities, there are a considerable number of timeouts occurring, which can impact the tra-c correlation structure. Note that our model only considers the congestion avoidance mechanism and ignores all other aspects of including timeouts. 6 Conclusion In this paper we demonstrate that the TCP protocol can generate tra-c with pseudo self-similarity over a certain range of timescales. In particular, we point out that the timeout 3 tcpdump is publicly available at http://www-nrg.ee.lbl.gov exponential back-o and the congestion avoidance mechanisms are responsible for this correlation structure. We show that under low loss probabilities the eect of the congestion avoidance mechanism on the tra-c correlation structure is more pronounced while the timeout mechanism has minimal impact. In contrast, under high loss probability the timeout mechanism has larger impact on the tra-c correlation structure, while the eect of the congestion avoidance mechanism is minimal. Together, these two mechanisms can generate pseudo self-similar network tra-c under a wide range of packet loss probabilities. The results obtained from the two analytical models presented in this paper support this claim. We investigated the validity of our claim using simulation and analysis of real trace measurements from the Internet. We show that the local Hurst parameter predicted by our models is in the same range as observed in the Internet tra-c and other related works. We also identied the range of timescales that both mechanisms generate pseudo self-similarity. These timescales are related to the parameters of our models. We do not claim that the TCP protocol is the solely cause of pseudo self-similarity widely observed in network tra-c. Many other studies have also tried to explain the cause and the conditions under which the network tra-c can exhibit pseudo self-similarity. We believe that some of those causes are plausible and can have impact on the correlation structure of the tra-c. But most likely, the origin of pseudo self-similarity is due to one or more factors, including the protocol. Hence, one should be careful when attributing the origin of tra-c characteristics to a specic cause. As for future work, we plan to extend our work to a more thorough TCP model, that combines the mechanisms of the protocol suite. We would also like to investigate how can the TCP protocol be modied in order to reduce the correlation structure currently present in the tra-c it induces. --R Internetworking with TCP/IP --TR Queue response to input correlation functions On the self-similar nature of Ethernet traffic (extended version) area traffic On a Markov modulated chain exhibiting self-similarities over finite timescale Self-similarity in World Wide Web traffic Modeling TCP throughput On the relevance of long-range dependence in network traffic A stochastic model of TCP/IP with stationary random losses On the propagation of long-range dependence in the Internet The failure of TCP in high-performance computational grids Linux IP Stacks Commentary A Set of Tools for Traffic Modeling, Analysis and Experimentation The TANGRAM-II Environment An Application of Superpositions of two state Markovian Sources to the Modelling of Self-similar Behaviour Congestion Control and Heavy Tails How Does TCP Generate Pseudo-Self-Similarity? On the Autocorrelation Structure of TCP Traffic TITLE2: A Stochastic Model of TCP Reno Congestion Avoidence and Control --CTR Bing Wang , Jim Kurose , Prashant Shenoy , Don Towsley, Multimedia streaming via TCP: an analytic performance study, ACM SIGMETRICS Performance Evaluation Review, v.32 n.1, June 2004 Daniel R. Figueiredo , Benyuan Liu , Anja Feldmann , Vishal Misra , Don Towsley , Walter Willinger, On TCP and self-similar traffic, Performance Evaluation, v.61 n.2-3, p.129-141, July 2005 Hao Jiang , Constantinos Dovrolis, Why is the internet traffic bursty in short time scales?, ACM SIGMETRICS Performance Evaluation Review, v.33 n.1, June 2005 Bing Wang , Jim Kurose , Prashant Shenoy , Don Towsley, Multimedia streaming via TCP: an analytic performance study, Proceedings of the 12th annual ACM international conference on Multimedia, October 10-16, 2004, New York, NY, USA Rachid El Abdouni Khayari , Ramin Sadre , Boudewijn R. Haverkort , Alexander Ost, The pseudo-self-similar traffic model: application and validation, Performance Evaluation, v.56 n.1-4, p.3-22, March 2004 Vivek Raghunathan , P. R. Kumar, A counterexample in congestion control of wireless networks, Proceedings of the 8th ACM international symposium on Modeling, analysis and simulation of wireless and mobile systems, October 10-13, 2005, Montral, Quebec, Canada Rachid El Abdouni Khayari, Design and evaluation of web proxies by leveraging self-similarity of web traffic, Computer Networks: The International Journal of Computer and Telecommunications Networking, v.50 n.12, p.1952-1973, 24 August 2006 Vivek Raghunathan , P. R. Kumar, A counterexample in congestion control of wireless networks, Performance Evaluation, v.64 n.5, p.399-418, June, 2007 Wei-Bo Gong , Yong Liu , Vishal Misra , Don Towsley, Self-similarity and long range dependence on the internet: a second look at the evidence, origins and implications, Computer Networks: The International Journal of Computer and Telecommunications Networking, v.48 n.3, p.377-399, 21 June 2005
long range dependence;network traffic characterization;TCP mechanisms
599552
A new wireless ad hoc multicast routing protocol.
An ad hoc network is a multi-hop wireless network of mobile nodes without the intervention of fixed infrastructure. Limited bandwidth and mobility require that ad hoc routing protocols be robust, simple, and energy conserving. This paper proposes a new ad hoc multicast routing protocol called neighbor-supporting multicast protocol (NSMP). NSMP adopts a mesh structure to enhance resilience against mobility. And NSMP utilizes node locality to reduce the overhead of route maintenance. NSMP also attempts to improve route efficiency and reduce data transmissions. Our simulation results show that NSMP delivers packets efficiently while substantially reducing control overhead in various environments.
Introduction An ad hoc network is a multi-hop wireless network formed by a collection of mobile nodes without the intervention of fixed infrastructure. Because an ad hoc network is infrastructure-less and self-organized, it is used to provide impromptu communication facilities in inhospitable environments. Typical application areas include battlefields, emergency search and rescue sites, and data acquisition in remote areas. An ad hoc network is also useful in classrooms and conventions where participants share information dynamically through their mobile computing devices. Each mobile node in an ad hoc network functions as a router to establish end-to-end connections between any two nodes. Although a packet reaches all neighbors within transmission range, a mobile node has limited transmission ranges and its signals may not reach all hosts. To provide communications throughout the network, a sequence of neighbor nodes from a source to a destination form a path and intermediate mobile hosts relay packets in a store-and-forward mode. Unique characteristics of an ad hoc network raise several requirements for the routing protocol design: ad hoc network routing must be simple, robust and minimize control message exchanges. Ad hoc routing must be simple because routing is performed by generic mobile hosts which have limited CPU and memory capacities and are powered by batteries. Bandwidth is a scarce resource in wireless networks. Routing algorithms which consume excessive bandwidth for routing control message exchanges may not be appropriate for wireless networks. The topology of an ad hoc network is inherently volatile and routing algorithms must be robust against frequent topology changes caused by host movements. Many routing schemes have been presented to provide adequate performance of ad hoc networks. Ad hoc routing is classified into proactive routing and reactive routing based on when routes are determined. Proactive routing continuously makes routing decisions so that routes are immediately available when packets need to be transmitted. DBF[1], DSDV[2], WRP[3] are proactive routing protocols. Reactive routing determines routes on an as-needed basis: when a node has a packet to transmit, it queries the network for a route. TORA[4], DSR[5], AODV[6], ABR[7], RDMAR[8] belong to reactive routing. Proactive routing consumes a great deal of radio resources to exchange routing information. Also, pre-determined routes may rapidly lose their validity in an ad hoc network because its topology changes rapidly. Previous study showed that reactive protocols performed better than proactive protocols [9], [10], [11]. In addition to unicast routing protocols, several multicast routing protocols for ad hoc networks have been proposed in more recent years [12], [13], [14], [15], [16]. Unicast is a special form of multicast, and some proposed multicast routing protocols support both unicast and multicast routing [12], [13]. Proposed multicast routing can be classified into tree-based protocols and mesh-based protocols. Tree-based protocols [12], [15], [16] build a tree that connects all multicast members. Tree-based protocols are generally more efficient than mesh-based protocols, but they are not robust against topology changes because there is no alternative path between a source and a destination. As a result, every link failure in a multicast tree may involve a set of control message exchanges for tree re-build. Contrary to tree-based protocols where there is only one path between any two nodes, mesh-based protocols allow redundant paths between two nodes because mesh-based multicast protocols provide alternative paths and a link failure need not trigger the recomputation of a mesh. Previous studies showed that mesh-based protocols are robust against topology change and are more suitable than tree-based protocols [14], [17]. Although reactive routing protocol finds paths on demand and uses "soft state" to avoid stale route information, route failure still occurs due to frequent topology changes in ad hoc networks. Most ad hoc routing protocols have path maintenance mechanisms that provide adequate connectivity under topology changes. We can reduce the path maintenance cost using old path information and node locality information. One method to reduce the path maintenance cost is to use an old path segment and search a new path segment starting from the link failure point. "Expanded Ring Search (ERS)" is typically used for the new path segment search to further reduce the path maintenance cost. More recently, more systematized efforts for localized repair have been proposed in the context of unicast routing [8] [18]. ODMRP is an ad hoc multicast routing protocol based on a multicast mesh [13]. In ODMRP, if a source node has data to send, it periodically broadcasts "Join Request" to find and maintain multicast routes. All the other nodes re-broadcast the packet when they receive non-duplicate one. When a multicast group member receives "Join Request", the node replies with "Join Table." And subsequent replies by the nodes along a reverse path establish a route. ODMRP uses soft states, so leaving a group is automatically handled by timeout. As shown, ODMRP relies on frequent network-wide flooding, which may lead to a scalability problem when the number of source nodes is large. The control packet overhead becomes more prominent when the multicast group is small in comparison with the entire network. In this paper, we present a new on-demand multicast routing protocol called Neighbor-Supporting Multicast Protocol (NSMP). NSMP is a robust, low overhead and efficient protocol. We choose to use the mesh infrastructure because resilience against link failures is an important property of ad hoc multicast routing. NSMP is the first multi-cast routing protocol that exploits node locality for route maintenace except for basic ERS. Broadcasts are expensive operations in ad hoc networks [19]. NSMP minimizes the frequency of control message broadcasts. Broadcasts are occasionally used for initial route establishment or a network partition repair. For normal and periodic mesh main- tenances, control messages reach only forwarding nodes and their neighbor nodes. In selecting a new route, NSMP prefers a path that contains existing forwarding nodes. Thus, NSMP enhances the route efficiency by reducing the number of forwarding nodes. We have evaluated the performance of NSMP via computer simulation. The simulation result shows that NSMP is robust against frequent toplogy changes and delivers more than 96% of data packets under reasonable simulation environments. Moreover, data packet transmissions and control message exchanges are reduced by 5-30% compared to existing mesh-based ad hoc multicast routing protocols. The rest of this paper is organized as follows. Section 2 contains an overview of NSMP, and a more detailed description of NSMP is presented in section 3. Section 4 provides results of simulation experiments, and section 5 concludes the paper. Multicast Routing Protocol 2.1 An Overview of NSMP NSMP is a robust, yet efficient ad hoc multicast routing protocol. Mesh infrastructure used in NSMP has resilience against link failures. A soft state approach is used, and routes are built and maintained with basic route discovery and reply messages. NSMP also operates independent of unicast routing protocol. Localizing route discovery and maintenance operations, NSMP reduces the routing overhead. As discovered in RDMAR [8], most link failure recoveries can be localized to a small region along a previous route. NSMP performs two types of route discovery: flooding route discovery and local route discovery. For routine path maintenances, NSMP uses local route discovery which is restricted only to a small set of mobile nodes directly related to a multicast group. For an initial route establishment or a network partition repair, NSMP occasionally performs flooding route discovery in which control messages are broadcast by all nodes. For long-lived connections, routine path maintenances occur many times more frequently than the initial path establishment, and the saving by localized path maintenance could be sizable. NSMP attempts to achieve the route efficiency of the multicast tree while enjoying the robustness of the multicast receiver source neighbor node forwarding Initial network (b) After mesh creation Figure 1: Multicast mesh creation mesh infrastructure. It is known that the mesh structure is more robust against topology changes than the tree structure [14], [17]. However, previous study [17] found that tree-based protocol transmits less data packets than mesh-based protocol. In selecting a route, NSMP prefers a path that contains existing forwarding nodes to reduce the number of forwarding nodes. This enhances route efficiency, leading to less contention in the network. 2.2 Multicast Mesh Creation A new source initially sends a FLOOD REQ packet. The FLOOD REQ packet has an upstream node field. When an intermediate node receives the FLOOD REQ packet, it caches the upstream node and updates the field with its own address before forwarding it to next nodes. When a receiver receives the FLOOD REQ packet, it sends a REP packet to the node from which it received the packet. The upstream node receives the REP packet and adds an entry for the group to its routing table. Then it forwards the REP packet to its own upstream node, and the REP packet eventually reaches the source node. The intermediate nodes that relay the REP packet become forwarding nodes. A multicast mesh of a group consists of sources, receivers, forwarding nodes, and links connecting them. The nodes in a multicast mesh are called mesh nodes. Figure how a multicast mesh is built. Assume that nodes 6 and 13 are receivers of a multicast group. When node 4 joins the group as a source, it broadcasts a FLOOD REQ packet. Node 5 receives the packet and broadcasts it. When node 6 receives the FLOOD REQ packet, it sends a REP packet to its upstream, node 5. When node 5 receives the REP packet, it knows that it is on the multicast mesh and relays the packet to its upstream, node 4. Similarly, node 13 also sends a REP packet when it receives a FLOOD REQ. Although there are other receiver source neighbor node forwarding node (a) Link failure (b) After local recovery Figure 2: Multicast mesh maintenance reverse paths for this REP to take (e.g. 13-12-8-4), we assume here that REP takes the path (13-9-5-4) and that node 9 becomes a forwarding node. Figure 1 (b) shows the resulting multicast mesh. When a source transmits a packet, only forwarding nodes relay the packet, so that the packet is delivered to receivers along an established mesh. Now let us consider neighbor nodes of the multicast mesh. Neighbor nodes are nodes that are directly connected to at least one mesh node. In Figure 1 (b), nodes 1, 2, 3, 7, 8, 10, 12, and 17 are the neighbor nodes. Forwarding nodes and group neighbor nodes lose their function unless they are refreshed within pre-defined timeout period. Section 3 shows detailed procedures of how a multicast mesh is built and a node becomes a group neighbor. 2.3 Multicast Mesh Maintenance 2.3.1 Local Route Discovery Each source periodically transmits a LOCAL REQ packet, and only mesh nodes and group neighbor nodes relay the packet. Therefore, all nodes two hops away from the mesh nodes receive the LOCAL REQ packet. This mechanism can reduce control overhead, and due to node locality, it repairs most link failures caused by node movements. REP packets to LOCAL REQ packets are relayed to a source in the same way as REP packets to FLOOD REQ packets in section 2.2. Forwarding nodes and group neighbor nodes along a multicast mesh are updated as REP packets are relayed to a source. For example, assume that a failure occurs to a link (9, 13) in Figure 2. Node 4 will eventually send a LOCAL REQ packet since each source periodically performs local route discovery. When node 8 receives the packet, it broadcasts Type Sequence Number Group Address Source Address Upstream FC NC Figure 3: Packet header of NSMP the packet since group neighbor nodes relay LOCAL REQ packets. When node 12 subsequently broadcasts the packet, node 13 receives it and sends a REP packet to build a new route to the source. The repaired mesh is shown in Figure (b). Note that more than 30% of the nodes (i.e. six nodes) in Figure 2 (a) do not re-broadcast the LOCAL REQ packet. Local route discovery ensures lower control overhead, but it does not repair all link failures. Suppose that a link (8, 12) in Figure 2 (b) failed. Local route discovery cannot repair this link failure. With reasonable network connectivity, however, locally unrecoverable link failures occur less frequently than link failures that can be repaired by local route discovery. Simulation results in section 4 show that local route discovery is effective under various environments. 2.3.2 Flooding Route Discovery NSMP uses flooding route discovery in several cases. When a node becomes a new source, it sends a FLOOD REQ packet in order to create an initial mesh. In NSMP, a node within two hops away from mesh nodes can join the group as a receiver by replying to a LOCAL REQ packet. However, a node more than two hops away from the mesh nodes must flood a MEM REQ packet. In addition, network partitions only can be recovered by FLOOD REQ packets. 2.4 Route Efficiency Improvement In selecting a route, NSMP gives a preference to a path that contains more existing forwarding nodes. The level of preference is an important parameter that trade-offs the routing efficiency and path robustness. Assume that node 17 becomes a new receiver in Figure 1 (b). And further assume that node 17 receives two route discovery packets: one from the path (4, 5, 9, 13, 17) and the other from the path (4, 8, 12, 16, 17). Both paths have the same length. However, the path (4, 5, 9, 13, 17) uses the existing path and the path (4, 8, 12, 16, 17) requires three new forwarding nodes. In terms of route efficiency, the former is better than the latter, and vice versa in terms of robustness. Detailed Description of NSMP 3.1 Data Structures and Packet Header Figure 3 shows the packet header of NSMP. We also assume the availablity of ttl field in other protocol (e.g. IP) used together. Forward Count (FC) denotes the number of forwarding nodes along a path. A forwarding node increases Group Address Forwarding Flag GroupNeighbor timeout GroupNeighbor Flag Forwarding timeout Figure 4: Routing table used in NSMP the FC by one before relaying a route discovery packet. Non-forward Count (NC) is the number of non-forwarding nodes. Type field is one of the following values: ffl DATA: data packet ffl FLOOD REQ: flooding route discovery packet sent by a group leader ffl LOCAL REQ: local route discovery packet sent by a source ffl MEM REQ: route discovery packet sent by a new receiver ffl REP: reply packet to a route discovery packet Every node maintains a routing table. Figure 4 shows the fields of an entry in a routing table. When a node becomes a forwarding node of a group, it sets corresponding ForwardingFlag. It sets GroupNeighborFlag when it becomes a group neighbor node. Forwarding timeout and GroupNeighbor timeout fields denote the times when a node loses its function. In addition, every node maintains a DataCache and a ReqCache to detect duplicate data packets and route discovery packets, respectively. The structures of the two caches are shown in Figure 5. Every source node needs to maintain a SourceList that consists of source addresses of the same group. 3.2 Initiating and Relaying FLOOD REQ and LOCAL REQ When a node becomes a multicast source, it transmits an initial FLOOD REQ packet. After that, all sources periodically transmit LOCAL REQ packets at every REQ PERIOD interval. REQ PERIOD is important to the performance of NSMP and should be carefully adjusted according to network environments. As briefly discussed in section 2.3, NSMP uses flooding to recover network partitions. For this purpose, a group leader is selected among sources. The group leader sends FLOOD REQ packets at every FLOOD PERIOD interval. Upstream and Source Address fields are set to its own address, and FC and NC are set to zero. When a node receives a route discovery packet, it consults ReqCache to find whether the packet has a more recent sequence number. (Group Address, Source Address, Sequence Number) fields in ReqCache are used to determine if Source Address Group Address Sequence Number Source Address Group Address Upstream Sequence Number (a) DataCache (b) ReqCache Figure 5: Caches used in NSMP the packet is duplicate. If the packet is a new one, the receiving node updates the corresponding entry of ReqCache to have correct information about Sequence Number and Upstream. A node relays all FLOOD REQ packets. However, it relays LOCAL REQ packets only if it is either a mesh node or a neighbor node of the group. Before relaying a route discovery packet, a node must change Upstream field with its own address for later reverse path establishment. A relaying node increments FC by one if it is a forwarding otherwise, NC is incremented by one. Handling duplicate route discovery packets is described in section 3.3. 3.3 Initiating and Relaying REP A path from a source to a receiver is established when a REP packet is forwarded along the reverse path from the receiver to the source. The reverse path is already recorded in the Upstream field of the ReqCache. When an intermediate node receives the REP packet, it sets the ForwardingFlag bit and refreshes the Forwarding timeout of its routing table. Then the intermediate node relays the REP packet to its upstream node. Note that a packet is broadcast to all neighbor nodes in wireless network. All nodes that detect the REP packet (except mesh nodes) become neighbor nodes of the group. The neighbor nodes set the GroupNeighborFlag and refresh the GroupNeighbor timeout of its routing table. As explained before, NSMP tries to balance the routing efficiency and path robustness, giving preference to paths that contain more forwarding nodes. A receiver receives many route discovery packets. When a receiver receives a first non-duplicate route discovery packet, it stores the information of the packet header into ReqCache and delays sending REP for a short time. It computes the weighted path length, using different weights for FC and NC. The choice of these weights is also important in achieving route efficiency and resilience againt mobility. If the receiver receives another route discovery packet within the waiting period, it computes the weighted path length. If the new path is better than the currently best path, then the receiver replaces the ReqCache with the information of the new path. It sends a REP packet using the information of the best path stored in ReqCache after pre-determined time elapses since the non-duplicate route discovery packet reception. When an intermediate node receives a duplicate route discovery packet, it also checks if the new weighted path length is better than the one in ReqCache. If so, it stores the better upstream node in ReqCache. This information is not further relayed but used later if it receives a REP packet and needs to relay it to its upstream node. NSMP ensures partition recovery by performing flooding route discovery. When previously disconnected partitions have regained connectivity, a FLOOD REQ packet from one partition will eventually reach a receiver in another partition. Partition is recovered when a REP packet is sent and relayed across previous partitions. Larger FLOOD PERIOD may introduce longer delay in partition recovery, so flooding route discovery needs to be performed more often in case of lower network connectivity. 3.4 Becoming a Group Neighbor In previous subsection, we already explained the procedure of when a node becomes a neighbor node of a multicast group. Another case to become a group neighbor is when a non-mesh node finds that one of its neighbors is a source. If Upstream field of a route discovery packet is the same as Source Address field of the packet, the node becomes a group neighbor. Table 1 summarizes node behaviors when it receives route discovery packets. 3.5 Receiving and Forwarding When a node receives a packet, it consults DataCache to see if the packet is duplicate. If so, it discards the packet. Otherwise, it updates DataCache to reflect the packet header information, especially the sequence number. And the packet is re-broadcast if the receiving node is a forwarding node. 3.6 Joining and Leaving a Group When a node wants to join a group as a receiver, it waits for a LOCAL REQ packet for REQ PERIOD. It will receive one and be able to build a route if it is a mesh node, a neighbor node of the group, or two hops away from the mesh. For example, nodes 11, 14, and in Figure 2 (b) will receive a LOCAL REQ packet within REQ PERIOD. If the new receiver does not receive a LOCAL REQ packet, it broadcasts a MEM REQ packet. On receiving a MEM REQ packet, a node operates analogous when it receives a FLOOD REQ packet; it needs to update an entry in reqcache. MEM REQ uses a ttl field. All nodes that receive a MEM REQ packet relay the packet only if ttl value Relay update SourceTable source receiver forwarding node group neighbor other node send REP send REP update SourceTable Relay Relay Relay Relay Relay Relay Relay Relay Flooding Route Discovery * The node becomes a group neighbor if Source Address = Upstream * GroupNeighbor timeout is refreshed if Source Address = Upstream Table 1: Summary of node behaviors when a route discovery packet arrives is greater than zero. ttl value is decremented by one whenever it is relayed. Source nodes and forwarding nodes send a REP packet when they receive a MEM REQ packet. REP packets to MEM REQ packets are relayed toward the new receiver in the same way as REP packets to FLOOD REQ or LOCAL REQ. The reception of a REP packet to a MEM REQ packet also requires routing table update. And some nodes become forwarding nodes or neighbor nodes according to Upstream field of the REP packet. NSMP uses expanded ring search (ERS) to reduce the bandwidth usage for MEM REQ packets. The value of ttl field in the initial MEM REQ is set to three because the new receiver sending MEM REQ (for example, node 15 or 19 in Figure 2 (b)) is more than two hops away from the mesh. If the new receiver fails to receive any REP packet within timeout, then it floods a MEM REQ packet. Multiple REP packets to a MEM REQ packet may increase the number of forwarding nodes more than necessary. This problem, however, will be resolved by timeout since only one path will be refreshed when the receiver receives route discovery packets and replies to them. Leaving a group in NSMP does not need any additional control messages. When a node leaves a group, it does not send REP packets to subsequent route discovery packets, and soft states stored in intermediate nodes will expire. 3.7 Electing a Group Leader A group leader is the source node whose address is the smallest among source nodes in the same multicast group. Since every source periodically sends a LOCAL REQ packet, a source can have up-to-date information about other sources. When a source receives a LOCAL REQ packet from another source of the same group, it updates SourceList to include the source address. With this information, a source can determine if its address is the smallest or not. An entry in a SourceList is deleted if no LOCAL REQ packets from the corresponding source are received within pre-determined time, for example, two times REQ PERIOD. Performance Simulation 4.1 Simulation Environment ns-2 simulator was used for performance simulation. ns-2 is originally developed by the University of California at Berkeley and the VINT project [20] and recently extended to provide simulation support for ad hoc networks by the MONARCH project [21] at Carnegie Mellon University. [9] gives a detailed description about physical layer, data link layer, and IEEE 802.11 MAC protocol used in the simulation. The protocol simulation consists of 50 wireless mobile nodes forming an ad hoc network, moving around over a square (1000 meters \Theta 1000 meters) flat space for 300 seconds of simulated time. Nodes move according to the "random waypoint" model [9] without pause time. A multicast source generates 128-byte data packets with constant bit rate (CBR) of eight packets per second. A number of movement scenario files and group scenario files were generated and used as inputs to the simulations. Each movement scenario file records movements of 50 mobile nodes, and the speeds of mobile nodes are uniformly distributed up to a maximum speed. Group scenario files describe receiver and source nodes and also describe the time when they join and leave a group. Each group scenario file has one multicast group. However, in one experiment, we use three group scenarios on average to simulate the multiple group environments. In comparing the protocols, the following metrics were used. ffl Data Packet Delivery Ratio: The percentage of data packets correctly delivered to multicast receivers ffl Number of Data Transmissions per Data Packet Delivered: This metric reveals how efficiently a protocol establishes a path. ffl Number of Control Packets per Data Packet Delivered: This metric represents control overhead of each protocol. We compare the performance of NSMP with those of ODMRP and MAODV (Multicast AODV) [12]. It was assumed that no nodes were equipped with GPS, so a source in ODMRP periodically flooded "Join Request" packets. We found that "Join Reqeust" period and REQ PERIOD of two seconds showed reasonable performance in terms of data delivery ratio and control overhead. So in the following simulation experiments, we set both "Join Request" period in ODMRP and REQ PERIOD in NSMP to two seconds. And recommended parameter contants were used for MAODV [12]. MAODV used link-layer unicast for all data transmissions while link-layer broadcast was used for NSMP and ODMRP data transmissions. And MAODV exploited link-layer ACK to maintain local connectivity. Although IEEE 802.11 uses additional control packets for unicast, we did not count MAC layer control packets for control overhead for MAODV. We used the same movement scenarios and the same group scenarios. 4.2 Simulation Results 4.2.1 Experiments on NSMP Parameters We first experimented on the impact of FLOOD PERIOD on data delivery ratio and control overhead of NSMP. If FLOOD PERIOD is long, less flooding route discovery operations will decrease control overhead, but data delivery ratio may drop due to more locally unrecoverable link failures. Since more sources with NSMP tend to increase mesh resilience, we used multicast groups of one source to isolate the effect of different FLOOD PERIOD. We assumed five receivers per group and set maximum node speed to 20m/s. Different values of FLOOD PERIOD (2, 20, and 100 seconds) were used with different transmission ranges. We also investigated the highest possible data delivery ratio as different transmission ranges led to different network topology. In Figure 6, we can observe that packet delivery ratio improves up to 6% when FLOOD PERIOD reduces from 100 seconds to 20 seconds. However, further reduction of FLOOD PERIOD from 20 seconds to 2 seconds have marginal impact on packet delivery ratio. Figure 6 also illustrates that shorter transmission range causes lower data delivery ratio due to frequent network partition. Note that when FLOOD PERIOD is set to 2 seconds, NSMP performs flooding route discovery only. When FLOOD PERIOD is 20 seconds, locally unrecoverable link failures occur infrequently, so data delivery ratio is similar to that with 2 seconds. However, when FLOOD PERIOD increases to 100 seconds, data delivery ratio drops significantly. And there was no significant difference in control overhead when FLOOD PERIOD changes from 20 to 100 seconds. Considering data delivery ratio and control overhead, we set FLOOD PERIOD to 20 seconds in the follwoing experiments. We also simulated to study the impact of preferring forwarding nodes in establishing a reverse path. We used the following a \Theta NC; 0 - a - 1: And a path of smaller metric was selected as a reverse path. Here, a means relative weight for FC. A large a reduces the number of forwarding nodes and achieves route efficiency at the cost of a less resilient multicast mesh. In the other way, a smaller a tends to include more forwarding nodes but makes the mesh more robust. In the following simulation, we varied a from 0.4, 0.5 to 0.6. Transmission range was set to 250 meters, and the maximum node speed was set to 10m/s. A group had two sources, and we changed group sizes from 5 to 20. Figure 7 shows the packet delivery ratio as a function of the group size varying a = 0:4, 0:5 and 0:6. In this figure, we can observe that the group size does not have great impact on the packet delivery ratio. We can also observe that the weight, a, has marginal effects on the packet delivery ratio. However, Figure 8, which shows the "Data packet/Total delivered packet" ratio as a function of the group size, reveals that larger a reduces the overhead of redundant packet transmissions significantly. When a increases from 0:4 to 0:6, the delivery ratio degradation is Transmission Range (m) Optimal FLOOD_PERIOD 100 sec Figure delivery ratio with different FLOOD PERIOD less than 1%. However, data transmissions are reduced by around 20%. We used 0.6 as the relative weight value in the following experiments. In Figure 7, as group size increases, data delivery ratio of NSMP slightly drops. Also, data delivery ratio difference between different a's becomes smaller since more group members tend to lead to more resilient multicast meshes. In Figure 8, we can observe that data transmission per delivered data packet decreases as group members increase. It is because the number of forwarding nodes does not increase in proportion to the number of receivers since data path to each receiver can be shared. 4.2.2 Performance Comparison We simulated and compared the performance of NSMP with those of ODMRP and MAODV. First, we investigated the impact of node mobility on each protocol. We varied the maximum node speed to study the resilence of protocols against the node mobility. A group has two source nodes and five receivers. Transmission range is set to 250 meters. Figure 9 shows the packet delivery ratio as a function of the maximum node speed. All three protocols deliver data packets well when there is no node mobility. However, performance of tree-based MAODV degrades rapidly as the node speed increases. This performance degradation is due to frequent tree link failures. Since mesh structure of NSMP and ODMRP provides alternative paths, their data delivery ratios are higher in case of node mobility. We can observe that NSMP's data delivery ratio is comparable to that of ODMRP (within 1% difference). The performance gap between ODMRP and NSMP is due to the fact that NSMP performs local failure recovery while Group Size preferring non-forwarding node: a=0.4 preferring forwarding node: a=0.6 Figure 7: Data delivery ratio with different weight135 10 15 20 Data Packet/Total Delivered Packet Group Size preferring non-forwarding node: a=0.4 preferring forwarding node: a=0.6 Figure 8: Data packet transmissions with different weight Maximum Speed (m/s) ODMRP Figure 9: Comparison of data delivery ratio with mobility change ODMRP performs global failure recovery. Figure data transmission overhead as a function of the maximum node speed. In general, MAODV has lower data transmission overhead than the other two protocols. However, the overhead of NSMP is as low as that of MAODV. This result endorses that the route created by NSMP is as efficient as that of tree-based protocols. The overhead of ODMRP is 20-30% larger than that of NSMP and MAODV. In Figure 10 and 11, we can conclude that NSMP achieves the robustness of mesh-based protocols while enjoying the efficiency of tree-based protocols. Control overhead is reported in Figure 11. MAODV incurs the lowest control overehead 1 . NSMP decreases control overhead by 5 - 15% compared to ODMRP using localized route discovery. Figure 12 shows the packet delivery ratio as a function of the number of sources to investigate the scalability of NSMP. In the simulation, transmission range is fixed to 250 meters, maximum speed is set to 10 m/s, and a group has five receivers. ODMRP and NSMP perform better than MAODV in all cases. The performance of both NSMP and ODMRP increases as the number of source increases from one to two. We guess that the performance improvement is due to the increased redundancy of multicast meshes. However, as the number of source nodes increases further, the performance decreases due to increased traffic. However, because NSMP reduces both control and data packet transmissions, it exhibits less severe performance degradation in data delivery ratio than other two protocols. As overall network traffic grows higher, NSMP begins to show the best data delivery ratio. 1 Note that we did not include control overhead for link-layer unicast. Data Packet/Total Delivered Packet Maximum Speed (m/s) ODMRP Figure 10: Comparison of data transmissions with mobility Control Packet/Total Delivered Packet Maximum Speed (m/s) ODMRP Figure 11: Comparison of control overhead with mobility change Packet Delivery Number of Sources ODMRP Figure 12: Comparison of data delivery ratio with increasing number of sources Conclusions This paper has proposed a new on-demand multicast routing protocol for ad hoc networks. The new routing scheme, NSMP, is based on multicast meshes and designed to minimize data transmissions and control overhead in maintaining the meshes. A key concept is to localize control messages to a small set of mesh nodes and group neighbor nodes and minimize the frequency of network-wide flooding. NSMP also attempts to improve route efficiency by giving preference to forwarding nodes in establishing a route. This leads to reduction in data packet transmissions and less contention in a network. We simulated NSMP using ns-2 simulator, and simulation results reveal that NSMP effectively routes data packets. And NSMP substantially reduces control overhead and decreases data packet transmissions compared to ODMRP. Also, a mesh created by NSMP is efficient, and the number of data transmissions of NSMP is as low as tree-based MAODV. NSMP scales well with increasing group size and sources, and node mobility. Future research could be on how to adjust the period of route discovery packets under various mobility and traffic environments. --R "Data Network," "Highly Dynamic Destination-Sequenced Distance-Vector Routing (DSDV) for Mobile Computers," "An Efficient Routing Protocol for Wireless Networks," "Temporally-Ordered Routing Algorithm (TORA) Version 1," "The Dynamic Source Routing in Ad Hoc Wireless Networks," "Ad Hoc On Demand Distance Vector (AODV) Routing," "Long-lived Ad Hoc Routing based on the Concept of Associativity," "RDMAR: A Bandwidth-efficient Routing Protocol for Mobile Ad Hoc Networks," "A Performance Comparison of Multi-Hop Wireless Ad Hoc Network Routing Protocols," "Scenario-based Performance Analysis of Routing Protocols for Mobile Ad-hoc Networks," "Mobile Ad hoc Networking (MANET): Routing Protocol Performance Issues and Evaluation Considerations," "Multicast Operation of the Ad-hoc On-Demand Distance Vector Routing Protocol," "Ad hoc Wireless Multicast with Mobility Prediction," "The Core-Assisted Mesh Protocol," "Ad hoc Multicast Routing protocol utilizing Increasing id-numberS (AMRIS) Functional Specification," "AMRoute: Adhoc Multicast Routing Protocol," "A Performance Comparison Study of Ad Hoc Wireless Multicast Protocols," "Query Localization Techniques for On-Demand Routing Protocols in Ad Hoc Networks," "The Broadcast Storm Problem in a Mobile Ad Hoc Network," "ns notes and documentation," --TR Data networks Highly dynamic Destination-Sequenced Distance-Vector routing (DSDV) for mobile computers An efficient routing protocol for wireless networks A performance comparison of multi-hop wireless ad hoc network routing protocols RDMAR The broadcast storm problem in a mobile ad hoc network Query localization techniques for on-demand routing protocols in ad hoc networks Scenario-based performance analysis of routing protocols for mobile ad-hoc networks Multicast operation of the ad-hoc on-demand distance vector routing protocol
ad hoc network;multicast routing;node locality
599555
A network infrastructure for IP mobility support in metropolitan areas.
The original design of the Internet and its underlying protocols did not anticipate users to be mobile. With the growing interest in supporting mobile users and mobile computing, a great deal of work is taking place to solve this problem. For a solution to be practical, it has to integrate easily with existing Internet infrastructure and protocols, and offer an adequate migration path toward what might represent the ultimate solution. In that respect, the solution has to be incrementally scalable to handle a large number of mobile users and wide geographical scopes, and well performing so as to support all application requirements including voice and video communications and a wide range of mobility speeds. In this paper, we present a survey of the state-of-the-art and propose a scalable infrastructure to support mobility in Internet protocol networks. In that respect, we exploit local area network (LAN) technologies to create the network infrastructure necessary to offer connectivity to mobile users across any geographical area (building, campus and metropolis). The intrinsic properties of LAN technologies and their underlying protocols, namely flat address space, transparent learning and low complexity renders this solution particularly cost effective for supporting user mobility. In particular, we propose a network topology and a set of protocols that render the infrastructure scalable to a large geographical area and many users.
To address this issue, a proposal was introduced in [1], known as hierarchical foreign agents or HFA. In this proposal, hierarchical foreign agents (HFAs) are introduced to smooth out the process when a MH transitions between subnets. This optimization is accomplished via hierarchical tracking of MHs by the FAs, and via packet bu?ering at FAs. Within a domain, the FAs are organized into a tree structure that handles all the hando?s in that domain, with one FA serving as the root of the tree. (The tree organization is unspeci?ed and left up to the network administrator of that domain. One popular con?guration is to have a FA associated with the ?rewall to that domain be the root of the tree??also known as a gateway foreign agent or GFA??and all the other FAs provide the second level of the hierarchy.) A FA sends advertisements called Agent Advertisements in order to signal its presence to the MHs. An Agent Advertisement includes a vector of COAs, which are the IP addresses of all its ancestors (up to the root) as well as the IP address of that FA. When an MH arrives at a subnet, it records these IP addresses as its COAs. A registration goes through and is processed by the FA, all its ancestors and the HA. The FA processing a registration records the next lower-level FA as the COA to which to forward packets sent for the MH, and the HA records the root FA for this purpose. A registration reply goes through in the opposite direction from the HA to the MH. When a hando? occurs, MH compares the new vector of COAs with the old one it had recorded previously. It chooses the lowest-level FA that appears in both vectors, and sends a regional registration request to that FA, and all the lower level FAs speci?ed in the new vector. Any higher-level agent needs not be informed of this movement. When a packet for the MH arrives at its home network, the HA tunnels it to the root FA. The root FA re-tunnels it to the lower-level FA, which in turn re-tunnels it to the next lower level FA. Finally, the lowest-level FA delivers it to the MH. Mobile IP route optimization [19] extends the use of binding cache and binding update messages to provide smooth hando?. However, tunneled packets that arrive at the previous FA before the arrival of the required binding update are lost. To address this issue, HFA includes a mechanism for packet bu?ering at the FAs. Besides decapsulating tunneled packets and delivering them directly to an MH, the FA also bu?ers these packets. When it receives a binding update with a new COA, it re- tunnels to that COA the bu?ered packets along with any future packets tunneled to it. Clearly, how much packet loss can be avoided depends on how quickly an MH ?nds a new FA, and how many packets are bu?ered at the previous FA. This in turn depends on how frequently FAs send out beacons or agent advertisements, and how long the MH stays out of range of any FA. To reduce duplicates, the MH bu?ers the identi?ca- tion and source address ?elds in the IP headers of the packets it receives and includes them in the bu?er hando? request so that the previous FA does not need to retransmit those packets that the MH has already received. While HFA helps reduce the overhead of hand- o? by handling hando? closer to the MH, it introduces additional complexity at the MH, and in constructing and maintaining the FA hierarchy, and it may add latency due to the need for packet encapsulation and decapsulation at every FA in the FA tree along the path from the CH to the MH. Moreover, scalability issues may arise at the root FA and the FAs close to the root of the FA tree because of their involvement in packet tunneling for all the MHs of that domain. Finally, packet bu?ering can result in latency overhead, while encapsulation still generates bandwidth overhead Finally, we note that Mobile IP and solutions similar to it are popular choices employed in products and standards aimed to o?er IP connectivity to users around the world. In what follows, we describe two examples, namely the Ricochet system from Metricom [16] and universal mobile telecommunication system (UMTS) [10]. 2.1.1. Ricochet The Ricochet system o?ered by Metricom [15] implements a solution for IP mobility that is somewhat similar to the Mobile IP protocol. It was designed more than a decade ago, and thus predates the Mobile IP protocol. Wireless cells are connected to IP gateways and name servers that provide security, authorization and roaming support to users. When a user ?rst connects to the network, it sends a request to the local gateway and the name server. If validated and authorized, this request allows the user to receive an IP address to connect to the Internet. The IP address identi- ?es a permanent connection between the user and the network and thus remains ?xed for the entire time the user is connected to the Internet. All Internet tra?c for the user is tunneled through the gateway to which the user was originally con- nected. Beside the ?xed IP address, a MH is given two layer-2addresses: one is ?xed and unique to that user, and the other is dynamic and unique to the cell where a user is located at that point in time. The gateway maps the IP address of the user to the layer-2address corresponding to the cell where the user is located at any point in time. As the user crosses cells, this mapping changes to re?ect the new location of the user. In essence, this gateway performs the function of the HA in Mobile IP, by maintaining an up-to-date mapping of a ?xed user address to its temporary address, and by redirecting tra?c received for the ?xed address of the user, to the temporary address of that user. 2.1.2. Universal mobile telecommunication system One example of a standard that may employ the Mobile IP protocol is the UMTS, which is proposed in [10]. UMTS aims to provide IP level services via virtual connections between mobile hosts and IP gateways connected to ISPs or corporate networks at the edges of the mobile net- work. Consistent with the Internet architecture, a user is assigned domain names in order to identify the ISP that can be accessed to provide Internet connectivity to that user. When a user logs on, it is assigned an IP address by the gateway to which that ISP is connected, also known as the home gateway. A connection is established, consisting of two segments: one segment connects the mobile and some foreign gateway, and another, connects the foreign gateway and the home gateway, via the Mobile IP protocol. The connection is maintained as long as the mobile remains on and the foreign gateway can be changed as the mobile roams from the coverage area of one gateway to another. One can think of the mobile as being linked to the home gateway via an elastic global pipe. To the external world, the mobile appears to be located at the home gateway because it is this gateway that provides the IP address for the mobile. 2.2. Cellular IP Cellular IP [9] is a micro-mobility scheme that aims to accelerate Mobile IP by deploying special-purpose access networks, built as single IP subnets, across some geographical regions. The description of Cellular IP assumes that originally, each wireless cell (or even pico-cell) constituted an IP sub- net. Consequently, they propose that multiple wireless cells be grouped into one subnet to improve roaming between the cells of one subnet. However, this concept is not completely new. For example, the 802.11 standard uses extended service sets (ESS) to interconnect multiple 802.11 cells within a single subnet. Cellular IP access networks, depicted in Fig. 2, are connected to the Internet via gateway routers. Fig. 2. A wireless access network in Cellular IP. Cellular IP uses base stations (BSs) for wireless access connectivity, and for mobility support inside an access network. MHs attached to an access network use the IP address of the gateway as their COA. The gateway de-tunnels packets and forwards them toward a BS. Inside a Cellular IP network, MHs are identi?ed by their permanent home address and data packets routed without tunneling or address conversion. The Cellular IP routing protocol ensures that packets are delivered to the actual location of the host. Vice versa, packets sent by the MH are directed to the gate- way, and from there, to the Internet. Cellular IP proposes methods for computing connectivity among base stations and for routing packets inside an access network. Periodically, the gateway sends out beacons that are broadcasted across the access network. Through this proce- dure, BSs learn about neighboring BSs on the path towards the gateway. They use this information when forwarding packets to the gateway. More- over, when forwarding data packets from users to the gateway, BSs learn about the location of a user, and use that information to deliver packets sent for that user. We remark that, although Cellular IP proposes protocols for con?guration and routing in IP subnets, LAN protocols already exist to accomplish these goals. For example, the algorithms for building a spanning tree and for learning as de?ned by the 802standards are widely deployed and well known. If a packet is received at a BS for a user that is unknown to that BS, a paging request is initiated by the BS. The paging request is broadcast across a limited area in the access network known as a paging area. The MH responds to the paging request and its route to the paging BS gets estab- lished. Each MH needs to register with a paging area when it ?rst enters that area, regardless of whether it is engaged in communication or idle. Clearly, how fast paging occurs depends on the size of the paging area and on the e?ciency of spanning tree traversal. A small paging area can help reduce the latency of paging, however it increases the number of paging area required to cover a given area, which in turn increases the signaling overhead imposed on MHs. We observe that the paging techniques in Cellular IP are similar to those existent in the GSM system [11]. In GSM, mobile users are located in system-de?ned areas called cells that are grouped in paging areas. Every user connects with the base station in his cell through the wireless medium. BSs in a given paging area are connected by a ?xed wired network to a switching center, and exchange data to perform call setups and deliver calls between di?erent cells. When a call arrives at the switching center for a given user, a paging request for that user is initiated across all the cells in that paging area. If the user answers, a security check on the user is performed, and if the test passes, the switching center sets up a connection for that user. Cellular IP supports two types of hando?: hard hando? and semisoft hando?. MHs listen to beacons transmitted by BSs and initiate hando? based on signal strength measurements. To perform a hando?, the MH tunes its radio to the new BS and sends a registration message that is used to create routing entries along the path to the gateway. Packets that are received at a BS prior to the location update are lost. Just like in Mobile IP, packet loss can be reduced by notifying the old BS of the pending hando? to the new BS, and requesting that the old BS forward those packets to that BS. Another possibility is to allow for the old route to remain valid until the hando? is estab- lished. This is known as semisoft hando? and is initiated by the MH sending a semisoft hando? packet to the new BS while still listening to the old BS. After a semisoft delay, the MH sends a hard hando? packet. The purpose of the semisoft packet is to establish parts of the new route (to some uplink BS). During the semisoft delay time, the MH may be receiving packets from both BSs. The success of this scheme in minimizing packet loss depends on both the network topology and the value of the semisoft delay. While a large value can eliminate packet loss, it however adds burden on the wireless network by consuming precious bandwidth. Cellular IP speci?es an algorithm to build a single spanning tree rooted at the gateway to the access network as we described above. A spanning tree is necessary for the broadcasting of packets, to avoid packets from propagating to in?nity if the topology of the access network has any loops. However, because it uses only a subset of the links inside the access network, a single spanning tree can result in link overload if tra?c in the access network is high. This can be a signi?cant draw-back of Cellular IP as high-density access networks supporting many Tb/s of tra?c become possible to deploy. Moreover, a single spanning tree can be prone to long periods of connectivity loss. Connectivity loss would make this technology unacceptable as a replacement to wired, circuit-switched technology for telephone communica- tions. Finally, Cellular IP speci?es an interconnect between BSs that has a ?at hierarchy. As access networks cover larger area and exhibit higher pico-cell densities, a ?at hierarchy would result in latencies of packet traversal across the access net-work that may be unacceptable. In conclusion, it is clear that deploying wireless access networks as single subnets, like in Cellular IP is important for mobility. In this light, it becomes important to increase the size of IP subnets to the largest size possible in order to maximize their e?ectiveness in supporting IP mobility. 2.3. Hawaii Hawaii [12] is a micro-mobility scheme intended to accelerate Mobile IP inside portions of the Internet by exploiting host-speci?c routing at the routers present at those locations. Hawaii segregates the network into a hierarchy of domains, loosely modeled on the autonomous system hierarchy used in the Internet [12]. The gateway into each domain is called the domain root router. When moving inside a foreign domain, an MH Fig. 3. Diagram of a domain in the Hawaii architecture. A domain root router acts as the gateway to each domain. Paths are established between the routers of a domain. retains its COA unchanged and connectivity is made possible via dynamically established paths, as shown in Fig. 3. Path-setup update messages are used to establish and update host-based routing entries for the MHs at selective routers in the do- main, so that packets arriving at the domain root router can reach the MH. The choice of when, how and which routers are updated constitutes a particular setup scheme. Hawaii describes four such setup schemes, which trade-o? e?ciency of packet delivery and packet loss during hando?. The MH sends a path setup message, which establishes host speci?c routes for that MH at the domain root router and any intermediary routers on the path towards the MH. Other routers in the domain have no knowledge of the IP address of that MH. Moreover, the HA and CH are unaware of intra-domain mobility. We observe that, by sending path setup messages to a router in the tree, the MH is doing what a router would normally do in OSPF to load state for that MH, but without having to ?ood this information to all the routers inside the domain. The state maintained at the routers is soft: the MH infrequently sends periodic refresh messages to the local BS. In turn, the BS and intermediary routers send periodic aggregate hop-by-hop refresh messages toward the domain root router. Furthermore, reliability is achieved through maintaining soft-state forwarding entries for the MHs and leveraging fault detection mechanisms built in existing intra-domain routing protocols. In conclusion, Hawaii exploits host-speci?c routing to deliver micro-mobility. By design, routers perform pre?x routing to allow for a large number of hosts to be supported in the Internet. While routing based on host-speci?c addresses can also be performed at a router, it is normally dis- couraged, because it violates the principle of pre- ?x routing. Furthermore, host-speci?c routing is limited by the small number of host-speci?c entries that can be supported in a given router. However, this concern can be addressed by appropriate sizing of the domain and by carefully choosing the routers that are updated when a mobile is handed o?. One of the problems with the implementation of Hawaii is that a single domain root router is used. This router, as well as its neighbors inside the routing tree can become bottlenecks routers for the domain for two reasons: ?rst, they hold routing entries for all the mobile users inside the do- main, second, they participate in the handling of all control and data packets for the mobile users in that domain. Another disadvantage of Hawaii comes from its use of routers as a foundation for micro-mobility support. With cells becoming smaller, it is possible that a larger number of routers would be needed for user tracking and routing in a given area; however, this can become prohibitively expensive. 2.4. Multicast-based mobility Numerous solutions for supporting mobility via multicast routing have been proposed [2,6,7]. In [2,6], multicasting is used as a sole mechanism to provide addressing and routing services to MHs in the Internet. Each MH is assigned a unique multicast address. In [2], a MH initiates a group membership registration with the multicast router in its subnet (using the IGMP protocol). In turn, this router informs neighboring multicast routers about the multicast group (via one of several known protocols such as MOSPF and PIM). Multicast routers in the neighborhood of the user join this multicast address, and thus form a multicast tree for that address. Packets sent to the multicast address of the MH ?ow down the multi-cast 1distribution tree reach the MH. In [6], a MH sends source-speci?c join messages towards every CH with which it wishes to communicate. As the MH moves and connects to another location, the multicast router at that location joins the group address, and so a multicast tree, rooted at the CH gets formed and is used for routing packets between the CH and the MH. In [7], a multicast architecture is used to accelerate Mobile IP, by avoiding the need to inform the HA of every change in location. MHs are assigned pre-arranged multicast group addresses at the HA. Neighboring base stations in the vicinity of the MH adhere to this group address, and a multicast tree gets formed, rooted at the HA. Packets are then tunneled from the HA to the MH, along this multicast tree. The most signi?cant drawback of multicast-based solutions is that they require routers to be multicast capable; this capability either does not exist, or it is not turned on in the Internet routers of today. In essence, this solution requires that routers learn multicast addresses, in the same way that routers learn unicast addresses in Hawaii. Unlike LAN switches, routers are not designed to learn host addresses, and therefore they would need to be modi?ed for this purpose. Other drawbacks of mobility schemes based on multicast routing are that they require unique multicast addresses to be used, which creates address management complexity and limits the addressing space. 2.5. Micro-mobility and LAN switching In all the solutions for micro-mobility that we presented, ?xed IP addresses are used to track mobile users inside some region. This is done via learning at wireless BSs, routers or agents. Despite the use of IP addresses, which are hierarchical, routing to mobiles inside a region is performed in a ?at-address space, just like in a LAN. Conse- quently, MH addresses are tracked in a similar fashion as layer-2addresses in LANs. We further make the observation that, in fact, these addresses are tracked in the same way as virtual channel identi?ers in virtual circuit-switched solutions such as ATM (e.g. employed in UMTS for the tracking of users by foreign gateways). In their original design, routers were not meant to perform tracking of individual host addresses, and consequently do not perform host-speci?c routing in an e?cient way. It is unlikely that, in the near future, routers in the Internet will be replaced by routers that perform this function. It is also unlikely that an infrastructure consisting of such modi?ed routers would be deployed to support mobility inside a micro-mobility region. However, it is feasible to imagine that an overlay infrastructure consisting layer-2switches, which, by design, can track host e?ciently, could be deployed in a cost- e?ective manner to achieve this goal. 3. A network infrastructure for mobility support using layer-2 technology Over the past decade, we have witnessed tremendous developments in LAN technologies, such as increases in switch processing by a few orders of magnitude, and increases in link bandwidth and distances (owing to the ?ber optics technology). These advances resulted in an increase in the size of LANs, and more recently, the deployment of such technologies in metropolitan areas. Mobile users can roam inside a LAN without having to update their addresses. The reason why this is possible is because LAN switches learn the users location and can route packets to them quickly using this information. Furthermore, layer-2tech- nology is cost-e?ective by virtue of its simple protocols and large-scale deployment. For these reason, layer-2technology is at the foundation of our network design for mobility. In addition to layer-2, functionality at layer-3 and possibly the directory (DNS) layer is needed to support mobility at a global level across the Internet. As described earlier, Mobile IP may be used to tunnel tra?c appropriately when users move between subnets. Furthermore, dynamic DNS may be used to improve performance by avoiding triangle routing through the HA, as mentioned in the Introduction. A description of such a solution is depicted in Fig. 4. In the rest of the paper, we focus on the design and analysis of one possible implementation of our Fig. 4. A multi-layer architecture for IP mobility. layer-2for mobility support in metropolitan areas. This network has a number of design goals, namely: fast tracking of users, for the purpose of supporting mobility and applications with time constraints; a simple, low cost design for easy de- ployment; incremental scalability from small cities to large cities with many users (tens of millions), each consuming high data bandwidth (tens of ?nally, support for Internet connectivity, at high speeds (microseconds) and high bandwidth (tens of Tb/s). To achieve the fast tracking of users, it is necessary that a ?xed address be maintained for each user while it roams inside the network, to avoid the penalty of acquiring and releasing many di?erent addresses. From this perspective, a mechanism for address tracking is necessary, similar to that performed by the switches in a LAN. However, unlike in LANs, the tracking of users must happen at a faster pace, to accommodate for user mobility at many speeds. In LANs, switches learn about user location via the snooping of data packets originated at that user. Instead, what needs to take place is the explicit registration of users with the switches in the network. This network exhibits functionality that is not typically present in LANs, thus we refer to it as MobiLANe (i.e. LAN for mobile users). The number of switches involved in tracking each user has to be carefully considered so as to ensure the fast completion of location updates for each such user. To achieve this goal, the Mobi- LANe could be decomposed into control partitions that include only a subset of the switches in the MobiLANe. Each user is tracked by the control partition that includes the switch local to the user. Note that each switch tracks only a subset of the users (according to the placement of users at a given time). Thus, another bene?t of this approach is that the tracking databases at each switch can be made smaller and thus the switches can be faster and cheaper. A protocol similar to the generic attribute registration protocol (GARP) [14] is designed to track users inside a given control partition according to the user location. Since the location information for a user is not ?ooded across the entire MobiLANe, an algorithm must be designed for routing user packets that properly exploits the information at the control partition for that user. This can be achieved by employing the multicast feature of LAN switches, which allows us to selectively multicast data packets towards the control partition for that user, from where the packet can be delivered directly to the user. To this end, the protocol could also decompose the MobiLANe into data partitions. Each control partition must have one or more switches in common with every data partition. Similarly, each data partition must have one or more switches in common with every control partition. Data packets for a given user are propagated along a given data partition (as given by the location where the data packet was ?rst injected into the MobiLANe) until the control partition for that user is reached and the packet delivered to the user. More details are given in the following sub-sections In this paper, we choose to interconnect a large number of switches via the grid topology (e.g. the Manhattan Street Network) as shown in Fig. 5. For this topology, each row in the grid could be a control partition and each column, a data parti- tion, as depicted in Fig. 6. The choice of the grid topology is partly driven by the fact that the grid matches the topology of cities themselves??with the streets being rows and column. In addition, the grid is scalable by virtue of its distributed nature, which does not result in the aggregation of tra?c at some central location such as a root. Further- more, because of its uniformity, the grid lends Fig. 5. A MobiLANe implementation using switches connected by a grid topology. Fig. 6. A user and its control partition along the horizontal arrow. itself to a simple, low cost deployment, that allows the same switches and link interconnects to be deployed at all locations across the area. This eliminates the need to study and understand the tra?c in the area, in order to properly scale each individual switch and link bandwidth in the net- work. However, due to their large number, wireless cells are connected to MobiLANe switches in a hierarchical fashion. This hierarchy is necessary to reduce the number of hops to be traversed when communicating between two access points in the grid, and therefore reduce latency. The MobiLANe topology may not be a perfect grid for various reasons: the MobiLANe can not be deployed as a regular structure due to terrain or administrative restrictions; some switches or links may fail, resulting in rows and columns of varying length. To cope with this situation, we developed the following algorithm to render a grid structure over an irregular topology: we de?ne a virtual row/ column to be a set of switches and all the edges between them, such that for any pair of switches in that row/column ha; bi, the path between a and b is entirely contained in that row/column. The following properties are true: 1. The MobiLANe is represented by the sum of all virtual rows and by the sum of all the virtual columns. 2. Each virtual row/column must intersect all virtual columns/rows. We partition MobiLANe into virtual rows and columns to create the desired grid structure. Let us take the example of a missing switch, or a ??hole??. Intuitively, work around ??holes?? in the topology by including the switches that neighbor the hole into virtual rows/columns as follows: for a hole at location hI; Ji, where I is the row number and J the column number: 1. Add switches hI J 1i to virtual column J (assuming these switches are not holes). 2. Add switches hI J ? 1i to virtual row I (assuming these switches are not holes). To connect to the Internet backbone, a scalable and distributed gateway router is necessary to support the aggregate tra?c between the Internet and all the cells in the MobiLANe. Indeed, if the numbers of cells and users are large, this band-width can become very large. For example, for a LAN supporting two million users, consuming 2 Mb/s each, the routing bandwidth is 4 Tb/s. Fur- thermore, the router must be physically distributed across many smaller routers to allow for load balancing at the links connecting the LAN switches to the subnet router. To address this, in this implementation we superimpose a number of IP subnets onto MobiLANe (at the logical level), each controlled by one of the IP gateways, which are placed at di?erent locations in the area, as shown in Fig. 5. When a user enters the MobiLANe, it is given an IP address by the gateway controlling one of the subnets (this gateway is, say closest to where the user is located). Evidently, the user IP address does not change while the user is still in the Mo- biLANe. It is the responsibility of the switches inside the MobiLANe to appropriately route packets to and from the user regardless of the location of that user. Switches track a user by learning either the MAC or the IP address of that user. The advantage of MAC addresses is their use in LAN switching today. One disadvantage of using MAC addresses is that not all devices may come with a built-in MAC address. Another disadvantage is that some form of address resolution like ARP needs to be performed at the Mobi- LANe, to map the IP address of the user to its MAC address. If the MobiLANe is large, this operation may take a long time. To cope with the later challenge, a database is used at each gateway to map the IP addresses of users to their MAC addresses. This database holds an entry for every user belonging to the IP subnet for which that gateway is responsible. The database of a gateway is updated at the same time that the user enters the MobiLANe and receives an IP address from that gateway. 3.1. Registration protocol As mentioned earlier, the propagation of tracking information in the partition is by means of a dynamic registration protocol similar to the GARP [8]. The protocol, depicted in Fig. 7, consists of a number of control messages: 1. The JOIN message informs switches of the arrival of one or more users. 2. The LEAVE message informs switches of the user(s)?s departure from the switch?s jurisdiction 3. An ACK message con?rms that the registration updates have been received. A switch of a partition is a local switch if it is directly connected to the access point where a user resides. The other switches in the partition are Fig. 7. Registration protocol. known as remote switches. A local switch propagates control information to one or more remote switches in the partition. If rings are used to connect the switches along rows and columns, then the control messages at the local switch are propagated as follows: 1. either left or right when the control partition is a row or a virtual row, 2. either up or down when the control partition is a column or a virtual column, 3. either left and down, left and up, right and down or right and up when a control partition is a pair of rows (or virtual rows) and columns (or virtual columns). When the MobiLANe is con?gured, switches are programmed to propagate control messages in a ?xed direction selected form the choices outlined above. When a control message arrives at a remote switch, it is used to con?gure the routing tables appropriately. It is also remembered and sent out on the port directly opposite to the port where the control message was received (e.g., if the control message is received on the left port, it is propagated on the right port). When a control message arrives to a switch that has already seen it, it is consumed and removed from the ring. If a ring topology is not used to connect switches in a row or column, the control message at the local switch is multicast in two directions when the control partition is either a row (virtual row) or column (virtual column) (e.g. up and down that column), and four directions when pairs of rows (virtual rows) and columns (virtual columns) are used (up, down, left and right). Note that if a given control message did not cause the routing tables for a given port to be updated, then the message is not propagated along that port. One such case occurs when the control partition is a row and the user moves from one switch to the next switch in that row. The new local switch observes that the routing tables for the horizontal ports need not be updated, hence a control message is not sent to the remote switches. Every time a mobile crosses cell boundaries, a JOIN message is sent to the local switch by the wireless cell to which the user is connected. The JOIN is propagated across the new control parti- tion. An ACK reply is propagated in the reverse direction across the same control partition. Upon reception of an ACK message for the JOIN at the local switch, a LEAVE message is sent to the old switch port, which then gets propagated across the old control partition (we assume that communication between the new and old local switches is possible). An ACK reply is then propagated across the old control partition and sent to the new local switch, which completes the registration process. Acknowledgements are used to ensure that user registration and de-registration with the switches of a partition are atomic. When moving from one partition to another, a user leaves the old partition only after it has joined the new partition and received an acknowledgement from it. Notice that simply receiving a packet from the switches in the new partition is not enough to guarantee atomicity because some switches may not have been properly set. This is because the packet may come from another user within the partition without traversing all the switches in that partition. However note that acknowledgements can be piggybacked to the user packets that may be traversing the partition, in order to reduce latency and bandwidth con- sumption. This technique assumes that cell overlap is possible and its extent long enough to allow for the new JOIN to complete, and the ACK to be received. A terminal switch is a switch that determines not to propagate a registration message received at an input port to any output port. Each switch that is not a terminal switch waits for acknowledgements from other switches before submitting an acknowledgement. Terminal switches update their databases and then send acknowledgements without further wait. When single rows or columns are used for control partitions, the local switch waits for a single acknowledgement before proceeding with the LEAVE. When pairs of rows and columns are used as control partitions, then the local switch waits for two acknowledgements, one from the row switches, and one from the column switches. Note that if a switch moves from one partition to another partition that have a common row or column, then a single acknowledgement is needed, corresponding to the column or row that is different 3.2. Routing In our routing protocol, we capture the mechanism by which routing at the switches is to be performed along data and control partitions. When a switch receives a data packet for some user, the following possibilities arise: 1. If the user is known to the switch (i.e. the switch belongs to the control partition for that user), then the packet is routed according to the information in the table. 2. If the user is not known to the switch (i.e. the switch does not belong to the control partition for that user but belongs to the data partition for that data packet), then the data packet is routed according to some routing algorithm selected when the MobiLANe was originally con?gured. We identi?ed three such routing algorithms: (1) Vertical. If the switch is the ?rst switch in the data partition to see the packet, and the ring topology was not used to connect the switches of a row or a column, then the packet is routed BOTH up and down. If the switch is the ?rst switch in the data partition to see the packet, and the ring topology was used to connect rows and columns, then the data packet is routed either up or down, depending on the switch con?guration. This routing scheme is called vertical-?rst routing. (2) Horizontal. If the switch is the ?rst switch in the data partition to see the packet, and the ring topology was not used to connect the switches of a row or a column, then the packet is routed BOTH left and right. If the switch is the ?rst switch in the data partition to see the packet, and the ring topology was used to connect the switches of a row or a column, then the packet is routed either left or right, depending on the switch con?guration. This routing scheme is called horizontal-?rst routing. (3) Sometimes horizontal and sometimes vertical. Here we combine the two algorithms above. Some packets are routed using vertical-?rst routing while others are routed using horizontal-?rst routing. We describe each algorithm in more detail in the following subsections. 3.2.1. Vertical-?rst routing Vertical-?rst routing refers to a scheme where a switch in the grid routes vertically a packet that it receives for a user unknown to it. Eventually, the packet arrives at a switch that knows the user (at the intersection of the control partition for that user and the data partition for that data packet), from where the packet is then routed home. For this routing scheme to work, the tracking protocol requires that the control partition for every user include the row in which that user is located. Vertical-?rst routing with row control partitions is depicted in Fig. 6. At ?rst, the packet is routed up the column, where it eventually reaches a switch that ??knows?? the user. If the column is a ring, the packet is only routed in one direction (ei- ther up or down). Otherwise, the packet is multicast up AND down. The ?rst switch that knows the user routes the packet horizontally. If the row is a ring, the packet is only routed in one direction (either left or right). Otherwise, the packet is multicast left AND right. From there on, the packet is routed horizontally until the switch to which the user is attached is found and the packet gets delivered. 3.2.2. Horizontal-?rst routing This works identically to vertical-?rst routing, except that the direction taken by a packet at a switch is horizontal instead of vertical when that switch does not recognize the user for which the packet is intended. 3.2.3. Alternating vertical-?rst and horizontal-?rst routing Intuitively, one can see how vertical-?rst routing or horizontal-?rst routing can lead to load unbalance if the users or the input/output vertices are concentrated along a particular row or col- umn. For example, if the users are concentrated along some column and horizontal-?rst routing is used, then tra?c is routed along the vertical axes by using primarily that column. Also, if the input to the grid is concentrated along one column and vertical-?rst routing is used, then tra?c is routed vertically by using primarily that column. To avoid this situation, the routers of the MobiLANe must be distributed in a balanced fashion across the MobiLANe. However, depending on the re- gion, it may not be possible to control the distribution of routers so to ensure uniform coverage of all rows and columns. Under these circumstances, a routing algorithm that distributes the load fairly across the MobiLANe becomes essential. This is particularly important when the link bandwidth is scarce (e.g., microwave radio links or low-cost MobiLANe infrastructure). Consequently, in order to balance the load, we designed a scheme that alternates vertical-?rst routing with horizontal-?rst routing. The scheme works as follows: instead of always routing horizontally or vertically when the destination user is unknown, switches route vertically sometimes and horizontally other times. By alternating between vertical-?rst routing and horizontal-?rst routing, we ensure that, in the long run, the load is divided fairly across all rows and all columns, regardless of the user and router distribution. In order to guarantee that all packets reach their intended destinations, we must ensure that packets are routed in the same fashion (vertically or horizon- tally) at all the switches that do not recognize the user for whom a given packet is intended. This is achieved by having the ?rst switch that routes the packet select the routing direction. This switch marks the packet to communicate to the other switches that a routing direction had been selected for that packet. The other switches observe that the packet is marked and are required to follow suit and route in a similar fashion. They route the packet to the port directly opposed to the incoming port (e.g. the left port if the packet was received on the right port). The ?rst switch selects the routing direction by alternating between the vertical and horizontal direction in a round-robin or random fashion. 3.2.4. Clustering It is expected that users visit cells in the neighborhood of their location more frequently than remote cells. In our schemes, when rows are used as control partitions, and the user moves to the next row, registration with the new row and de-registration with the old row need to take place. When pairs of rows and columns are used as control partitions and the user moves either to the next row or the next column, registration with the new row or new column need to take place. If the user moves frequently, then these updates can be ex- pensive. One solution is to perform user tracking in a hierarchical way that exploits the spatial locality of user movement. Instead of a local switch, we use a cluster of switches, called the local cluster. As before, we use rows (or columns, or both) to track and locate users. However, while before the row (or column, or both) was used to obtain the location of the user exactly, now it is used to obtain the location of the user cluster to which the user belongs. To ?nd the actual the location of the user, we use the tracking at the switches inside the local cluster. Tracking inside a local cluster is performed as follows: (1) If rows are used as control partitions to ?nd the local cluster, then columns (or segments of columns) must be used as control partitions to ?nd the user inside that cluster. By using columns as control partitions inside the local cluster, we ensure that the registration information can be propagated between the local cluster and the row that tracks that cluster. (2) If columns are used as control partitions to ?nd the local cluster, then rows are used as control partitions to ?nd the user inside that cluster. (3) If pairs of rows and columns are used to ?nd the local cluster, then pairs of rows and columns are used to ?nd the user inside that cluster. When a user moves inside a local cluster, tracking updates need to take place only at switches in that cluster. When a user leaves a local cluster and joins another, we update the tracking databases in the rows and columns of the grid that track the new local cluster, as well as inside the new local cluster. Depending on the size of the cluster, updating tracking databases inside the local cluster can be signi?cantly less expensive than updating an entire row or column of the Mobi- LANe. Clustering can signi?cantly reduce the cost of completing a location update. Routing is performed in two steps: ?rst, the local cluster is found, via one of the routing algorithms we described before. Second, the actual user location is found, via routing at the switches inside the cluster. Fig. 8 shows the switches clustered in di?erent clusters corresponding to di?er- ent quadrants of the grid. The lines corresponding to the column and row used for tracking the cluster in which the user resides are shown by the dotted lines. The switch where these lines intersect is known as the head (or pivot) of the cluster. The pivot is dynamic for each user, and is given by the Fig. 8. MobiLANe clustering. switch via which the user had joined the cluster. By making the pivot dynamic, we allow the tra?c load to be more uniformly distributed across the rows and columns of MobiLANe. 3.3. Contributions of MobiLANe design The MobiLANe design has a number of ad- vantages. The MobiLANe does not rely on a single spanning tree or root switch. This is important for scalability as the MobiLANe extends to large geographical scopes. By exploiting control and data partitions, it minimizes the latency of user location updates without a?ecting the latency of packet routing inside the MobiLANe. Finally, its operation relies signi?cantly on existing switching techniques and protocols, which makes the solution simple, inexpensive and easy to implement and deploy. 4. Simulation environment We use a stochastic mobility model from the University of Waterloo [9], which simulates daily movements of mobile subscribers, incorporating realistic activity patterns. The input data to the model includes an activity transition matrix and an activity duration matrix, derived from the trip survey [18] conducted by the Regional Municipality of Waterloo in 1987. For this survey, a travel diary was completed by each household member over ?ve years of age, in which details were recorded on all trips taken during the day of the survey. Included for each recorded trip were the trip start and end times, the trip purpose at the origin and destination, and employment or student status. There are nine types of activities de?ned in the model, which are as follows: work, school, shop- ping, personal business, work-related, serve pas- senger, social/recreation, return home and other. Each activity has an associated time of day, duration and location (at the level of a radio cell). In a given simulation run, activities are selected based on the previous activity and the current time pe- riod. The probability of transition from one activity to another uses the activity transition matrix. Once the next activity is selected, its duration is determined using the activity duration matrix. Finally, the location of the activity is selected, based on certain heuristics and the activity type (e.g., if the activity purpose is ??shopping??, a cell is randomly selected from a set of cells neighboring the subscriber, within a radius as given by the retail characteristics of the region). Once the location of the next activity is selected, the intermediate route (in terms of cells crossed) and the total distance are determined from a geographical lookup table. Using a user-de?ned system-wide average speed, the time spent in each intermediate cell is calculated. The subscriber stays in the destination cell for the duration of the activity, and the sequence is repeated. The output from the model is thus a trace of the daily movement of individual cellular subscribers over a period of several days, in terms of cells crossed and time spent in each cell. The geography of the region simulated, which is shown in Fig. 9 (approximated from the geographical lookup table), covers 312km 2 and is divided into cells, each covering an average of 7km2. For each subscriber, a home cell, a work cell and a school cell are selected randomly from among the cells in the region. Starting at home, users take daily trips such as going to work and back, going shopping and going to the movies. We simulated during which subscribers were tracked on a per minute basis. The simulation is event-driven and has a granularity of one minute. An event that occurs between two minutes is considered to have occurred at the earlier minute. Fig. 9. Cell division for the region simulated. Since they happen during the same minute, the JOIN, LEAVE and ACK corresponding to a cell crossing occur simultaneously in our model. In our simulations, two wireless cell types are employed: macro-cells and micro-cells. A macro-cell maps directly to a cell as de?ned in the mobility model discussed above. The characteristics of the wireless macro-cells are summarized in Table 1. An architecture where cells are further subdivided into micro-cells is also discussed (Table 2). Macro-cells are subdivided into micro-cells to increase user bandwidth. Mainly, one macro-cell is subdivided into 700 smaller cells, allowing short-range wireless protocols (like 802.11b) to be used inside a micro-cell. This results in approximately 7.5 Gb/s bandwidth to be available inside a cell, i.e. an increase by 770,000 in bandwidth per cell. Higher user bandwidth is crucial for deliver- Table Macro-cell characteristics Range 7 km2 Bandwidth 100 kb/s Total number of cells 45 Example of protocol Cellular telephony Table Micro-cell characteristics Range Bandwidth 11 Mb/s Total number of micro-cells 31,500 Example of protocol 802.11b ing multimedia to mobiles. A single H.263 video Kb/s, so this would allow for approximately 770,000 users to receive di?erent video streams simultaneously inside a cell. For this con?guration, multiple switches are used to balance the load across the region and to reduce the number of ports needed for connecting the micro-cells at a switch. Since the total load across all the micro-cells in the region is about 340 Gb/s, we chose to spread this load across 45 switches, each responsible for 7.5 Gb/s sent to/from users in the 700 micro-cells of a cell. The switches are grouped in a grid consisting of nine rows and ?ve columns 5). To compare the performance of our system against the performance of other schemes, we consider three scenarios as follows: (1) The Mobile IP scenario: nine foreign agents populate the region, each responsible for one-ninth of space (as given by a row in the grid). For experimental purposes, the HA is considered to be outside the region, with each FA being directly connected to the HA (at equal distances). Location updates are sent to the HA. To reach its destination user, tra?c arrives at the HA from where it gets forwarded to one of the foreign agents inside the region. This is shown in Figs. 10 and 11 by the interrupted line between the CH, HA and the re- gion. Notice that Mobile IP allows the CH to receive binding updates with the latest COA of the user. However, in our simulations, each call is generated by a di?erent CH, hence the information in the binding cache is irrelevant. Fig. 10. Simulation scenario with wireless macro-cells. Fig. 11. Simulation scenario with wireless micro-cells. (2) A typical micro-mobility algorithm (such as HFA or Cellular IP), labeled Micro IP. 45 routing devices (such as FAs in HFA or switches in Cellular IP) populate the region, and are connected via a hierarchical interconnect as shown in Fig. 12. A gateway connects the root of the tree to the Internet. Location updates are handled locally by the hierarchy and do not need to reach the HA. However, all tra?c from the CH traverses the HA prior to arrival at the region. (3) MobiLANe: The MobiLANe is populated by 45 switches interconnected via a regular, 9 5 grid topology. Each switch controls one macro-cell Fig. 12. The tree hierarchy in Micro IP. The gateway (G) is connected to the root of the tree, and to the Internet. The region is populated by 45 routing devices. or 700 micro-cells in a cell area. To superimpose the grid structure on the region, the switches are grouped into irregular columns and rows (an example of a column is shown in Fig. 9). Figs. 10 and 11 depict the MobiLANe implementation for each wireless cell type we considered. In this paper, vertical-?rst routing is used, and no clustering. For the users in the MobiLANe, DNS is updated with the COA of the gateway responsible for the region. Tra?c from the CH arrives directly at the gateway from where it is forwarded to the switches. This is shown in the ?gure by the uninterrupted line between the CH and the region. Location updates are handled by the switch local to the moving user and do not need to be forwarded to the HA. A stochastic model for user voice tra?c is assumed in order to test the impact of the mobility architecture on user tra?c performance. Tra?c is originated from a CH, located outside the area, and is addressed to a user inside the area. Users receive phone calls at random times throughout the day. The number of phone calls per day and the duration of each phone call are entered statically as parameters to the simulation. We identi?ed a number of important metrics for evaluating our architecture: the peak per minute control load, including the total number of JOIN?s, LEAVE?s and ACK?s at a switch BW_CTL; the peak per minute data load at a switch BW_DTA; the time to complete a location update, in terms of the number of switches traversed LAT_CTL. Note that, to complete an update, multiple switches may be traversed in parallel (e.g., across the row and column of a control partition). In this case, we consider update latency to be the longest of the parallel tracks traversed to complete the update. In the case of LAT_CTL, we consider the time to setup paths to users entering the region (Init), as well as the peak and average (Avg) per minute values across all users. We also consider the time for a packet to travel from source to destination, which we call routing latency or LAT_DTA. We measure routing latency in terms of the average number of switches traversed per packet across all users. To compute BW_CTL, we count the number of control messages per minute, multiply it by the length of the control message and divide it by 60. The length of the control message is assumed to be B. We think 16 B is a good estimation since it includes 12B for the source and destination ad- dresses, 2B for the checksum and 2B for various attributes and options. To compute LAT_CTL, we measure the number of cell crossings that occur during a simulation, and multiply this number by the number of switches involved in a location update for each algorithm. The duration of the location update depends on the scenario as follows: for the Mobile IP scenario, it represents the time to update the database at the local FA, to transfer the update message between the FA and the HA and the time to update the database at the HA; for the Micro IP scenario, it represents the time to update the appropriate routing devices in the tree; ?nally, for MobiLANe, a location update includes the time to update the appropriate switches in the MobiLANe. To compute LAT_DTA, we measure the number of switches involved in transferring each packet across the MobiLANe and multiply it by the time to transfer the packet at the switch. We add the time to transfer the packet between the CH and the gateway in charge of the mobile. For the Mobile IP and Micro IP scenarios, we add to this number the time to transfer the packet between the HA and the region. We show the sensitivity of LAT_DTA to time between the HA and the region. We assume that the distances between the CH and the HA, between the HA and the region and between the CH and the region are the same. 5. Simulation results 5.1. Control load In this section, we investigate the scaling of control load with the size of population in the re- gion, in the case of MobiLANe with macro-cells and MobiLANe with micro-cells. It is important that the control load amount to a small number (relative to the capacity of the switches of today) for MobiLANe to be a feasible solution, for a variety of population sizes. Fig. 13 shows BW_CTL for MobiLANe with macro-cells and MobiLANe with micro-cells, and Fig. 13. BW_CTL for di?erent population sizes for the cases of MobiLANe with macro-cells and MobiLANe with micro-cells. for various population sizes between 1000 and people. Prohibitively long simulation times limited the population size studied to this range. The dependency of BW_CTL on population size is sub-linear. When scaling from 1000 to 5500 people, we noticed sub-linear e?ects: less than 3.3 and 2.5 increase for MobiLANe with macro-cells and MobiLANe with micro-cells, respectively. This is explained by the fact that, for this population range, an increase in population size contributes primarily towards the spreading of tra?c across more cells and more time slots and only secondarily towards increasing peak tra?c in a given time slot and a given cell. More substantial increases in BW_CTL are expected for high population ranges due to the increased user concentration in a given time slot. As expected, cell subdivision results in a sig- ni?cant increase in BW_CTL because of the increase in the rate of cell crossings. The subdivision of each macro-cell into 700 micro-cells results in about 7 increase in BW_CTL. Assuming linear increase for high population densities, a population of 500,000 people (which is large for a region of 312km 2), would generate about 200 Kb/s in control tra?c in the case of MobiLANe with mi- cro-cells. Assuming a registration latency of 1 ls, (or the equivalent of 10 SDRAM lookups), a single switch can support 1,000,000 registrations per second, or an equivalent of 122 Mb/s. Since the maximum value achieved by BW_CTL is 200 Kb/s, there is more than enough bandwidth to support the registration bandwidth generated by this region fully populated (at 500,000 people). In this section we demonstrated the feasibility of MobiLANe with macro-cells and MobiLANe with micro-cells, with regard to supporting registration tra?c for tracking user movement. In the rest of the paper, we present results only for MobiLANe with micro-cells, because it represents a more interesting experimental case, and it delivers higher data bandwidth to users. 5.2. Control latency Fig. 14 shows the behavior of the average LAT_CTL as a function of distance to the HA for Mobile IP. LAT_CTL for MobiLANe with one gateway is plotted for reference. A 1 ms processing delay at the FA and every switch in the network is assumed. Processing time at the HA in considered part of the distance to the HA. As we can see from the graph, Mobile IP does generally worse than MobiLANe because of the overhead of communicating with the HA upon every location change. However, if the HA is nearby to where the user is located, HA updates may take less time than local updates in MobiLANe. This is because, for MobiLANe, a larger number of electronic switches need to be involved in one location update than for Mobile IP. Fig. 15 shows Init, Peak and Avg. LAT_CTL for MobiLANe, Micro IP and Mobile IP. The distance to HA is arbitrarily set to 20 ms. We observe that MobiLANe performs better than both Mobile IP and Micro IP in all three cases: the time to setup connectivity to subscribers (Init), and the peak and average LAT_CTL. The reason Fig. 14. Avg. LAT_CTL for Mobile IP, for di?erent distances between the local FA and the HA. Fig. 15. Init, Peak and Avg. LAT_CTL for MobiLANe with micro-cells and one gateway, Micro IP and Mobile IP. MobiLANe performs better than Mobile IP is because no HA overhead is incurred. The reason MobiLANe performs better than Micro IP is because fewer switches need to be informed of the location of users, due to the selective multicast nature of the routing algorithm of the MobiLANe used in MobiLANe. 5.3. Data load Fig. plots di?erent numbers of gateways, di?erent per-user application bandwidth Kb/s, 128 Kb/s and 1 Mb/s) and for three different schemes: Mobile IP, Micro IP and Mobi- LANe (with ?ve di?erent numbers of gateways). We notice that the best results are achieved for Mobile IP. This is because, in this implementation of Mobile IP, FAs only track and route to/from users in their portion of the region and do not transfer tra?c sent for another foreign agent in that region. When multiple gateways are used, decreases considerably from the case of a single gateway. When four gateways are used, less than half as much peak tra?c is born by the switches than when one gateway is used. This means that, when multiple gateways are used, smaller, cheaper switches can be deployed in the MobiLANe. 5.4. Data latency 5.4.1. Impact of dynamic DNS Fig. 17 displays LAT_DTA for various distances between the MH and the HA and the CH and for three di?erent scenarios: MobiLANe with one gateway, Micro IP and Mobile IP. increases monotonically with distance; a slower rate of growth is observed for MobiLANe (owing to the use of dynamic DNS which circumvents the need for tunneling through the HA). For a distance value of 40 ms, LAT_DTA is almost twice smaller if dynamic DNS is used. Notice that for Fig. 17. LAT_DTA for MobiLANe with micro-cells and one gateway, Mobile IP, Micro IP. Fig. 16. BW_DTA for MobiLANe with micro-cells for di?erent number of gateways. switching technologies, as well as load balancing techniques and the use of multiple distributed gateways which have the e?ect of lowering the peak load and memory requirements at the switches, make it possible to implement Mobi- LANe with small and inexpensive technology. 7. Migration path Fig. 18. LAT_DTA for MobiLANe with micro-cells for different numbers of gateways. small distance values (a few ms), LAT_DTA is actually larger in the case of MobiLANe and Micro IP than for Mobile IP. This is because of the inherent overhead of traversing the switches populating the region. In the case of Mobile IP, fewer electronic components are traversed as packets are routed between the CH, HA and the MH. 5.4.2. Impact of multiple gateways Fig. shows the variation in LAT_DTA for MobiLANe in terms of the number of gateways. We notice that decreases slightly as more gateways are used. This is for two reasons: when the MobiLANe is populated with more gate- ways, these gateways are placed closer to subscribers than when fewer gateways are used. Secondly, subscriber movement exhibits a small degree of locality; on average, subscribers are closer to their home gateways than to any other gateway in the MobiLANe. A distance of 20 ms between the MobiLANe and the CH, and a 1 ms processing delay at the gateway are assumed. 6. Contributions of MobiLANe Our simulations demonstrate that MobiLANe is a scalable, feasible solution for supporting IP mobility over a large metropolitan area. By virtue of localized registration and distributed routing algorithms and the use of dynamic DNS, Mobi- LANe fairs better in performance than other existing schemes. Reliance on existing, low-cost To transition to the mobile network of tomor- row, it may not be possible to design the supporting network infrastructure from scratch. Instead, support for mobility may need to be built on existing network structures, such as small subnets controlled by LAN switches and inter-connected by IP routers with a small number of host-speci?c entries. Under such circumstances, one possibility is the use of virtual private networks (VPN) to o?er extended LAN connectivity across multiple small subnets. In order to support mobile users in the most e?ective fashion, the protocol to handle mobile users needs to be ?exi- ble enough to operate at di?erent layers in the protocol stack, and versatile enough not to require changes in the implementation of the LAN switches and IP routers of that network. In par- ticular, the protocols running on LAN switches should be based on existing 802protocols, since they are implemented in hardware and therefore cannot be easily replaced or reprogrammed. The main challenge becomes how to use and optimize existing protocols for the purpose of e?cient support for mobility. 8. Conclusions This paper surveys the state-of-the-art in providing mobility support to mobile users in the Internet. In particular, emphasis is placed on micro-mobility techniques designed to accelerate Mobile IP. One observation is that all micro-mobility solutions work in a similar way by requiring that network devices inside a given geographical area learn about the location of users and keep track of them as they move inside that area. The di?erences among these techniques are the type of device required to do the learning (it could be an IP router, Mobile IP agent or LAN switch) and the protocols for routing packets using the learning databases. This paper also proposes the deployment of an infrastructure based on simple and cost-e?ective layer-2technology, to support user mobility in geographical areas of many scopes. One important feature of this infrastructure is its scalable and e?cient MobiLANe design, geared at accelerating Mobile IP in large geographical re- gions. By relying on existing technologies, and by virtue of working with Mobile IP, this solution is global, cost-e?ective, easily deployable and compatible with the Internet of today. --R A new multicasting-based architecture for Internet host mobility A multicast-based protocol for IP mobility support HAWAII: a domain-based approach for supporting mobility in wide-area wireless networks IEEE 802.1d MAC Layer Bridging Standard. TRIAD: a scalable deployable NAT-based Internet architecture Waterloo Region Travel Survey Route Optimization in Mobile IP where she worked on DSP systems. design technologies. including protocol design In June the School of Engineering at Stanford University Computer Science. served as Chief Technical O? interests include packet switching in ground radio and high speed local area networks multimedia networking and network systems. computer communications and local area networks. winner of the cess protocols in packet communications networks? winner of the IEEE Communications Society Communications in the IEEE Transactions on Communications for the period Satellite Networks in the Journal of Telecommunications Networks for the period on local area networks of the IEEE Journal on Selected Areas in Communications (November in local area networks issue on Selected Areas in Communications (October served as Co-Editor of Advances in local area networks in the series Frontiers in Communications (IEEE Press in high speed networks He is a member of the Association for Computing Machinery and has served as an ACM National Lecturer for the period Kuwait Prize in the --TR Internet mobility 4MYAMPERSANDtimes;4 A new multicasting-based architecture for Internet host mobility An activity-based mobility model and location management simulation framework An end-to-end approach to host mobility Mobile communications A multicast-based protocol for IP mobility support IP Routing and Mobility HAWAII --CTR Cristina Hristea Seibert , Fouad A. Tobagi, Assessment and optimization of schemes for tracking and routing to mobile users in packet-based networks, Computer Networks: The International Journal of Computer and Telecommunications Networking, v.44 n.1, p.103-133, 15 January 2004 Hidetoshi Yokota , Akira Idoue , Toru Hasegawa , Toshihiko Kato, Link layer assisted mobile IP fast handoff method over wireless LAN networks, Proceedings of the 8th annual international conference on Mobile computing and networking, September 23-28, 2002, Atlanta, Georgia, USA
scalability;mobility;seamlessness;IP networks;local and metropolitan area networks;overlay infrastructure
599603
A Principal Components Approach to Combining Regression Estimates.
The goal of combining the predictions of multiple learned models is to form an improved estimator. A combining strategy must be able to robustly handle the inherent correlation, or multicollinearity, of the learned models while identifying the unique contributions of each. A progression of existing approaches and their limitations with respect to these two issues are discussed. A new approach, PCR&ast;, based on principal components regression is proposed to address these limitations. An evaluation of the new approach on a collection of domains reveals that (1) PCR&ast; was the most robust combining method, (2) correlation could be handled without eliminating any of the learned models, and (3) the principal components of the learned models provided a continuum of regularized weights from which PCR&ast; could choose.
Introduction Combining a set of learned models to improve classification and regression estimates has been an area of much research in machine learning and neural networks A learned model may be anything from a decision/regression tree to a neural network. The challenge of this problem is to decide which models to rely on for prediction and how much weight to give each. Suppose a physician wishes to predict a person's percentage of body fat, PBF. S/he has a collection of patient records with simple measurements/attributes such as height, weight, chest circumference, leg circumference, etc., along with a measurement of PBF derived from a water displacement test. The task is to predict PBF for future patients using only the simple measurements without performing the expensive water displacement test. The physician has derived several models for predicting PBF using various linear regression methods, several neural network configurations, and some existing heuristic functions. The goal is to combine the learned models to obtain a more accurate prediction than can be obtained from any single model. The general problem of combining estimates robustly is the focus of this paper. One major issue in combining a set of learned models is the amount of correlation in the set of predictors. A high degree of correlation is expected because the learned models are attempting to perform the same prediction task. Correlation reflects the amount of agreement or linear dependence between models when making a set of predictions. The more the models agree, the more correlation, or redundancy, is present. In some cases, one (or more) models may be expressed as a linear combination (with various numerical coefficients) of the other models. Such a high degree of correlation in the model set can cause some combining schemes to produce unreliable estimates. In statistical terms, this is referred to as the multicollinearity problem. Another issue in combining the predictions of learned models is detecting each model's unique contribution to predicting the target outcome. Models generated using different learning algorithms are more likely to make such contributions. For example, a neural network may discover useful non-linear interactions amongst the initial attributes, whereas a standard linear regression method may employ an attribute deletion strategy which simplifies the prediction task. A good combining strategy must be able to weigh each model according to its unique contribution. A tradeoff exists in solving the problems mentioned above. Solutions to the multicollinearity problem are likely to ignore the unique contributions of each model. On the other hand, methods that are good at finding the unique contributions of each model are more susceptible to the multicollinearity problem. A point between these two extremes where prediction error is minimized is sought. The focus of this paper is to present and study an algorithm for solving the problems of multicollinearity and discovering unique contributions. The paper begins by defining the task of combining regression estimates (Section 2) and discussing the limitations of existing approaches with respect to the problems discussed above. More advanced approaches to solving the multicollinearity problem are described in Section 3. A novel approach, called PCR*, based on principal components regression is outlined in Section 4. Analytical and empirical analyses are given in Sections 5 and 6, respectively. Related work is discussed in Section 7. Directions for future work are given in Section 8, and concluding remarks are given in Section 9. 2. Motivation The problem of combining a set of learned models is defined using the terminology of [25]. Suppose two sets of data are given: a training set D T a test set D Test rain is used to build a set of functions, each element of which approximates f(x). The goal is to find the best approximation of f(x) using F . Most approaches to this problem limit the space of approximations of f(x) to linear combinations of the elements of F , i.e., where ff i is the coefficient or weight of " The focus of this paper is to develop a method for setting these coefficients that overcomes the limitations of earlier approaches. To do so, a brief summary of these COMBINING REGRESSION ESTIMATES 3 approaches is now provided progressing from simpler to more complex methods pointing out their limitations along the way. The simplest method for combining the members of F is by taking the unweighted average, (i.e., ff Perrone and Cooper refer to this as the Basic Ensemble Method (BEM), written as This equation can also be written in terms of the misfit function for each " These functions describe the deviations of the elements of F from the true solution and are written as Thus, Perrone and Cooper show that as long as the m i (x) are mutually independent with zero mean, the error in estimating f(x) can be made arbitrarily small by increasing the size of F . Since these assumptions break down in practice, they developed a more general approach which finds the "optimal" 1 weights while allowing the to be correlated and have non-zero means. This Generalized Ensemble Method (GEM) is written as where and E[\Delta] is the expected value function. C is the symmetric sample covariance matrix for the misfit function and the goal is to minimize Note that the misfit functions are calculated on the training data and f(x) is not required. The main disadvantage to this approach is that it involves taking the inverse of C which can be unstable. That is, redundancy in the misfits leads to linear dependence in the rows and columns of C which in turn leads to unreliable estimates of C \Gamma1 . To circumvent this sensitivity redundancy, Perrone and Cooper propose a method for discarding member(s) of F when the strength of its agreement with another member exceeds a certain threshold. Unfortunately, this approach only checks for linear dependence (or redundancy) between pairs of " In could be a linear combination of several other members of F and the instability problem would be manifest. Also, depending on how high the threshold is set, a member of F could be discarded while still having some degree of uniqueness and utility. An ideal method for weighting the members of F would neither discard any models nor suffer when there is redundancy in the model set. The next approach reviewed is linear regression (LR). GEM and LR are closely related in that GEM is a form of linear regression with the added constraint that 1. The weights for LR are found as follows 2 , where A more general form of linear regression is linear regression with a constant term (LRC). LRC is calculated the same way but with member " predicts 1. According to [17] having the extra constant term will not be necessary (i.e., it will equal zero) because in practice, E[ " Like GEM, LR and LRC are subject to the multicollinearity problem because finding the ff i 's involves taking the inverse of a matrix. That is, if the f matrix is composed of " strongly agree with other members of F , some linear dependence will be present. Given the limitations of these methods, the goal of this research is to find a method which finds weights for the learned models with low prediction error without discarding any of the original models, and without being subject to the multicollinearity problem. 3. Methods for Handling Multicollinearity In the abovementioned methods, multicollinearity leads to inflation of the variance of the estimated weights, ff. Consequently, the weights obtained from fitting the model to a particular sample may be far from their optimal values. To circumvent this problem, several approaches have been developed: 1. One method for handling multicollinearity is to build models which make decorrelated errors by adjusting the bias of the learning algorithm [24] or the data COMBINING REGRESSION ESTIMATES 5 which it sees [19]. This approach ameliorates, but does not solve, the problem because redundancy is an inherent part of the task of combining estimators. 2. Gradient descent procedures (i.e., Widrow-Hoff learning, GD, EG and EG [12]) search for the coefficients by making iterative multiplicative or exponentiated updates to the ff-coefficients as a function of their performance on the training data. This avoids the matrix inversion step which is susceptible to the multicollinearity problem. The potential problems with gradient descent approaches are the possibility of getting trapped in a local minima, choosing the appropriate initial weights, and deciding how large the weight updates should be. 3. Least squares regression methods which rely on matrix inversion for finding the weights (i.e., LR and LRC) can be made more reliable by constraining the types of weights they may produce. Ridge regression, RIDGE [23] has a parameter that may be used to restrict or regularize the ff-coefficients. Breiman [2] has devised an approach based on constrained least squares regression [16] where the coefficients are required to be nonnegative. The focus of this paper is on a flexible approach to weight regularization based on principal components regression (described in Section 4. Now the discussion turns to a more precise description of weight regularization and why it is effective at handling the multicollinearity problem. Leblanc and Tibshirani [17] have proposed several ways of constraining or regularizing the weights to help produce estimators with lower prediction error: 1. Shrink " ff towards (1=K; is the number of learned models. 2. 3. ff i 0; Breiman [2] provides an intuitive justification for these constraints by pointing out that the more strongly they are satisfied, the more interpolative the weighting scheme is. In the extreme case, a uniformly weighted set of learned models is likely to produce a prediction between the maximumand minimum predicted values of the learned models. Without these constraints, there is no guarantee that the resulting predictor will stay near that range and generalization may be poor. An effective weight regularization technique must decide the appropriate level of constraint to be placed on the weights. We demonstrate that selecting the number of principle components in principal components regression allows the appropriate amount of weight regularization to be selected for a given set of learned models. 4. The PCR* Algorithm The PCR* algorithm may be broken down into four parts: representation, regres- sion, search and evaluation. Section 4.1 discusses the first two parts by describing 6 CHRISTOPHER MERZ AND MICHAEL PAZZANI how the model set may be mapped into a new representation using principal components analysis, and how the resulting components may be used to build a regression model. Section 4.2 discusses the latter two parts of the algorithm: the asterisk in PCR* denotes the search for the number of principal components to retain which is tightly coupled with the evaluation metric for a given model. 4.1. Representation and Regression "PCR*" is named partly for the modeling method at its core, "Principal Components Regression" (see [3] for a summary). This section discusses the central role PCR plays in representation and regression in PCR*. In PCR*, the representation of the final regression estimate, " f (x), is restricted to linear combinations of the learned models in F , i.e., where ff j is the coefficient or weight of " PCR* uses an intermediate representation in order to derive the final regression estimate. The main idea is to map the original learned models to a new set of models using Principal Components Analysis (PCA). The new models are a decomposition of the original models' predictions into N independent components. The more useful initial components are retained to build an estimate of f , and the mapping is reversed to get the weights for the original learned models. The following discussion elaborates on this process. The intermediate representation is derived using Principal Components Analysis (PCA). Define A F as the matrix of learned models' predictions where A F PCA takes as its input the square, symmetric covariance matrix of A F , denoted ;i A F The output of PCA is a new representation called the "principal components," i.e., g. Each principal component is a column vector in the matrix, PC, where Associated with each principal component is an eigenvalue, j , denoting the percentage of variance that component j captures from the original matrix, A F . One advantage of this representation is that the components are independent which means the correlation between PC i and PC j is zero for all i 6= j. Another advantage is that the components are ordered by their eigenvalues, i.e., COMBINING REGRESSION ESTIMATES 7 Given this new representation, the goal is to choose the number of principal components to include in the final regression by retaining the first K which meet a preselected stopping criterion. Choosing K is the search aspect of PCR* and is covered in section 4.2. Once K has been selected, an estimate of f is derived via linear least squares regression using PC 1 through PCK , i.e., where This is known as Principal Components Regression (PCR). Finally, the weights, ff, can be derived for the original learned models by expanding (5) according to where fl K;j is the j-th coefficient of the K-th principal component. The ff-coefficients can be calculated as follows, Equations 2 through 7 make up the core of the PCR* algorithm and are summarized in Table 1. The third step, i.e., choosing K, constitutes the search aspect of PCR*. The next section elaborates on this process. Table 1. The PCR* algorithm. Input: A F is the matrix of predictions of the models in F . 1. 2. 3. 4. " y. 5. ff 6. Return ff. 4.2. Search Procedure and Evaluation The main search component of PCR* is step 3 which involves choosing K (see Table 1). The basic idea is to include successive principal components in the regression estimate of f(x) (see eqn.( 5)) until all N components are used. 3 The reason for searching for K in this manner is that the principal components are ordered by the amount of variance they capture in the original learned models. The first principal component explains the most variance in the data which is where the models agree the most. The subsequent (orthogonal) components capture more and more of the variations in the models' predictions. Therefore, the number of components retained directly affects how much attention is paid to the variations in the predictions of the learned models. The value of k (where 1 k N) with the lowest estimated error is chosen. This step is very important because choosing too few or too many principal components may result in underfitting or overfitting, respectively. The evaluation criterion for selecting K is the measure of error for each possible value, k. Table 2 shows how v-fold cross-validation is used to estimate the error for each k. For a given k, as partition v is held out it is evaluated on the regression equation derived from a modified set of principal components, PC (\Gammav) , where PC (\Gammav) i is the same as PC i with the examples from partition v removed. The k with the smallest cross-validation error is chosen as K. Other approaches to choosing K have been explored in [20]. Table 2. The Choose Cutoff() algorithm. Input: A F is the matrix of predictions of the models in F . \Gamma, the eigenvectors derived by PCR*. y, the target output. Output: K, the number of components retained. 1. Form V random partitions of A F 2. For partition v ffl Create new principal components: For d f (\Gammav) is " f with the examples/rows of partition v removed. ffl For y. 3. Return arg min COMBINING REGRESSION ESTIMATES 9 5. Understanding PCR* Analytically This section provides an analysis which illuminates how PCR* addresses some of the open problems discussed in Section 1. Artificial data sets will be used to show that PCR* provides a continuum of regularized weights for the original learned models. Section 5.1 shows how PCR* produces a highly regularized set of weights to avoid the multicollinearity problem. Section 5.2 demonstrates how PCR* handles the problem of detecting areas of specialization of each learned model by producing a less regularized set of combining weights. Section 6 will then evaluate PCR* on real problems. 5.1. The Multicollinearity Problem The multicollinearity problem, as described in Section 3 leads to an increase in the variance of the estimated weights, ff. The resulting prediction error can be quite high because the weights are very sensitive to minor changes in the data. To avoid this the weights must be regularized. Weight regularization in PCR* is controlled via the number of principal components retained. Let PCR k denote the instantiation of PCR* where the first principal components are retained. Now consider deriving the ff-weights using . The first principal component is defined as the linear combination of the members of F with the highest average correlation with the members of F . In this case, the weights, fl 1; , will tend to be quite similar because the learned models are all fairly accurate, i.e., E[ " Equation (7) shows that the fl-weights are in turn multiplied by a constant, fi 1 , as derived in equation (6). Thus, the resulting 's will be nearly uniform. The later principal components serve as refinements to those already included producing less constrained weight sets until finally the N-th principal component is included resulting in an unconstrained estimator theoretically equivalent to standard linear regression, LR. Now an experiment will be conducted using an artificial data set to demonstrate that the weight sets derived by PCR* become less regularized as the number of principal components retained grows from 1 to N , where f be a Gaussian function with mean zero and standard deviation one, i.e., f N(0; 1). Model " derived as follows: where c i N(0; 0:1). This will produce ten unique models and a total of twenty models for F . The first ten models are duplicated in the second set of ten, creating multicollinearity. Each model will produce a slight variation of f because c has a standard deviation of 0.1. One would expect a high degree of regularization to be in order for this data because of the extreme multicollinearity and the fact that the models, " are uniformly distributed about f . The artificial data set, A1, derived using these equations consists of 200 training examples and 100 test examples. Figure 1 displays the collection of possible weight sets derived by PCR* on A1. The y-axis is the range of coefficient values, and the x-axis is the number of principal components used to derive the ff-weights. Each line traces a single model's weight, ff i , as it is derived using the first k principal components. The weights start out as small positive values. For PCR 1 , ff i 1=20. As more principal components are included the weights become less regularized, e.g., when some of the weights become negative. This continues as k approaches N at which point the weights take on a very broad range of values. PCR* chose to stop at The corresponding error curve for this experiment is shown in Figure 2. In this graph, the y-axis is the mean absolute error, and the x-axis is the same as in Figure 1. As k increases and approaches N , the error rate also increases. The lowest error rate occurred at the same value PCR* chose. This experiment was repeated 20 times with PCR* consistently choosing highly regularized weights. Figure 1. The ff-weights for a single run with the artificial data set, A1. Each line corresponds to ff i as it is derived using the first k principal components. -100100300Number of Principal Components Retained Weight Value 5.2. Discovering Niches The purpose of this section is to demonstrate that PCR* chooses less regularized weights in order to capture the unique abilities of each learned model in predicting COMBINING REGRESSION ESTIMATES 11 Figure 2. The error curve for one run with the artificial data set, A1. Each point corresponds to the error rate associated with the ff i -weights derived using the first k principal components. 200.10.30.5Number of Principal Components Retained f . Less regularized weights are needed when the errors committed by the learned models have patterns of error which cannot be canceled out by simple uniform weighting. To demonstrate how PCR* handles this situation, another artificial data set was created where each model performs particularly well for a certain range of target values. The data set, A2, was generated in a similar fashion as A1; f N(0; 1), derived as follows: ae 0:2). This function produces a set of 20 models where model " performs particularly well (i.e., with a minor offset) in the interval [c 0:25]. Otherwise, the model randomly guesses uniformly between 70 to 90 percent of the true value for a particular point, x j , plus a minor offset. A data set, A2, of 200 training examples and 100 test examples was generated using this function. Figure 3 displays the weights as a function of the number of principal components retained. As with data set A1, the weights become less regularized as k increases, but the range of values is narrower, even for Figure 1). The corresponding error curve for the test data is plotted in Figure 4. The error rate starts out high and decreases as k approaches nine, and increases as k exceeds ten. In this case, the lowest point in the error curve. The initial decrease in error stems from PCR* including the unique contributions of each model (captured in the principal components) in the derivation of the ff-weights. The increase in error as k exceeds ten is due to the multicollinearity contained in the model set. This experiment was repeated 20 times with PCR* consistently choosing the appropriate amount of regularization. Note that Figure 4 plots the error as measured on unseen test data while PCR* uses an estimate of error derived from only the training data. Figure 3. The ff-weights for a single run with the artificial data set, A2. Each line corresponds to ff i as it is derived using the first k principal components. -101030Number of Principal Components Retained Weight Value COMBINING REGRESSION ESTIMATES 13 Figure 4. The error curve for a single run with the artificial data set, A2. Each point corresponds to the error rate associated with the ff i -weights derived using the first k principal components. 200.010.030.050.07Number of Principal Components Retained 5.3. Trading off Bias and Variance The prediction error of a learned model can be attributed to two components: that which is due to the "bias" of the model, and that which is due to the "variance" of the model (for an elaborate decomposition of prediction error, see [8]). The bias of an algorithm measures how consistently the models it produces (for various data sets of the same size) differ from the true function, f . The variance measures how much the algorithm's predictions fluctuate for the possible data sets. To decrease the overall generalization error of an algorithm it is necessary to decrease the error due to bias and/or the error due to variance. Now consider the PCR* algorithm when 1. The (nearly) uniform weights produced essentially ignore the patterns of predictions in F . If the patterns in A F are useful in predicting f , then PCR* will be consistently off in its predictions producing a biased result. This corresponds to the points on the error curve in Figure small values of k result in higher error. On the other hand, if and multicollinearity is present in A F , the weight estimates may be very sensitive to minor changes in the data causing the predictions to have high variance. This corresponds to the points in the error curve of Figure 2 where larger values 14 CHRISTOPHER MERZ AND MICHAEL PAZZANI of k produce more error. PCR* attempts to find the minimum in the error curve where the error is not being dominated by either bias or the variance. 5.4. Computational Complexity The computational complexity of PCR* is analyzed independent of the model generation process. Given a set of N models built from M examples, the three largest procedures are: 1. The calculation of the covariance matrix. This is performed once and takes 2. The inversion of a matrix. In general, computing the inverse of a matrix is cubed in the number of columns/rows. All matrix inversions are performed on N \Theta N matrices taking O(N 3 ) time. The inversion procedure is performed a total of N once for determining the fi coefficients for the final model, and once for each partition of L 1 used in determining k. Note that the Choose Cutoff() algorithm in Table 2 may be optimized by computing the fi coefficients once using all N principal components. The fi coefficients derived using any subset of the components will be the same because the principal components are uncorrelated. Therefore, matrix inversion takes O((V time, where V is typically ten. 3. The Singular Value Decomposition of a matrix. The SVD of an N \Theta N matrix takes O(N 3 Therefore, the total time complexity of PCR* is O(N 2 max(M;N )). 6. Empirical Evaluation of PCR* Two experiments were run to compare PCR* with other combining strategies. The first experiment aims to evaluate the combiners on a dozen models; half neural networks and half adaptive regression splines. The purpose of this experiment is twofold: to evaluate some of the combiners using stacking (described below), and to evaluate the combiners abilities to combine models generated using different learning algorithms. The second experiment tests the combiners' ability to handle a large number of correlated models. The combiners were evaluated for model sets of size 10 and 50. The parameter V in the Choose Cutoff() algorithm was set to 10. 6.1. Regression Data Sets Table 3 summarizes the eight data sets used. The "Source" column lists "UCI" for data sets taken from the UCI Machine Learning Repository [21], "CMU" for data sets taken from the Statistics Library at Carnegie Mellon University [22], "QSAR" for data sets taken from the QSAR Home Page [15], and UCI-MC for a proprietary COMBINING REGRESSION ESTIMATES 15 Table 3. Data set descriptions. Data Set Examples Attributes Numeric Source baseball 263 bodyfat 252 14 14 CMU dementia 118 26 26 UCI-MC hansch housing 506 12 12 UCI imports 160 15 15 UCI data set from the UCI Medical Center. The imports data set had 41 examples with missing values which were not used due to limitations in one of the learning algorithms used. 6.2. Constituent Learners The set of learned models, F , were generated using Backpropagation networks (BP) [28] and Multivariate Adaptive Regression Splines (MARS) [7]. In both ex- periments, preliminary BP runs were conducted to find a network topology which gave good performance for each data set so that the combining methods would have to work well to improve upon a single model. 6.3. Other Combining Methods The combining methods evaluated consist of all the methods discussed in Sections 2 and 3, as well as PCR 1 and PCRN (to demonstrate PCR*'s most and least regularized weight sets, respectively). Now a more elaborate description is given of each of the methods briefly mentioned in Section 3. The procedures based on Widrow-Hoff learning [12] are gradient descent (GD), and the exponentiated gradient procedures EG and EG \Gamma . These are iterative approaches where the weights, ff, are revised with multiplicative/exponentiated up- dates. Each revision attempts to move the weights in a direction of lower mean squared error on the training data. In ridge regression, the equation for deriving the weights is similar to that of deriving the fi-coefficients in PCR* using all N of the principal components: The major difference is that the M \Theta M identity matrix, I M , multiplied by a constant, ', is added to the matrix, PC T PC. The effect is that as ' increases, the resulting regression coefficients generated by ordinary linear regression (LR) shrink towards zero proportionally. The ff-coefficients are then derived as they are in PCR*. The end result is a more restricted set of coefficients. An iterative approach is used to searching for ' (as discussed in [23]). A "stacked" constrained regression (SCR) procedure [2] has also been included in the evaluation. The two main components of this approach are stacking and constrained regression. Stacking [32] is simply a method of approximating the matrix of predictions, A F . The idea is that rather than using the actual predictions of the learned models, it is better to use an estimate because the estimate will give more information as to how to correct for the errors in each learned model. The estimated predictions are generated using a 10-fold cross-validation technique. It should be noted that the stacking component can be computationally expensive because for each learned model in the final set, 10 approximations must be generated. The other major component of SCR is constrained regression. The ff-weights are obtained using ordinary least square regression with the restriction that the weights be nonnegative. A simpler version of stacked constrained regression without the stacking component (referred to as CR) is also included to evaluate the utility of constrained regression alone. 6.4. Experiment 1 This experiment aims to evaluate the combining strategies on a smaller number of learned models generated by different learning algorithms. A smaller model set was used here to make the evaluation of SCR more tractable. Twelve models were generated. Six were generated using MARS (version 3.5) [7]. In the first three models, the variables were entered in an unrestricted, restricted, and linear fashion, respectively. The other three models were generated by entering the variables in an unrestricted fashion with each model deleting one of the three most relevant variables as determined by diagnostic output from a preliminary run of MARS. Six BP models were generated using three different network topologies with random weight initialization. Thirty runs were conducted for each data set. On each trial the data was randomly divided into 70% training data and 30% test data. Tables 4 and 5 report the means and standard deviations of absolute error rate. The rows of the tables are divided into two blocks. The former block consists of crude methods for obtaining highly constrained or unconstrained weights. The latter block consists of the more advanced methods capable of producing weight sets with varying degrees of reg- ularization. Bold-faced entries indicate methods which were significantly different from PCR* via two-tailed paired t-tests with p 0:01. 6.5. Discussion of Experiment 1 Observing the combining methods in the first block of rows reveals that more regularization appears necessary for the baseball, cpu, dementia and hansch data sets, and little or no regularization appears necessary for the servo data set. method in the first block does particularly well for the bodyfat or housing data sets indicating that a moderate amount of regularization is required there. Examining the more advanced methods for handling multicollinearity in the second block of rows reveals that PCR*, EG, and CR have the best overall perfor- COMBINING REGRESSION ESTIMATES 17 Table 4. Means and standard deviations of absolute error rate for combining strategies on first four data sets. Method baseball bodyfat cpu dementia GEM 6.5E+3(3.3E+4) 19.1(27.6) 37.0(10.65) 1.318(2.8) Table 5. Means and standard deviations of absolute error rate for combining strategies on last four data sets. Method hansch housing imports servo GEM 6.229(12.8) 6.41(10.2) 11,292(5.3E+3) 0.364(0.05) BEM GD EG CR PCR* Table 6. Average rankings for CR, EG, and PCR* for each data set. Data Set CR EG PCR* baseball 6.93 6.4 7.17 bodyfat 5.73 5.8 3.13 cpu 9.23 8.27 7.767 dementia 11.27 9.97 9.13 hansch 6.13 5.83 8.37 housing 8.48 7.92 7.52 imports 6.867 6.93 7.8 servo 8.267 8.03 5.73 mances. PCR* is statistically indistinguishable from the best method in all but the hansch data set. In this case EG and CR have a 3.5% relative reduction in error over PCR*. EG and CR are statistically indistinguishable from the leading method in all but the bodyfat data set where PCR* has a 9.6% relative reduction in error over EG and CR. GD and EG do better than the methods in the first block, but have the most difficulty finding a good weight set. These methods occasionally converge to poor local minima in spite of setting the initial weights and the learning rate as Kivinen and Warmuth [12] recommend. Another interesting result is that constrained regression (CR) tends to outperform constrained regression with stacking (SCR) with slight losses for only two data sets. This raises the issue of whether stacking is a beneficial component of the SCR algorithm for real data sets. The extra work does not appear to improve results. Average rankings were also calculated for each of the methods. For a given run, each method was assigned a rank according to the number of methods with lower error rates. The ranks were then averaged over the runs for each data set. Table 6 reports the results for the three best combining strategies, i.e., PCR*, CR and EG. PCR* consistently performed well with respect to ranking scores too. The closest competitors were CR and EG, each having a better average ranking than PCR* on three data sets. Figure 5 shows the relative error reduction made by PCR* as compared to the best individual model for each data set. PCR* improves performance by as much as 10.5%. The largest loss is a 4.3% increase in error. Overall, an improvement occurred in five data sets with an average reduction of 2.5%. 6.6. Experiment 2 The second experiment tests the combiners to see how well they perform with a large number of correlated models. The combiners were evaluated for model sets of size 10 and 50. There were 20 trials run for each of the data sets. On each trial the data was randomly divided into 70% training data and 30% test data. In this experiment, the collection of networks built differed only in their initial weights, and not their topology. There was no extreme effort to produce networks with more decorrelated errors. Even with such networks, the issue of extreme COMBINING REGRESSION ESTIMATES 19 Figure 5. Relative change in error for PCR* with respect to the best individual model for each data set. -0.06 -0.020.020.060.1Data Set Change in housing baseball cpu servo hansch imports dementia multicollinearity would still exist because E[ " As more models are included the linear dependence amongst them goes up showing how well the multicollinearity problem is handled. Linear dependence is verified by observing the eigenvalues of the principal components and values in the covariance matrix of the models in F . Table 7 reports the results for the three most representative data sets (in terms of distinguishing the combiners), i.e., bodyfat, cpu, and housing. The means and standard deviations for absolute error are given for each of the methods on the data sets. Two new methods were included in Table 7, PCR 1 and PCRN , representing PCR* stopping at the first and last component, respectively. They will serve to show PCR*'s performance relative to using highly constrained and unconstrained weight sets. Each row is a particular method and each column is the size of F for a given data set. Bold-faced entries indicate methods which were significantly different from PCR* via a two-tailed paired t-test with p 0:01. Table 7. Results with many learned models Data bodyfat cpu housing GEM EG 6.7. Discussion of Experiment 2 In experiment 1, PCR* performed most similarly to EG and CR. The results in Table 7 further distinguish PCR* from EG and CR. In the bodyfat data set, EG and CR converge on weight sets which are near uniform resulting in poor performance relative to PCR*. PCR* is the only approach which is among the leaders for all three data sets. For the bodyfat and housing data sets the weights produced by BEM, PCR 1 , GD, \Gamma tended to be too constrained, while the weights for LR tended to be too unconstrained for the larger collection of models. The less constrained weights of GEM, LR, RIDGE, and PCRN severely harmed performance in the cpu domain where uniform weighting performed better. The biggest demonstration of PCR*'s robustness is its ability to gravitate towards the more constrained weights produced by the earlier principal components when appropriate (i.e., in the cpu data set). Similarly, it uses the less constrained principal components closer to PCRn when it is preferable as in the bodyfat and housing domains. 7. Related Work Several other combining strategies exist in addition to the combining strategies described in Sections 2, 3, and 6.3. The next three sections discuss: two more general approaches, some data resampling techniques, and some methods for assigning weights as a function of the example being predicted. 7.1. Other General Approaches Hashem and Schmeiser [9] have developed a combining scheme similar to GEM as well as a less constrained version which does not require the weights to sum to one. Like GEM, this method is susceptible to the multicollinearity problem. COMBINING REGRESSION ESTIMATES 21 Opitz and Shavlik [24] attempt to assign each model a weight according to an estimate of its accuracy, i.e., is the estimate of model i's accuracy based on performance on a validation set. Intuitively, model i gets more weight as its estimated performance increases relative to the estimated cumulative performance of the other models. The weights derived using this approach are less susceptible to the multicollinearity problem, but less robust because the intercorrelations of the models is not considered. A technique for pruning weights in a neural network is given in [18]. This method is also applicable to the fi coefficients produced in PCR*. A threshold, T , is set for pruning principal components as a function of training error. Any principal component with a small fi weight and a small eigenvalue is pruned, i.e., fi 2 PCR* is similar in that it retains principal components as a function of training error, however, the pruning technique above focuses more on discarding components which have a negligible impact on the final equation. The criterion in PCR* prunes the later principal components which have small eigenvalues but have an unnecessarily large fi weight. 7.2. Resampling Strategies Resampling strategies are another approach to generating and combining learned models. In these approaches, the model generation phase is more tightly coupled with the model combination stage. The goal is to generate a set of models which are likely to make uncorrelated errors (or to have higher variance) thus increasing the potential payoffs in the combining stage. Each model is generated using the same algorithm, but different training data. The data for a particular model is obtained by sampling from the original training examples according to a probability distribution. The probability distribution is defined by the particular approach, Bagging or Boosting. Bagging [1] is a method for exploiting the variance of a learning algorithm by applying it to various version of the data set, and averaging them (uniformly) for an overall reduction in variance, or prediction error. Variations on the training data are obtained by sampling from the original training data with replacement. The probability of an example being drawn is uniform, and the number of examples drawn is the same as the size of the original training set. The underlying theory of this approach indicates that the models should be weighted uniformly. Unlike PCR*, bagging is limited to a single learning algorithm. Another resampling method has its roots in what is known as Boosting, initially developed by Schapire [29]. Boosting is based on the idea that a set of moderately inaccurate rules-of-thumb (i.e., learned models) can be generated and combined to form a very accurate prediction rule. The initial development of this research was purely theoretical, but subsequent refinements [5, 4] have produced practical 22 CHRISTOPHER MERZ AND MICHAEL PAZZANI implementations of the boosting approach. This technique assigns a weight to each example in the training data and adjusts it after learning each model. Initially, the examples are weighted uniformly. For learning subsequent models, examples are reweighted as follows: "easy" examples which are predicted with low error by previously learned hypotheses (i.e., learned models) get lower weight, and "hard" examples that are frequently predicted with high error are given higher weight. The data sets for each learned model are resampled with replacement according to the weight distribution of the examples. 4 A common combining strategy for boosting is described in Freund and Schapire's algorithm. The i-th model's weight is a function of its error, ffl i , i.e., In this scheme, learned models with less error (on the distribution of examples they see) tend to get higher weights. In boosting (and bagging), more emphasis has been placed on model generation than model combination. It's possible that a more elaborate combining scheme like that of PCR* may be a more effective method of combining the models generated. Two recent experimental evaluations of Boosting and Bagging are given in [5, 27]. Both approaches have proven to be quite effective, but are currently limited to a single learning algorithm. Kong and Dieterrich [13] point out that combining heterogeneous learning algorithms can reduce bias as well as variance if the bias errors of the various algorithms are different. Krogh and Vedelsby [14] have developed a method known as query by committee [30, 6, 6]. In this approach, as a collection of neural networks is trained simultane- ously, patterns which have large ambiguity (i.e., the ensemble's predictions tend to vary considerably) are more likely to be included in the next round of training. 7.3. Non-constant Weighting Functions Some combining approaches weigh each learned model as a function of the example being predicted. The most prevalent method in the literature for dynamically deciding how to weight a collection of regressors (or classifiers) is the "mixture of experts" approach [10] which consists of several different "expert" learned models (i.e., multilayer perceptrons) plus a gating network that decides which of the experts should be used for each case. Each expert reports a target attribute probability distribution for a given example. The gating network selects one or a few experts which appear to have the most appropriate target distribution for the example. During training, the weight changes are localized to the chosen experts (and the gating network). Experts which are more accurate for the example 5 are given more responsibility for that example and experts which are inaccurate for the example are given less responsibility. The weights of other experts which specialize in quite different cases are unmodified. The experts become localized because their weights COMBINING REGRESSION ESTIMATES 23 are decoupled from the weights of other experts, and they will end up specializing on a small portion of the input space. Jordan and Jacobs [11] expanded on this approach allowing the learned mod- els/experts to be generalized linear models. The experts are leaves in a tree-structured architecture whose internal nodes are gating functions. These gating functions make soft splits allowing data to lie simultaneously in multiple regions. Currently, the weights generated by PCR* do not change as a function of the example being predicted. A comparison between the two approaches is needed. Tresp and Taniguchi [31] derived a collection of non-constant weighting functions which can be used to combine regressors or classifiers. The proposed methods weigh a learned model according to its reliability in the region of the given example. Reliability is defined in terms of either the model's accuracy in the region of the given example, or the amount of variability of the model's predictions in that region. All of the approaches require that the weights be positive and sum to one. The methods proposed have not been evaluated empirically, but may prove useful in extending methods like PCR* to allow the weights of the learned models to change as a function of the example being classified. 8. Limitations and Future Work PCR* is limited to just combining regression estimates with linear weights. One direction currently being explored is the extension of PCR* to the classification task. This can be accomplished by having one PCR*-like model for each possible class. Preliminary results indicate this is an effective method of combining classifiers. Another direction of future work is to expand PCR*'s abilities allowing for non-constant weighting. It is not likely that each model performs consistently through-out the space of possible examples. Allowing a learned model's weight to change with respect to an example would further extend PCR*'s ability to find the strengths and weaknesses of each model. 9. Summary and Conclusion This investigation suggests that the principal components of a set of learned models can be useful when combining the models to form an improved estimator. It was demonstrated that the principal components provide a continuum of weight sets ranging from highly regularized to unconstrained. An algorithm, PCR*, was developed which attempts to automatically select the subset of these components which provides the lowest prediction error. Experiments on a collection of domains demonstrated PCR*'s ability to identify the unique contributions of each learned model while robustly handling the inherent redundancy amongst the models. Notes 1. Optimal here refers to weights which minimize mean square error for the training data. 2. Note that the constraint, for GEM is a form of regularization [17]. The purpose of regularizing the weights is to provide an estimate which is less biased by the training sample. Thus, one would not expect GEM and LR to produce identical weights. 3. Least squares regression using all N principal components (denoted PCRN ) is equivalent to standard linear regression on the original members of F . 4. Note that this resampling technique can be replaced by a reweighting technique when the learning algorithm is capable of directly accepting a weighted set of examples. 5. Here, "accurate" means to have less error than the weighted average of the errors of all the experts(using the outputs of the gating network to decide how to weight each expert's error). A less accurate prediction for an example will have more error than the weighted average. --R Heuristics of instability in model selection. Stacked regressions. Applied Regression Analysis. A decision-theoretic generalization of on-line learning and an application to boosting Experiments with a new boosting algorithm. Multivariate adaptive regression splines. Neural networks and the bias/variance dilemma. Improving model accuracy using optimal linear combinations of trained neural networks. Adaptive mixtures of local experts. Hierarchical mixtures of experts and the EM algorithm. Exponentiated gradient descent versus gradient descent for linear predictors. Neural network ensembles The QSAR and modelling society home page Solving Least Squares Problems. Combining estimates in regression and classification. Fast pruning using principal components. Bias, variance and the combination of least squares estimators. Classification and Regression by Combining Models. UCI repository of machine learning databases The CMU statlib home page Generating accurate and diverse members of a neural-network ensemble When networks disagree: Ensemble methods for hybrid neural networks. Numerical Recipes in C: The Art of Scientific Computing Learning internal representations by error propagation. The strength of weak learnability. Query by committee. Combining estimators using non-constant weighting functions Stacked generalization. --TR --CTR Michael J. Pazzani , Daniel Billsus, Adaptive Web Site Agents, Autonomous Agents and Multi-Agent Systems, v.5 n.2, p.205-218, June 2002 S. B. Kotsiantis, Local averaging of heterogeneous regression models, International Journal of Hybrid Intelligent Systems, v.3 n.2, p.99-107, January 2006 Slobodan Vucetic , Zoran Obradovic, Collaborative Filtering Using a Regression-Based Approach, Knowledge and Information Systems, v.7 n.1, p.1-22, January 2005 Nageswara S.V. Rao, On Fusers that Perform Better than Best Sensor, IEEE Transactions on Pattern Analysis and Machine Intelligence, v.23 n.8, p.904-909, August 2001 Hillol Kargupta , Byung-Hoon Park, A Fourier Spectrum-Based Approach to Represent Decision Trees for Mining Data Streams in Mobile Environments, IEEE Transactions on Knowledge and Data Engineering, v.16 n.2, p.216-229, February 2004 Niall Rooney , David Patterson , Chris Nugent, Pruning extensions to stacking, Intelligent Data Analysis, v.10 n.1, p.47-66, January 2006 Niall Rooney , David Patterson , Chris Nugent, Non-strict heterogeneous Stacking, Pattern Recognition Letters, v.28 n.9, p.1050-1061, July, 2007
combining estimates;regression;principal components;multiple models
599620
Maximizing Theory Accuracy Through Selective Reinterpretation.
Existing methods for exploiting flawed domain theories depend on the use of a sufficiently large set of training examples for diagnosing and repairing flaws in the theory. In this paper, we offer a method of theory reinterpretation that makes only marginal use of training examples. The idea is as follows: Often a small number of flaws in a theory can completely destroy the theory's classification accuracy. Yet it is clear that valuable information is available even from such flawed theories. For example, an instance with severalindependent proofs in a slightly flawed theory is certainly more likely to be correctly classified as positive than an instance with only a single proof.This idea can be generalized to a numerical notion of degree of provedness which measures the robustness of proofs or refutations for a given instance. This degree of provedness can be easily computed using a soft interpretation of the theory. Given a ranking of instances based on the values so obtained, all that is required to classify instances is to determine some cutoff threshold above which instances are classified as positive. Such a threshold can be determined on the basis of a small set of training examples.For theories with a few localized flaws, we improve the method by rehardening: interpreting only parts of the theory softly, while interpreting the rest of the theory in the usual manner. Isolating those parts of the theory that should be interpreted softly can be done on the basis of a small number of training examples.Softening, with or without rehardening, can be used by itself as a quick way of handling theories with suspected flaws where few training examples are available. Additionally softening and rehardening can be used in conjunction with other methods as a meta-algorithm for determining which theory revision methods are appropriate for a given theory.
Introduction A central concern of machine learning research is how to use prior knowledge effectively to provide a useful learning bias. An important type of prior knowledge that may thus be used is a flawed domain theory, obtained from some domain expert by knowledge engineering. One of the main methods for using such a theory has been to attempt to revise it in order to improve its classification accuracy 1994a; Ourston & Mooney, 1994). Although this idea has great intuitive appeal, revision is not always the best way to use a given theory. Another class of methods does not attempt to repair the given theory, but to reinterpret it in a more profitable manner. This can be done by using the theory as a resource for constructive induction (Pazzani & Kibler, 1992; Donoho & Rendell, 1995; Ortega Fisher, 1995; Koppel & Engelson, 1996), or by numerical refinement of probabilistic theories (Mahoney & Mooney, 1994; Mahoney, 1996; Buntine, 1991; Lam & Bacchus, 1994; Russell, Binder, Koller, & Kanazawa, 1995; Ramachandran & Mooney, 1998), or, most relevant to this paper, by interpreting a logical theory in a probabilistic manner (Towell & Shavlik, 1993; Koppel, Feldman, All of these methods depend on the use of a sufficiently large set of training examples for diagnosing and repairing flaws in the theory. In this paper, we offer a "universal" method of theory reinterpretation that makes only marginal use of training examples. In the simplest version of the method, examples are required only in order to approximate the number of positive and negative instances. In a more sophisticated version of our method, which selectively reinterprets the theory on the basis of training examples, empirical evidence indicates that a very small training set is sufficient. The idea is to squeeze out as much reliable information as possible from an unreliable theory prior to invoking the information contained in training examples. The central observation is as follows: Often a small number of flaws in a theory can completely destroy the theory's classification accuracy. For example, one easily satisfied extra clause near the root of a theory can render all instances positive, ostensibly destroying the theory. Yet it is clear that valuable information is available even from such flawed theories. For example, an instance with several independent proofs in the theory is certainly more likely to be correctly classified as positive than an instance with only a single proof. This idea can be generalized to an easily computed numerical notion of "degree of provedness" which measures the robustness of proofs or refutations for a given instance. That is, instead of interpreting a theory in the usual Boolean manner, we interpret it "softly", assigning each instance a "degree of provedness" value between 0 and 1. Given a ranking of instances based on the values so obtained, all that is required to classify is to determine some cutoff threshold above which instances are classified as positive. Such a threshold can be determined on the basis of a small set of training examples. (In fact, it might even be enough for this purpose to know the approximate number of positive examples in some set of examples without actually knowing the correct classification of any single example.) We will see that interpreting a theory softly is a remarkably effective method for classifying examples despite the presence of flaws. Moreover, the method is benign in that in the case of an unflawed theory it does no harm. For theories with a few localized flaws, we improve the method by "rehardening": interpreting only parts of the theory softly, while interpreting the rest of the theory in the usual manner. Isolating those parts of the theory that should be interpreted softly can be done on the basis of a small number of training examples. Softening, with or without rehardening, can be used by itself as a quick way of handling theories with suspected flaws where few training examples are available. Additionally softening and rehardening may be used in conjunction with other methods as a meta-algorithm for determining which theory revision methods are appropriate for a given theory. In particular, this method can be used to determine whether the theory has localized flaws which should be revised, distributed flaws requiring reinterpretation, or whether the theory contains no useful information and should not be used at all as a learning bias. When revision is deemed appropriate, rehardening can offer suggestions as to which components of the theory ought to be the focus of repair. The outline of this paper is as follows: In section 2, we explain and justify the soft interpretation of theories and in section 3 we show how to use softening to classify instances. In section 4 we explain and justify the technique of rehardening. In section 5, we illustrate how the methods work on several well-known theories and in section 6 we give the results of tests of these methods on a large testbed of synthetically generated flawed theories. In the appendix, we offer proofs of some analytic claims concerning the connection between our measure of degree of provedness and the actual robustness of proofs and refutations. Softening Logical Theories 2.1 Logical provedness We consider here the case of propositional theories expressed in definite-clause form, with negation- as-failure. Each clause's head is a positive literal, and its body is a conjunction of positive and negative literals. We assume the concept to be learned is represented by a unique 'root' proposition, which does not appear in the body of any clause. In this section we review the theory probabilization method described in (Koppel et al., 1994b), which serves as the basis for the current work. We first review the standard method for computing a function which is 1 if an example E is proved in the propositional theory \Gamma and 0 otherwise. In the next section we will extend the function to take on values between 0 and 1, measuring a relative notion of example 'provedness'. For each observable proposition P , define if P is false in E if P is true in E For each clause C with antecedents l Y Similarly, for each non-observable proposition P which is the head of clauses C Y And finally, for each negated proposition :P , let These formulae are simply arithmetic forms of the boolean functions AND, OR, and NOT, respectively This formulation can be simplified by reformulating the theory in terms of NAND relations. Define the children of a proposition to be the clauses for which it is a head, the children of a clause to be its antecedent literals, and the children of a negated proposition to be the unnegated proposition. For each primitive proposition k, we define u(E; k; \Gamma). For a component (proposition, clause, or negative literal) k with children c Y Since ANDs and ORs strictly alternate, we have for every proposition P that u(E; for every example E. In particular, if r is the root proposition of \Gamma, u(E; E is proved in \Gamma exactly when u(E; 2.2 Soft provedness As defined, u(E; only assume the values 0 or 1, \Gamma either proves or refutes r given E. However, since \Gamma is assumed to be flawed, we would like to evaluate more precisely to what degree an example is proved in the theory. Consider, for example, the theory: r / a r / b; c r / d; e and three examples proved in the theory: Although intuitive 'degree of provedness' varies. can be considered 'proved to a greater degree' than since it has three proofs to E 2 's one. Furthermore, although both E 2 and E 3 have one proof each, E 2 also has two 'near proofs' and so can be thought of as 'proved to a greater degree' than E 3 . That is, if we had reason to believe that the theory might be slightly flawed and that the classification as positive of some of these examples might therefore be mistaken, suspicion ought to fall most readily on E 3 , since reclassifying E 3 would require doing the least violence to the theory. What we want, therefore, is a relative measure of 'degree of proof'. We extend here the definition of u in such a way that it can assume values between 0 and 1 that correspond to our intuitive notion of 'degree of proof'. This has the effect of softening \Gamma's classifications. Let ffl be some small value greater than 0. Now, similar to the development above, for each observable proposition P define the softening function u ffl by: if P is false in E if P is true in E For each component k of \Gamma with children c Y The term (1\Gammaffl) can be thought of as introducing uncertainty into the theory by placing a probability measure on subtheories of \Gamma, such that each component has independent probability of ffl to be deleted. (Thus the asymmetry in u ffl (E; deleting a false proposition may cause its clause to become true, but not vice versa.) The computation of u ffl (E; approximates the expected classification of E over this measure (see the appendix). (Note that these component 'weights' represent a meta-theory concept, giving a probability measure over possible theories, and not, as in Pearl's Bayesian networks (Pearl, 1988), conditional probabilities of results given premises.) In this way, u ffl (E; provides a useful measure of the resilience of E's classification to changes in the theory. In particular, as discussed in Section 4.4 below, for sufficiently small ffl, u ffl (E; reflects the minimal number of components in \Gamma which would need to be revised in order to change E's classification (E's revision distance, defined more precisely below). In the example above, E 1 has the highest revision distance at 3, whereas E 2 and E 3 both have revision distance 1, reflecting our intuitive notion that E 1 is more strongly classified as positive by the theory than the other two examples. A more fine-grained measure is given by u ffl , however. Indeed, u 0:1 than it is given E 2 and it is more 'more proved' given E 2 than it is given E 3 , more completely reflecting our intuitions about the relative degree-of-proof of the three examples. (In Value Example rank Positive Negative Figure 1: Softened truth values (u 0:1 ) for the 106 examples of the promoter theory in rank order. The optimal classification threshold for these examples is depicted by the vertical line. the experiments reported in this paper, we set tuning. Although our results to date show little sensitivity to this choice, properly tuning ffl is a matter for further investigation.) classification Given a flawed theory \Gamma (for concept r), we can now consider how to use the softening function u ffl to classify examples. The idea is that examples which are proved to a greater degree according to are more likely to be truly positive, and vice versa, regardless of whether or not the example actually is proved in \Gamma. Thus, we can rank a set of unclassified examples E i according to u ffl Then by choosing a good threshold ', we classify an example E as positive if u ffl (E; negative if u ffl (E; For example, consider the well-known domain theory for identifying E. coli promoter gene sequences (the 'promoter theory' (Merz, Murphy, & Aha, 1996)). The theory consists of 10 rules and a single top-level proposition indicating whether a particular gene sequence is a promoter or not. The theory as given has a classification accuracy of only 50%; every example is classified as negative, when in fact only half of them should be. However, when we sort by u ffl , we can distinguish nearly perfectly between positive and negative examples (as shown in Figure 1). In fact, by choosing the optimal threshold for u ffl , where examples scoring above the threshold are taken as proved and those scoring below as unproved, we get a classification accuracy of 93.4%. This example illustrates how by softening a theory we may dramatically improve its classification accuracy (50% to 93.4%) without doing any revision whatsoever. (This merely confirms earlier results, such as (Ortega, 1995) that indicate that simple "numerical" generalization strategies are very effective for this particular theory. It is surprising, though, that so simple a scheme achieves as good or better results on this theory than many theory revision techniques (Towell & Shavlik, 1993; Koppel et al., 1994a; Ourston Mooney, 1994).) Naturally, the classification threshold must be chosen properly. In practice, the right threshold can be estimated from a very small set of preclassified training examples, as we will see below. More precisely, given a theory \Gamma with root r, a training set E , a softening function u ffl , and a threshold as the fraction of examples in E accurately classified by using ' as a classification threshold for u ffl . Then, we can classify a new example E using the algorithm SoftClassify. Accuracy Training Softening PTR EITHER KBANN Figure 2: Softening for the promoter theory. Accuracy of the original theory and learning curves for C4.5, softening, PTR, EITHER, and KBANN. 1. Let ' be the threshold maximizing Acc(\Gamma,E ,u ffl ,'); 2. If u ffl (E; classify it as positive; 3. Else, classify it as negative. The promoter theory requires very little training to reach respectable classification accuracy when using SoftClassify. For example, when choosing the optimal threshold based on only 20 training examples we get an average classification accuracy of 91% (using 5-fold cross-validation, withholding all but 20 training examples each time). Figure shows corresponding learning curves for softening and several other learning tech- niques. We performed 5-fold cross-validation, withholding different amounts of training to generate each data point. We compare softening with the accuracy of the original theory, with the example-based learning system C4.5 (Quinlan, 1993), and with the theory revision systems 1 PTR (Koppel et al., 1994a), EITHER (Ourston & Mooney, 1994), KBANN (Towell & Shavlik, 1993), and RAPTURE (Mahoney & Mooney, 1994). As the figure shows, softening on the promoter theory is better than most of the alternatives 2 . The only alternatives that are competitive with softening are KBANN and RAPTURE, both theory revision systems that use numerical representations of the theory in the course of revision. (In fact, the results of RAPTURE are virtually identical to those of SoftClassify.) It is interesting to note that softening still performs as well as those systems here, despite the fact that the only learning it does is to estimate a single threshold. Theory revision results are those presented in (Koppel et al., 1994a). Unfortunately, we do not have the original data from the revision system experiments, and so could not compute the statistical significance of these results. illegal :- same-loc-ab-cd, adj-bf illegal :- same-loc-ab-ef illegal :- same-loc-cd-ef illegal :- king-attack-king illegal :- rook-attack-king king-attack-king :- adj-ae, adj-bf king-attack-king :- adj-ae, b=f king-attack-king :- a=e, adj-bf king-attack-king :- knight-move-ab-ef rook-attack-king :- c=e, king-not-b-file rook-attack-king :- d=f, king-not-b-rank king-not-b-rank :- :b=d king-not-b-rank :- b=d, :between-cae king-not-b-file :- :a=c king-not-b-file :- a=c, :between-dbf Figure 3: A flawed version of the chess endgame theory. Added antecedents and clauses are shown in boldface, while deleted components (not actually in the flawed theory) are shown in italics. Low-level propositions such as a=b are defined in terms of primitive attributes a through f, each of which takes on values from 1 to 8 (not shown). 4 Partial Rehardening 4.1 The problem with softening Although softening works remarkably well on a theory like promoter, where errors are distributed throughout the theory (Koppel et al., 1994b; Ortega, 1995), we should not expect it to work as well on a theory where flaws are highly localized. This is because softening treats all components of the theory in the same way. Since both flawed and correct components are softened equally, SoftClassify cannot always distinguish correctly classified examples from incorrectly classified examples. Softening those parts of the theory that are correct cannot be expected to improve classification accuracy. Consider, for example, the flawed domain theory for categorizing king-rook-king chess endgames (Merz et al., 1996) depicted in Figure 3, with root illegal. For this theory, softening neither improves nor harms classification accuracy, as shown in Figure 4. Using any number of training examples between 10 and 100, SoftClassify gives an accuracy of 77% on a separate set of 200 test examples (34% positive, 66% negative), which is the same as the theory's raw accuracy. Soft classification doesn't help for the chess endgame theory because most of the theory should not be softened at all. To illustrate this point, consider two examples for the theory: E 1 for which adj-bf is true, which same-loc-ab-cd is true, where the examples are otherwise identical and have no proofs in the theory as given. Since adj-bf is incorrectly added to the first illegal clause, E 2 is truly positive. Despite this, u ffl \Gamma) in the flawed theory will be greater than u ffl to the greater number of occurrences of adj-bf in the theory. Surprisingly, though, we will find that the fact that softening on this theory does not reduce classification accuracy is no fluke. On the whole, even for locally flawed theories softening almost never does harm and often improves classification accuracy significantly. Nevertheless, we shall see below that for theories with localized flaws we can generally obtain improved classification accuracy Value Example rank Positive Negative Figure 4: Sorting graph (as per Figure 1) for 100 randomly chosen examples for the softened chess endgame theory; the vertical dashed line shows the optimal classification threshold. by softening in a more selective fashion. 4.2 Partially rehardened theories As the above example illustrates, a given theory may contain regions which should be interpreted in a soft manner (i.e, like promoter) and regions which should be interpreted in a non-soft manner (i.e, are correct as is). For theories with localized flaws, such as the chess endgame theory, classification by the SoftClassify algorithm would greatly improve if we could somehow soften only the flawed portions of the theory. In this section we will describe a simple algorithm which finds those components in a theory which should not be interpreted in a soft manner. First, though, we will define more precisely what it means to interpret a theory as partially soft, i.e, with some components defined as hard. Note that here we consider each appearance of a proposition in an antecedent literal as a separate component of the theory, so that one appearance of a proposition can be hard, while another is soft. Formally, given a set H of theory components defined as hard, for each component k with children whereas, for each appearance l of a primitive proposition P , we have Intuitively, ffl introduces uncertainty only into the soft components of the theory; all others are assumed to be correct. (For example, evaluating an example in a theory with all components hardened simply gives 1 or 0, according as the example is positive or negative in the theory.) 4.3 The algorithm We now wish to exploit a given set of training examples in order to determine which components in should be hardened and which softened. The idea is to harden those components whose hardening improves classification accuracy using SoftClassify. We can then use SoftClassify to classify new examples using the partially rehardened theory thus obtained. The idea is to iteratively harden components of the theory, each time evaluating the optimal accuracy of the theory on the training set. Thus, given a theory \Gamma, a training set E , and softening function u ffl , we define the soft accuracy of \Gamma as: '). The Reharden algorithm greedily hardens components of \Gamma until doing so would reduce the accuracy of the theory on the training set E , i.e. ffl ). Note that evaluating a theory with n components for a given set of hardened components takes O(njE time. Since such an evaluation is performed n times for each component that is hardened, in the worst case, a straightforward implementation of Reharden takes O(n 3 jE time. The method is usually much faster than this in practice, and efficiency can be further improved by caching of intermediate results. 1. H / ;; 2. Evaluate a 3. Evaluate, for every component c i 2 \GammanH , its hardening accuracy a 4. Let c be the component closest to the root whose accuracy a ? a 0 (breaking ties arbitrarily); 5. If such a component exists: (a) H (b) Goto Step 2; 6. Else, let c be the component closest to the root whose hardening accuracy a (breaking ties arbitrarily); 7. If such a component exists: (a) H (b) Goto Step 2; 8. Else return H. 4.4 Justification: Rehardening and revision distance The reason the rehardening procedure works is that (i) hardening flawed components tends to reduce the accuracy of SoftClassify, and (ii) hardening unflawed components of the theory tends to increase the accuracy of SoftClassify. Since hardening flawed components usually reduces accuracy, our greedy rehardening algorithm will, in general, harden only unflawed components, which in turn will tend to increase SoftClassify's accuracy using the theory. The connection between the choice of components to be hardened and the resulting accuracy of SoftClassify is a consequence of a fundamental property of the u H ffl function which forms the basis for SoftClassify. The property is that u H ffl sorts examples primarily by how many revisions (that is, deletions) to non-hardened components in the theory would suffice to change the examples' classifications (an example's revision distance). Classifying using revision distance is obviously correlated with hardening unflawed components, in that hardening unflawed components causes the revision distance of correctly classified examples to increase as the number of possible revision sites decreases. For incorrectly classified examples, however, it is always sufficient to revise only flawed components. Thus, if flawed components remain unhardened, the revision distance of an incorrectly classified example cannot increase beyond the minimum number of flawed components which need to be revised in order to change the example's class. We make this intuitive notion more precise by considering the subtheories of the given theory \Gamma, obtained by deleting some of \Gamma's non-hard components (i.e, components not in H), where the distance of a subtheory \Gamma 0 from \Gamma, dist(\Gamma; \Gamma 0 ), is the number of components deleted. In order to quantify how robust an example E's classification is, with respect to possible flaws in \Gamma, we measure the distance of the nearest subtheory \Gamma 0 which classifies E differently from \Gamma. We define the revision distance, D H (\Gamma; E), of E in \Gamma with respect to the set of hardened components H as the number of deletions required to fix an example. In particular: ffl A positive revision distance gives the number of component deletions needed to make an unproved example proved, ffl A negative revision distance gives the number needed to make a proved example unproved. (In a theory without negation, the former deletions are of antecedents, while the latter are of clauses.) The key idea here is that there exists a close relationship between u H ffl and revision distance. For the case of tree-structured theories, where each non-primitive proposition appears (possibly negated) as an antecedent of no more than one clause, the relationship can be neatly formulated as follows: Theorem 1 Given a tree-structured theory \Gamma with root r, a set H of components of \Gamma, and examples \Gamma, such that D H (\Gamma; sufficiently small ffl, we have that This theorem states that, in the limit, larger values of D H lead to smaller values of u H ffl . That is, sorting according to u H ffl is consistent with sorting according to how much the theory would have to change in order to change each example's classification. Sorting by u H ffl , however, provides a more fine-grained measure which gives useful information even when revision distances are identical. For example, if all components of a theory are soft, revision distance is nearly useless, since any example's classification can be changed by revising a few components at the root. Revision distance becomes meaningful, however, as more and more components in a theory are hardened. The more components are hardened, the more precise a measure it becomes for distinguishing the degree to which examples are proved. See the appendix for a more formal treatment of these ideas and a proof of the theorem. 5 Illustrations of Softening and Rehardening In the section following we will show the results of a systematic set of experiments designed to test our hypotheses about the effectiveness of softening and rehardening flawed theories. Before getting to that, though, let us consider a few illustrations of the method on some familiar theories. illegal :- same-loc-ab-cd, adj-bf illegal :- same-loc-ab-ef illegal :- same-loc-cd-ef illegal :- king-attack-king illegal :- rook-attack-king king-attack-king :- adj-ae, adj-bf king-attack-king :- adj-ae, b=f king-attack-king :- a=e king-attack-king :- knight-move-ab-ef rook-attack-king :- d=f, king-not-b-rank king-not-b-rank :- :b=d king-not-b-rank :- b=d, :between-cae Value Example rank Positive Negative (b) Figure 5: Results of rehardening: (a) A hardened version of the chess-endgame theory with softened clauses in boldface and softened antecedents underlined. (b) The sorting graph of the rehardened theory (using the same 100 examples as in Figure 4); the vertical dashed line shows the optimal classification threshold. Accuracy Training Softening Acc Rehardened Acc Figure Rehardening for the chess endgame theory. Averaged learning curves for C4.5 and SoftClassify with rehardening. 5.1 Rehardening the Chess theory Let us now reconsider \Gamma, the flawed version of the chess endgame theory shown above. Figure 5(a) shows the results of rehardening that theory on a training set E of just examples. Note that the components which remain soft are almost exactly those which contain flaws in the theory. Figure 5(b) shows how SoftClassify sorts 100 test examples (not in E) using the rehardened theory shown. With rehardening, SoftAcc(\Gamma,E ,u H increases to 90%, as opposed to SoftAcc(\Gamma,E ,u ffl )=79% without rehardening. In Figure 6 we compare the accuracies obtained on a test set using C4.5, softening alone, and rehardening, respectively, with varying amounts of training data. We evaluated the methods over 5 trials. Each trial trained on from 10 to 100 examples, testing accuracy on a disjoint 200- example test set. We then averaged the accuracies from all 5 trials. It is evident that rehardening significantly improves over softening (which remains equal to the original theory accuracy over the entire range here). Furthermore, for few training examples (less than 90), rehardening is better than learning directly from examples. However, the rehardening curve flattens very quickly, even as C4.5 continues to improve. Since rehardening is somewhat crude (for example, it cannot fine-tune theories by adding components) its potential is limited. Thus when sufficient examples are available, it may be preferable to use inductive methods. 5.2 Comparing Types of Flawed Theories Here we examine our proposed explanation for the difference in softening performance between the promoter and chess endgame theories. In addition to the "locally flawed" theory presented above, therefore, we also created a flawed theory with synthetic "distributed flaws", to show how we can distinguish between these types of theories based on their performance under softening and rehardening. In a theory with distributed flaws, many or most components of the theory are flawed, but each flaw does not change the meaning of the theory very much. For example, if the antecedents of two clauses for a proposition p are randomly redistributed between the clauses, many flaws are illegal :- king-attack-king, rook-attack-king illegal :- king-attack-king, same-loc-cd-ef illegal :- king-attack-king, same-loc-ab-ef illegal :- rook-attack-king, same-loc-ab-ef, same-loc-ab-cd rook-attack-king :- king-not-b-file, adj-ae, d=f rook-attack-king :- d=f rook-attack-king :- king-not-b-rank, d=f, king-not-b-file, c=e king-not-b-file :- adj-bf, adj-ae, :between-dbf king-not-b-file :- c=e, d=f, :between-dbf, a=c king-not-b-file :- :between-dbf, a=c king-not-b-file :- :a=e, adj-ae, :a=c king-not-b-file :- :d=f, c=e, :a=c king-not-b-rank :- :between-cae, b=d king-not-b-rank :- :between-cae, :b=d king-attack-king :- adj-bf, a=e, b=f, adj-ae king-attack-king :- b=f, adj-bf, adj-ae illegal :- Int-b, b=d illegal :- :a=c, adj-ae Figure 7: Chess-2: Chess theory with distributed flaws. Chess-3: Random 'chess' theory. Chess-1 Chess-2 Chess-3 Theory itself 77% 35% 65% Softening 77% 87% 68% Rehardening 89% 94% 72% Table 1: Accuracies for different interpretation methods for chess theories with different types of flaws. The last line shows the fraction of the total example set classified by each theory as positive. Chess-1 has localized flaws, Chess-2 has distributed flaws, and Chess-3 is random. introduced (for each antecedent wrongly placed), but still, the same set of components influences the truth of p in the flawed theory. Thus, we consider here three flawed versions of the chess endgame theory: 1. the theory considered above with four localized flaws (Chess-1), 2. a theory with distributed flaws, created by repeatedly merging and randomly splitting the antecedent sets of clauses in the theory (Chess-2, Figure 7), and 3. a randomly generated theory with the same primitives as the correct theory (Chess-3, Figure 7). We performed a set of trials, each using a different 40-example training set and 200-example testing set. In each trial, for each theory we evaluated the accuracy on the test set of (a) the original flawed theory, (b) the softened theory using a threshold evaluated from the training set, and (c) the theory rehardened based on the training set. We averaged the results of 5 random trials; results are shown in Table 1. Table 1 shows the initial accuracies and the results of using softening and partial rehardening on the three test theories. Note that just using classification accuracy tells us nothing about the relative merits of the theories; in fact, the random Chess-3 is better than Chess-2 with distributed flaws. Nevertheless, we see that the accuracy of the random theory using SoftClassify, even with rehardening, is little better than its raw accuracy and, more significantly, little better than simply classifying all examples as negative indicating clearly that the theory is essentially useless for distinguishing between positive and negative examples, and thus should be discarded. On the other hand, both Chess-1 and Chess-2 show significant improvement in accuracy using SoftClassify with rehardening. These theories are distinguishable, however, by the respective differences in the gap between softening and rehardening. Rehardening adds less to the effect of softening in Chess-2, which suggests that its flaws are non-localized, while rehardening improves Chess-1 quite noticeably over softening, which suggests that Chess-1's flaws are localized. Such information could be useful for deciding how to handle each one of the three theories. We should probably revise the theory with localized flaws, interpret the theory with distributed flaws probabilistically, and throw out the random theory. Indeed, C4.5 performs significantly better (81%) than Chess-3 even with rehardening, whereas both Chess-1 and Chess-2 show improvement over C4.5 with rehardening (for a small training set). More generally, these results suggest how we might decide the proper way to use a given theory based on a training set. First check if the theory contains any useful information, i.e., that positive examples are 'proved to a greater degree' than negative examples. Specifically, we need to check that the accuracy obtained by the softened theory is significantly better than the accuracy expected from optimally partitioning a random ordering of positive and negative examples. (Roughly speak- ing, this expected accuracy slightly exceeds max(Pos,Neg), where Pos and Neg are the respective 1. no-payment-due :- deferment 2. no-payment-due :- continuous 3. deferment :- disability-deferment 4. deferment :- student-deferment 5. deferment :- financial-deferment 6. deferment :- peace-corps-deferment 7. deferment :- military-deferment 8. continuous :- enrolled-five-years, never-left 9. military-deferment :- armed-forces-enlist 10. peace-corps-deferment :- peace-corps-enlist 11. financial-deferment :- unemployed 12. financial-deferment :- filed-for-bankruptcy 13. student-deferment :- enrolled-eleven-years 14. disability-deferment :- disabled Figure 8: The correct student-loan theory. percentages of positive and negative examples in our training set. Thus, for example, for the chess theory 66% of our training examples are negative and the softened random theory correctly classes 68%. This is easily achieved by choosing a threshold near 1.0, i.e., by classing almost all examples as negative.) If this is the case, the theory should be revised just when it contains localized errors, i.e., when rehardening obtains significantly better classification on training data than softening does. This could be done, given a small training set, by evaluating the expected accuracy of softening and rehardening by cross-validation. If softening increases accuracy greatly, perhaps the theory should be used as is. However, if softening does little but rehardening helps, the theory should probably be revised. If neither softening nor rehardening helps, the theory should be discarded and pure inductive techniques should be applied. In the next section we will see, though, that such a method is not completely reliable in general: rehardening often helps significantly for theories with non-localized flaws, while not helping at all for some theories with localized flaws. 5.3 Rehardening flawed student-loan theories We now take a closer look at some rehardened flawed theories in order to compare the set of flawed components with the set of components left soft. We will see that although these two sets are similar, they are not quite identical. Obviously, those flaws that do not adversely affect the classification of any training examples are not left soft. Additionally, it turns out, surprisingly, that there are subtle ways in which hardening flawed components while leaving related components soft actually leads to better results than leaving the flawed components themselves soft. In order to illustrate this and related phenomena, we consider three arbitrarily chosen flawed versions of the student-loan theory (shown in Figure 8), used for determining whether a student must pay back a student loan (Pazzani & Brunk, 1991). We performed five independent trials for each theory, using disjoint 100-example training and test sets. We compare the flawed theories with the sets of hardened components, as well as examining the accuracies of the initial theory, the theory with softening, with rehardening, and with just the flawed components left soft (simulating ideal rehardening). Although the set of rehardened components for each flawed theory varies with the given training Theory Flaws Soft components SL I 1. Add military-deferment :- filed-for-bankruptcy,:disabled 2. In clause 8 add antecedent: financial-deferment * financial-deferment in clause 8 3. In clause 12 add antecedents: military-deferment, student-deferment 4. In clause 14 add antecedent: continuous * continuous in clauses 2 and 14 SL II 1. Delete clause 7 - 2. Add deferment :- :filed-for-bankruptcy, financial-deferment,student-deferment disability-deferment 3. In clause 1 add antecedent: enrolled-eleven * enrolled-eleven in clause 1 4. In clause 10 add antecedent: continuous * continuous in clause 10 5. In clause 14 add antecedent: continuous * continuous in clause 14 - * continuous in clause 2 SL III 1. Delete clause 5 - 2. Add peace-corps-deferment :- * peace-corps-deferment :- :fire-department-enlist, never-left * :fire-department-enlist in added clause 3. In clause 8 delete antecedent never-left * Clause 2 * continuous in clause 2 4. Add military-deferment :- disabled, :student-deferment, foreign-legion-enlist Table 2: Rehardening results for three flawed student-loan theories. The table shows which flaws were introduced into the correct theory (Figure 8) and which components were left soft by rehard- ening. Each component whose softening compensates for a particular flaw is placed near that flaw in the table. examples, in each case there was one rehardened theory which appeared in a majority of the independent trials (and it is to these rehardened theories that we refer below). The flawed theories are compared with the results of rehardening in Table 2 and 3. In theory SL I, flaw 1 does not let through any negative examples and in fact lets through some positive ones incorrectly blocked by flaw 3. Therefore it is not left soft. Flaws 2 and 4 are captured directly. This is an easy theory for softening to handle since the flaws are additions rather than deletions. The rehardened theory perfectly classifies all the test examples. In Theory SL II, flaws 3,4, and 5 are captured directly. Flaw 2 does not let through any negative examples. Only the deleted clause is not directly compensated for. As a result the rehardened theory is only 94% accurate. As can be seen in Table 3, even if precisely the flawed components are left soft (i.e., if the antecedent deferment, which is rendered overly specific by the deletion of clause 7, is also left soft), the rehardened accuracy does not exceed 94%. Theory SL III is the most interesting of the three flawed theories considered here. The effect of the added clause (flaw 2) is diminished both by its being softened and by its parent (clause being softened. Softening :fire-department-enlist in the softened added clause boosts the relative effect of the other antecedent, never-left, which was deleted from clause 8 (flaw 3). Softening clause 2 further diminishes the influence of clause 6 which lets through negative examples (as a result of flaw 3). Finally, softening the antecedent continuous in clause 2 diminishes the influence of softening the clause itself. Flaw 4 does not let through any negative examples and is not left SL I SL II SL III Initial 75% 74% 75% Softened 98% 86% 87% Rehardened 100% 94% 94% Flaws soft 100% 94% 90% Table 3: Results of softening and rehardening for three flawed student-loan theories. Shown are the initial accuracy of the flawed theory, as well as the accuracies obtained by softening, by rehardening, and by hardening all components except for those actually flawed. soft. As seen in Table 3, this results in a more accurate rehardened theory (94%) than the one in which precisely the flawed components are left soft (90%). 6 Experimental Results 6.1 Theory accuracy After the anecdotal results of the previous section, we turn now to several systematic experiments. We synthetically generated five different random propositional theories. The number of distinct propositions in the theories ranged from 15 to 21, and the number of clauses in the theories ranged from 14 to 22, with an average of 2.5 antecedents per clause. For each theory, 20 flawed theories five local flaws each and 10 with five distributed flaws each, as follows: Local: The flaw generator chooses a theory component at random and inserts into it a random flaw (adding a clause with 2-4 random antecedents for a proposition, deleting an antecedent, or either adding a random antecedent for a clause or deleting the clause with equal probability). Distributed: The flaw generator chooses a proposition at random and replaces two random clauses for the proposition by a new clause C with the union of the two clauses' antecedents, and then splits C randomly into two new clauses by randomly assigning antecedent literals to one (or both) of the new clauses. These two types of flaws allow us to experimentally evaluate our explanation of the difference between the promoter and chess endgame theories described above. For each of the five correct theories, 100 examples were randomly generated and divided into two equal sets. Nested subsets of various sizes were selected from one of the sets as training examples for each corresponding flawed theory and the results were tested against all the examples in the other set. The roles of the two sets were then switched, so that for each flawed theory and each number of training examples two data points were generated. These were then averaged. In the accompanying scatter plots we plot the initial accuracy of each of the fifty locally-flawed theories and each of the fifty distributed-flawed theories against the softened accuracy and against the hardened accuracy. We show results here for 20 and for 40 training examples in Figures 9 and 10; average results are given in Table 4. We tested for statistical significance of the improvement of (a) softening over the original theory, and (b) rehardening over softening, by performing t-tests on the paired data. In seven of eight cases the accuracy improvement proved to be significant with 0:002. Only for the case of distributed flaws with 20 training examples was rehardening accuracy indistinguishable from softening accu- racy. This accords with our hypothesis about the lessened effect of rehardening for theories with distributed flaws. accuracy Original acc of flawed theory Training Hardened acc on testing Original acc of flawed theory Training accuracy Original acc of flawed theory Training Hardened accuracy Original acc of flawed theory Training Rehardening Figure 9: Scatter plots for experiments on synthetic theories with local flaws, using 20 and 40 training examples. training 40 training Flaw type Original Softening Rehardening Softening Rehardening Distributed 69.0% 84.2% 84.9% 85.2% 88.1% Table 4: Average results for experiments on synthetic theories with local and distributed flaws. Shown are the average original accuracies of the theories, with accuracies after softening and re- hardening, with 20 and 40 training examples. accuracy Original acc of flawed theory Training Hardened acc on testing Original acc of flawed theory Training accuracy Original acc of flawed theory Training Hardened accuracy Original acc of flawed theory Training Rehardening Figure 10: Scatter plots for experiments on synthetic theories with distributed flaws, using 20 and Hardened accuracy accuracy Training Hardened accuracy accuracy Training Distributed Figure Scatter plots for experiments on synthetic theories with local distributed flaws, using training examples, comparing rehardening to softening accuracy. As is evident from the plots, softening is astonishingly effective even using only 20 training examples. It almost never does any harm. When rehardening is used to focus softening, every single one of the 100 flawed theories is improved when only 40 training examples are used. Even when only twenty training examples are used, only two out of one hundred rehardened theories classify less accurately than the original theories (and these only by a tiny margin). It is interesting to note, though, that contrary to our expectations, the difference in effectiveness of softening versus rehardening for local versus distributed flaws, although detectable in Table 4, is not very significant. Softening works well for both and rehardening generally slightly improves both (with a greater improvement for locally flawed theories). A small difference can be seen, however, in Figure 11, which plots accuracy after rehardening as a function of accuracy after softening. 6.2 Finding single flaws As we saw above, on theories with multiple flaws rehardening often works more effectively by leaving soft theory components other than those which are actually flawed. In the case of theories with single flaws, we would hope that rehardening would be able to isolate the flaws precisely. To the extent that rehardening is successful at isolating flaws in this way it could be effectively used in conjunction with other theory revision algorithms which repair isolated flaws. Accordingly we ran the following experiment to test the ability of rehardening to isolate individual theory flaws. clauses, with an average of 29.44 components per theory). For each theory we generated 10 flawed versions, each with a single random flaw (as above for local flaws). For each correct theory, we also generated 10 random training sets of 20 examples each, for use in rehardening the flawed theories. We rehardened each flawed theory using each training set for that theory, giving us 1000 data points. After rehardening each flawed theory on a training set, we evaluated which component(s) were soft, as compared with the actual location of the theory flaw. The possible outcomes of each trial are: Exact Oversoft Undersoft Nearby Failed Number of trials Accuracy class Figure 12: Results of 1000 trials on single-error theories. See text for explanation. Exact the flawed component is the only one left soft, Oversoft the flawed component is one of several left soft, Undersoft no components are left soft, Nearby the flawed component is not left soft but an ancestor/descendant is (and possibly other components as well), or Failed the flawed component is not left soft but some entirely different component(s) are. Figure 12 shows the results of the experiment. As is shown, the flaw was left soft in over 55% of all trials, and in 69% of all trials either the flaw or one of its ancestors or descendants was left soft. On average, 1.28 components were left soft in each theory. In only 70 cases (7%) were only components unrelated to the flaw left soft. Out of the 470 cases in which exactly one component was left soft, in 381 cases (81%), the single soft component was the flawed component. It should be noted that of the 239 cases in which no component was left soft, 100 were unavoidable since in them the flawed theory was perfect on the training set (as expected, since the training only contained 20 random examples). Conclusions We have introduced the notion of "degree of provedness", which we believe is fundamental for distilling reliable information from unreliable theories. In particular, we have found that softening is an extremely effective method of theory reinterpretation. It increases classification accuracy for almost all flawed theories even when only a handful of training examples are available. Moreover, softening adds no computational expense to ordinary logical methods of classification using theories. Hence, whenever the reliability of a given propositional theory is in doubt and sufficient information for choosing a threshold (e.g., a small number of examples) is available, it is recommended that the theory be interpreted softly. We have shown formally why rehardening unflawed components of the theory should typically improve soft classification. We have shown empirically that rehardening based on small training sets does in fact improve on softening (sometimes performing even better than rehardening the actual flawed components). However, it is not necessarily the case that the improvement in classification accuracy obtainable by rehardening always justifies its computational expense. Methods for improving the efficiency and efficacy of the rehardening process remain to be explored. Both softening and rehardening are crude methods which reinterpret theories but do not revise them. Thus their potential for increasing accuracy is limited, especially where theory components have been deleted. The strength of these methods lies primarily in their not requiring large amounts of training examples. When training examples abound, inductive methods may prove superior to these methods. We have suggested ways in which rehardening can be used as a meta-algorithm for theory revision by determining whether a flawed theory contains useful information, whether its flaws are localized or distributed throughout the theory, and where localized flaws are located. This information can be used to decide whether a theory is a candidate for revision and whether it should be patched or reinterpreted. However, our results do not bear out that the relative effectiveness of softening versus rehardening can reliably distinguish theories with localized flaws from those with the type of distributed flaws that we considered here. We believe that the weakness of these results is an artifact of our method for generating distributed flaws. The precise definition of distributed flaws and methods for generating them are an important topic for future research. One issue that remains open is the interaction between various parameters. In our softening experiments we always set 0:1 and the theories we used had between 25 and 150 components and between 5 and 20 flaws. For these parameters we found 20 to training examples to be sufficient for softening and to 40 sufficient for rehardening. The relationship between ffl, theory size, the number and type of flaws, and the number of examples required for varying accuracy levels merits further investigation. --R Theory refinement on Bayesian networks. Grammatically biased learning: Learning logic programs using an explicit antecedent description language. Rerepresenting and restructuring domain theories: A constructive induction approach. Integrating multiple classifiers by finding their areas of expertise. Journal of Int'l Conference on Machine Learning. Combining Symbolic and Connectionist Learning to Revise Certainty-Factor Rule Bases Comparing methods for refining certainty-factor rule bases UCI repository of machine learning databases. On the informativeness of the DNA promoter sequences domain theory. Flexibly exploiting prior knowledge in empirical learning. Int'l Conference on Machine Learning. Theory refinement combining analytic and empirical methods. Detecting and correcting errors in rule-based expert systems: An integration of empirical and explanation-based learning The utility of prior knowledge in inductive learning. Probabilistic Reasoning In Intelligent Systems: Networks of Plausible Inference. Theory refinement for Bayesian networks with hidden variables. Local learning in probabilistic networks with hidden variables. Multistrategy learning and theory revision. Extracting refined rules from knowledge-based neural networks --TR
flawed domain theories;probabilistic theories;approximate reasoning;theory revision;logical theories;machine learning
599643
Relative Loss Bounds for On-Line Density Estimation with the Exponential Family of Distributions.
We consider on-line density estimation with a parameterized density from the exponential family. The on-line algorithm receives one example at a time and maintains a parameter that is essentially an average of the past examples. After receiving an example the algorithm incurs a loss, which is the negative log-likelihood of the example with respect to the current parameter of the algorithm. An off-line algorithm can choose the best parameter based on all the examples. We prove bounds on the additional total loss of the on-line algorithm over the total loss of the best off-line parameter. These relative loss bounds hold for an arbitrary sequence of examples. The goal is to design algorithms with the best possible relative loss bounds. We use a Bregman divergence to derive and analyze each algorithm. These divergences are relative entropies between two exponential distributions. We also use our methods to prove relative loss bounds for linear regression.
Introduction A main focus of statistical decision theory consists of the following: After receiving statistical information in the form of sampling data, the goal is to make decisions that minimize a loss or an expected loss with respect to an underlying distribution that is assumed to model the data. This distribution is often dened in terms of certain parameters. The statistical decisions depend on the specic values chosen for the parameters. Thus, for statistical decision theory, there are three important elements: parameters and the values they can take, decisions, and loss functions that evaluate the decisions. y An extended abstract appeared in UAI 99 (AW99) z Supported by NSF grant CCR 9700201 and CCR-9821087 c 2000 Kluwer Academic Publishers. Printed in the Netherlands. K. S. Azoury and M. K. Warmuth In Bayesian statistical decision theory, a prior distribution on the parameters of the data distribution is an additional important element of information that is needed to assess decision performance. As a simple case, suppose we are given a sample of T data points fx 1 (also referred to as T examples), and assume that the examples were independently generated by a Gaussian with an unknown mean and a known variance. One wants to nd a parameter setting (here the mean) that minimizes the expected loss on a new example that is drawn from the same data distribution. In the Bayesian framework, a prior distribution on the mean would also enter into the decision making process. In the context of learning theory, this setup, Bayesian or not, would be described as a batch or o-line learning model, since all the examples are given to the learner ahead of time and the decisions are made based on the information from the entire data set. In this paper, we focus on on-line learning models. As with o-line learning, we have the same fundamental elements: parameters, deci- sions, and loss functions. The dierence, however, is that the examples are given to the learner one at a time. Thus, on-line learning is naturally partitioned into trials, where in each trial one example is processed. A trial proceeds as follows. It begins with a current parameter setting (hypothesis). Then the next example is presented and the learner or the on-line algorithm incurs a loss. The loss is a function of this most recent example and the current parameter setting. Finally, the algorithm updates its parameter setting and a new trial begins. In the context of on-line learning, the decisions are the parameter updates of the learner. The goal is to design on-line learning algorithms with good bounds on their total loss. Clearly, there cannot be meaningful bounds on the total loss of an on-line algorithm that stand alone and also hold for an arbitrary sequence of examples. However, in the on-line learning literature, a certain type of \relative" loss bound is desirable and has been used successfully. The term \relative" means that there is a comparison to the best parameter chosen o-line after seeing the whole batch of T examples. The parameter space is called the comparison class. The relative loss bounds quantify the additional total loss of the on-line algorithm over the total loss of the best o- line parameter (comparator). Since the on-line learner does not see the sequence of examples in advance, the additional loss (sometimes called regret) is the price of hiding the future examples from the learner. In this paper we design and motivate on-line algorithms and their parameter updates so that they utilize the available information in the best possible manner and lead to good relative loss bounds. We focus on Relative Loss Bounds 3 two types of learning problems: on-line density estimation and on-line regression. For density estimation, the on-line algorithm receives a sequence of unlabeled examples or data vectors fx 1 g. At the start of the learner has a current parameter setting t which is used to predict the next example x t . After making a predic- tion, the algorithm receives the example x t and incurs a loss L( Then the algorithm updates its parameter setting to t+1 . In con- trast, on-line regression problems receive a labeled sequence of examples are called instances and the y t are the labels. In trial t, the learner starts with the current parameter t and receives the instance x t . The learner then makes a prediction y t for the label y t . This prediction depends on t and x t . A loss L( incurred and the parameter is updated to t+1 . For both types of problems, density estimation and regression, we use the abbreviated notation L t ( t ) to denote the loss incurred in trial t. The subscript t indicates the dependence on the example presented in trial t. The total loss of the on-line algorithm is and the total loss of the best o-line (batch) parameter B is a charge for the \size" of B . Relative loss bounds give upper bounds on the dierence between the two total losses. We prove relative loss bounds for density estimation when the underlying model is a member of the exponential family of distributions and also for on-line linear regression. We consider two algorithms. The rst algorithm is called the Incremental O-line Algorithm. It predicts (i.e., chooses its parameter) as the best o-line algorithm would have predicted based on the examples seen so far. The second algorithm is called the Forward Algorithm. This algorithm is called \forward" because it uses a guess of a future example and the corresponding future loss when forming its prediction. It is motivated by Vovk's work on linear regression. Our relative loss bounds for both algorithms grow logarithmically with the number of trials T . The motivation for the parameter updates has a Bayesian probabilistic interpretation. However, the relative loss bounds we prove hold for an arbitrary (or worst-case) sequence of ex- amples. A key element in the design and analysis of the on-line learning algorithms is a generalized notion of distance called the Bregman diver- gence. This divergence can be interpreted as a relative entropy between two exponential distributions. 4 K. S. Azoury and M. K. Warmuth Outline The rest of this paper is organized as follows. In Section 2, we present a brief overview of previous work. In Section 3, we dene Bregman divergences and give the relevant background for the exponential family of distributions. We show that relative entropies between two exponential distributions (Ama85) are special Bregman divergences. We conclude this section by listing some basic properties of Bregman divergences. In Section 4, we introduce the Incremental O-line Algorithm in a general setting and then apply this algorithm to the problem of density estimation with the exponential family and to linear regression. We give a number of relative loss bounds for specic examples. In Section 5, we dene and motivate the Forward Algorithm, which can be seen as a generalization of the Incremental O-line Algorithm. Again, we apply this algorithm to density estimation with the exponential family. For the case of linear regression, we reprove the relative loss bounds obtained by Vovk (Vov97). Our proofs are more concise. An alternate simple proof for the \forward" linear regression algorithm is given in (For99). In Section 6, we brie y discuss an alternate method developed by Vovk for proving relative loss bounds that uses integration over a generalized posterior and discuss the advantages of our methods. Finally, we conclude (Section 7) with a discussion of a number of open problems. 2. Overview of previous work The method of proving bounds on the additional total loss of an on-line algorithm over the total loss of the the best parameter in a comparison class essentially goes back to the work of the Blackwell (Bla56) and Hannnan (Han57). They investigated such bounds in the context of game theory where the comparison class consists of all mixture strategies. Later Cover (Cov91) proved such bounds in the context of mathematical nance. He used the comparison class of all constant rebalanced portfolios. The research of this paper is rooted in the study of relative loss bounds for on-line learning algorithms of the computational learning theory community. Even though these bounds may underestimate the performance on natural data, they have been used as a powerful yardstick for analyzing and comparing on-line algorithms. In the computational learning theory community this line of research was initiated by Littlestone with the discovery of the Winnow algorithm (Lit88). Littlestone also pioneered a style of amortized analysis for Relative Loss Bounds 5 proving relative loss bounds which use certain divergence functions as potential functions. Winnow is designed for disjunctions as the comparison class and the total number of mistakes is used as the loss. The next wave of on-line algorithms were designed for a nite set of experts as a comparison class and a wide range of loss functions algorithms were developed for the on-line linear least squares regression, i.e., when the comparison class consists of linear neurons (linear combination of ex- perts) (LLW95; CBLW96; KW97). This work has been generalized to the case where the comparison class is the set of sigmoided linear neurons (HKW95; KW98). Also starting with Littlestone's work, relative loss bounds for the comparison class of linear threshold functions have been investigated (Lit88; GLS97). All the on-line algorithms cited in the previous paragraph use xed learning rates. In the simple settings the relative loss bounds do not grow with the number of trials. However, already for linear regression with the square loss, the relative loss bounds for algorithms with xed learning rates grow with the square root of the loss of the best linear predictor (CBLW96; KW97) and the best loss is often linear in the number of trials T . In contrast, our algorithms use a variable learning rate and our relative loss bounds grow logarithmically with T . Such bounds have been proven for a generalization of Bayes' Algorithm XB97; Yam98) which maintains a posterior on all parameters of the comparison class. We outline this method for proving relative loss bounds in Section 6. Bounds that grow logarithmically with T have also been proven previously for on-line linear regression important insight we gained from this research is that O(log T ) relative loss bounds seem to require the use of variable learning rates. In this paper, the learning rate applied in trial t is O(1=t). The use of O(1=t) learning rates for the exponential family was also suggested by Gordon as a possible strategy for leading to better bounds. However, no specic examples were worked out. In the case of linear regression, the O(1=t) learning rates become inverses of the covariance matrix of the past examples. General frameworks of on-line learning algorithms were developed in (GLS97; KW97; KW98; Gor99). We follow the philosophy of Kivinen and Warmuth (KW97) of starting with a divergence function. From the divergence function we derive the on-line update and then use the same divergence as a potential in the amortized analysis. A similar method was developed in (GLS97) for the case when the comparison class consists of linear threshold functions. They start with an update and construct the appropriate divergence that is used in the analysis. 6 K. S. Azoury and M. K. Warmuth Recently we have learned that the divergences used in on-line learning have been employed extensively in convex optimization and are called Bregman-distances (Bre67; CL81; Csi91; JB90). Bregman's method is to pick from a set of allowable models the one of minimal distance to the current model. In other words the current hypothesis is projected onto a convex set of allowable models. Some mild additional assumptions assure the uniqueness of the projections. With these assumptions a generalized Pythagorean Theorem can be proven for Bregman divergences HW98). The latter theorem often contradicts the triangular inequality and this is the reason why we use the term \divergence" instead of \distance". Projections with respect to Bregman divergences have recently been applied in (HW98) for the case when the o-line comparator is allowed to shift over time. The projections are used to keep the parameters of the algorithm in reasonable regions. This aids the recovery process when the underlying model shifts. 3. Bregman Divergences and the Exponential Family In this paper, we use a notion of divergence due to Bregman (Bre67) for deriving and analyzing on-line learning algorithms. These divergences can be interpreted as relative entropies between distributions from an exponential family. We begin this section by dening Bregman divergences and then review some important features of the exponential family of distributions that are relevant to this paper. We conclude this section with some properties of the divergences. For an arbitrary real-valued convex and dierentiable function G() on the parameter space R d , the Bregman divergence between two parameters e and in is dened as Here r denotes the gradient with respect to . Throughout the paper, all vectors are column vectors and we use \" to denote the dot product between vectors. Note that the Bregman divergence G ( e minus the rst two terms of the Taylor expansion of G( e ) around . In other words, G ( e is the tail of the Taylor expansion of G( e ) beyond the linear term. Since G() is convex, G ( e properties will be listed in Section 3.4. For example, let the parameter space be 2 . In this case the Bregman divergence becomes the squared Relative Loss Bounds 7 Euclidean distance, i.e., Also if e e ( e e 3.1. The Exponential Family The features of the exponential family that are used throughout this paper include a measure of divergence between two members of the family and an intrinsic duality relationship. See (BN78; Ama85) for a more comprehensive treatment of the exponential family. A multivariate parametric family FG of distributions is said to be an exponential family when its members have a density function of the where and x are vectors in R d , and P 0 (x) represents any factor of the density which does not depend on . The d-dimensional parameter is usually called the natural (or canonical ) parameter. Many common parametric distributions are members of this family, including the Gaussian. The function G() is a normalization factor dened by Z The space R d , for which the integral above is nite, is called the natural parameter space. The exponential family is called regular if is an open subset of R d . It is well known (BN78; Ama85) that is a convex set, and that G() is a strictly convex function on . The function G() is called the cumulant function, and it plays a fundamental role in characterizing members of this family of distributions. We use g() to denote the gradient r G() and r 2 G() to denote the Hessian of G(). Let represent the log-likelihood which is viewed as a function of . Under some standard regularity conditions, log-likelihood functions satisfy well-known moment identities (MN89). Applying these identities to the exponential family reveals the special role played by the cumulant function G(). 8 K. S. Azoury and M. K. Warmuth be the expectation with respect to the distribution PG (xj). The rst moment identity of log-likelihood functions is The gradient of the log-likelihood in (3.2) is linear in x: r G (; Applying (3.3), we get This shows that the mean of x is equal to the gradient of G(). We let call the expectation parameter. Since the cumulant function G is strictly convex, the map has an inverse. We denote the image of under the map g(:) by M and the inverse map from M to by g 1 . The set M is called the expectation space, which may not necessarily be a convex set. The second moment identity for log-likelihood functions is where 0 denotes the transpose. For the exponential family we have and r 2 Thus, by the second moment identity, the variance-covariance matrix for x is the Hessian of the cumulant function G() (also called the Fisher Information Matrix). Since G() is strictly convex, this Hessian is symmetric positive denite. 3.2. Duality Between the Natural Parameters and the Expectation Parameters Sometimes, it is more convenient to parameterize a distribution in the exponential family by using its expectation parameter instead of its natural parameter . This pair of parameterizations have a dual relationship. We provide the aspects of the duality that are relevant to this paper. First, dene a second function on the range M of g as follows: Let f() := rF () denote the gradient of F (). Relative Loss Bounds 9 Note that by taking the gradient of F () in (3.6) with respect to and treating as a function of , we get where r is the Jacobian of with respect to . Thus, f() is the inverse map g 1 () and the two parameterizations and are related by the following transformations Since g() has a positive denite Jacobian for all 2 , g 1 () has a positive denite Jacobian for all 2 M. Thus, the second function F () is strictly convex as well. This function is called the dual of G() (Ama85). Furthermore, F () is the negative entropy of PG (xj) with respect to the reference measure P 0 (x), i.e., It follows from (3.8) that the Hessian of F () is the inverse of the Fisher Information Matrix, i.e., r 2 Now consider the function V G(f()), which is the Fisher Information Matrix expressed in terms of the expectation parameter. This function is dened on the expectation space M, takes values in the space of symmetric d d matrices, and is called the variance function. The variance function plays an important role in characterizing members in the exponential family (Mor82; GPS95). The matrix V () is positive denite for all 2 M, and V . Thus, in the context of exponential families the functions F and G are not arbitrary convex functions but must have positive denite Hessians. 3.3. Divergence Between two Exponential Distributions Consider two distributions PG (xj e with an old parameter setting e and PG (xj) with a new parameter setting . Following Amari (Ama85) one may see the exponential family FG as a manifold. The parameters e and represent two points on this manifold. Several measures of distance (divergence) between these two points have been proposed in the literature. Amari introduced divergences (Ama85), and other related \distances" were introduced by Csiszar (Csi91) known as f divergences (we use the letter h below). Also Cherno distances and Renyi's information are related (Ama85). These divergences all have K. S. Azoury and M. K. Warmuth the following general form: where h(:) is some continuous convex function. Our main choice for h is which gives the relative entropy Another interesting choice is which gives the \opposite" These two entropies are, respectively, called 1 and +1 divergences by Amari (Ama85). 3.4. Properties of Divergences In this section we give some simple properties of the divergences. For these properties we do not need that G() has a positive denite Hessian. Hence the properties hold for the more general denition of Bregman divergence (3.1) where we allow G() to be an arbitrary real-valued dierentiable convex function G() on the parameter space . Throughout the paper we use to represent r G(). 1. G ( e ; ) is convex in its rst argument since G( e ) is convex. 2. G strictly convex then equality holds i e 3. The gradient of the divergence with respect to the rst argument has the following simple form r e 4. Divergences are usually not symmetric, i.e., G ( e 5. The divergence is a linear operator, i.e., and aG for a 0: Relative Loss Bounds 11 6. The divergence is not aected by adding a linear term to G(): if G() then G 7. For any 1 ; 2 and 3 , The dot product can usually have any sign. When it is negative then the above contradicts the triangular inequality. The case when the dot product is zero is exploited in the proof of the generalization of the Pythagorean Theorem to Bregman divergences (See for example 8. If G() is strictly convex, then the denition of the dual convex function F () and the parameter transformations still hold (3.6- 3.8) and Bregman divergences have the following duality property: The rst six properties are immediate. Property 7 is proven in the appendix. This property was rst used in (WJ98) for proving relative loss bounds. The last property follows from the denition of the dual function F () (also called convex conjugate (Roc70)). Note that the order of the arguments in G ( e is switched. In this paper, we only need Property 8 for the case when G() is strictly con- vex. However, for any real-valued dierentiable convex function G() one can dene the dual function as F parameter in such that r (Roc70). With this denition Property 8 still holds. We note that Gordon (Gor99) gives an elegant generalization of Bregman divergences to the case when the convex function G() is not necessarily dierentiable. For the sake of simplicity we restrict ourselves to the dierentiable case in this paper. Finally, when G() is dierentiable, the Bregman divergence can also be written as a path integral: This integral version of the divergence has been used to dene a notion of a convex loss \matching" the increasing transfer function g() of an articial neuron (AHW95; HKW95; KW98). 12 K. S. Azoury and M. K. Warmuth 4. The Incremental O-line Algorithm In this section we give our most basic algorithm and show how to prove relative loss bounds in a general setting. Learning proceeds in In each trial t an example is processed. For density estimation, the examples are data vectors x t from some domain X . In the regression setting, the t-th example consists of an instance x t from some instance domain X and a label y t from some label domain Y. The setup for a learning problem is dened by three parts. A parameter space R d , a real-valued loss function and a divergence function that is a measure of \distance" to an initial parameter setting. The parameter space represents the models to which the algorithms are compared. The loss of parameter vector on the t th example is denoted by L t () and L 1::t () is shorthand for Usually losses are non-negative. The third component of the setup is an initial parmeter 0 and a Bregman divergence U0 (; 0 ) to the initial pa- rameter. The initial parameter 0 may be interpreted as a summary of any prior learning and the divergence U0 (; 0 ) represents a measure of \distance" to the initial parameter. The o-line (or batch) algorithm sees all T examples at once and it sets its parameter to where U T+1 Assumptions: The losses L t () (for 1 t T ) and U 0 () are dier- entiable and convex functions from the parameter space to the reals. Furthermore, we assume that argmin U T+1 () always has a solution in . Note that this o-line algorithm trades the total loss on the examples against closeness to the original parameter. Alternatively the divergence U 0 may be interpreted as the \size" of parameter . With this interpretation, the o-line algorithm nds a parameter that minimizes the sum of size and total loss. The on-line algorithm sees one example at a time according to the following protocol: On-line protocol of the Incremental O-line Algorithm Initial hypothesis is 0 . For to T do Predict with t . Get t-th example. Incur loss L Update hypothesis t to t+1 . Relative Loss Bounds 13 The goal of the on-line algorithm is to incur a loss that is never too much larger than the loss of the o-line algorithm which sees all examples at once. At the end of trial t the on-line algorithm knows the rst t examples and expects to see the next example. One reasonable and desirable setup for the parameter update at this point is to make the on-line algorithm do exactly what an o-line algorithm would have done after seeing t examples. We use the name Incremental O-line for the on-line algorithm with this property. The Incremental O-line Algorithm where U t+1 Additional assumptions: Here we assume that the argmin U t+1 () (for 1 t T ) always have a solution in . If there is more than one solution for then this is interpreted as t+1 2 argmin U t+1 (). In the learning problems that we use as examples in this paper, U t+1 () is typically strictly convex and so there is only one solution. Note that the nal parameter T+1 of the Incremental O-line Algorithm coincides with the parameter B chosen by the batch algorithm. When which is consistent with the protocol given above. While not necessary here, we begin the indexing of t at to parallel the indexing of a second on-line algorithm given in the next section. This second algorithm is called the Forward Algorithm because it uses a guess of the next loss when updating the parameter. The setup for the update in (4.1) does not seem truly on-line since it needs all the previous t examples. A truly on-line, yet equivalent setup, is given by the following lemma: LEMMA 4.1. For the Incremental O-line Algorithm and 1 t T , Proof: Note that since rU t ( t Thus, since U t ( t ) is a constant, the argmin for t+1 used in the denition (4.1) is the same as the argmin of the lemma. Q.E.D. We are now ready to show the key lemma for the Incremental O- line Algorithm. In this lemma we compare the total loss of the on-line algorithm to the total loss of any comparator , where the total loss of the comparator includes the divergence term U 0 (; 0 ). 14 K. S. Azoury and M. K. Warmuth LEMMA 4.2. For the Incremental O-line Algorithm, any sequence of T examples, and any 2 , U t+1 Proof: For 0 t T , we expand the divergence U t+1 (; t+1 ) and use rU t+1 ( t+1 This gives us U t+1 (; t+1 Since U t+1 For the special case of Subtracting (4.3) from (4.4) and applying U t () U t ( t (a version of (4.2)) gives By summing the above over all T trials we obtain: U The lemma now follows from the equality U 1 This equality follows from Property 6, because linear in . Q.E.D. To obtain relative loss bounds we choose the best o-line parameter B as the comparator and bound the right-hand-side of the equation of the lemma. Note that in case of the Incremental O-line Algorithm, and thus the last divergence on the right-hand-side is zero. The divergence U t+1 represents the cost of the update of t to t+1 incurred by the on-line algorithm. Relative loss bounds are bounds on the total cost of the on-line updates. Relative Loss Bounds 15 4.1. Incremental Off-line Algorithm for the Exponential Family We now apply the Incremental O-line Algorithm to the problem of density estimation for the exponential family of distributions. We rst give a general treatment and then prove relative loss bounds for specic members of the family in the subsections that follow. We make the most obvious choice for a loss function, namely, the negative log-likelihood. So using the general form of the log-likelihood (3.2), the loss of parameter on the example x t is For the purpose of the relative loss bounds (see Lemma 4.2) changing the loss by a constant that does not depend on is inconsequential. Thus, the form of the reference measure P 0 (x) is immaterial. As before, we allow the algorithm to have an initial parameter value at 0 and choose U 0 () as a multiple of the cumulant function, i.e., Thus, in the context of density estimation with the exponential family, the Incremental O-line Algorithm becomes where U t+1 Throughout the paper we use the notation 1 to denote trade-o parameters. This has two reasons. First, the inverse of the trade-o parameters will become the learning rates of the algorithms and learning rates are commonly denoted by . Also, we use 1 instead of 1=, because in linear regression the parameters are generalized to matrices. The setup (4.5) can be interpreted as nding a maximum a-posteriori (MAP) parameter where the divergence term corresponds to the conjugate prior and 1 is a hyper parameter. When 1 the divergence term disappears and we have maximum likelihood esti- mation. Alternatively one can think of 0 an initial parameter estimate based on some hypothetical examples seen before the rst real example 0 as the number of those examples. Also one can interpret the parameter 1 0 as a trade-o parameter between staying close to the initial parameter 0 and minimizing the loss on the t examples seen by the end of trial t. Yet another interpretation of (4.5) follows from rewriting U t+1 () as K. S. Azoury and M. K. Warmuth Thus, U t+1 () corresponds to the negative log-likelihood of an exponential density with the cumulant function ( 1 and the example is 1 We now develop the alternate on-line motivation given in Lemma 4.1. Let 1 is linear in , it follows from the properties of the divergences that U t Thus, the on-line motivation of Lemma 4.1 becomes Now the divergence measures the distance to the last parameter and the trade-o parameter is 1 The updated parameter t+1 can be obtained by minimizing U t+1 () (as dened in (4.5)) which is a strictly convex function in . The gradient of this function in terms of the expectation parameters is Setting the above to zero, for 0 t T , gives the update of the expectation parameter of the Incremental O-line Algorithm: For 1 t T , we can also express t+1 as a convex combination of t and the last instance x Note that t 1 Alternate recursive forms of the update, that are used later on, are (for 1 t T Thus, the on-line update may be seen as gradient descent with different learning rates. The update (4.9) uses the gradient of the loss at t+1 , while (4.10) uses the gradient of the loss evaluated at t . In the special case when 1 is not valid for which is consistent with updates (4.8) and (4.10). Relative Loss Bounds 17 The relative loss bounds are proven by using Lemma 4.2. Thus, for density estimation this equality simplies to: The following lemma gives a concise expression for the minimum of U t+1 () (see (4.5)) in terms of the dual of the cumulant function. This lemma and the following discussion is interesting in its own right. Although it is not essential for the main development of this paper, we will use it in the Bernoulli example discussed later. By combining (4.11) with this lemma one can also get an expression for the total loss of the on-line algorithm (Lemma 3.1 of (AW99)). LEMMA 4.3. min Proof: We rewrite the right-hand-side of the equality of the lemma using the denition of the dual function F () (3.6) and the expression We rewrite the above using 1 and the denitions of the loss and divergence: The above is equal to U t+1 ( t+1 ). Q.E.D. When 1 (the case of maximum likelihood), the above can be rewritten as: K. S. Azoury and M. K. Warmuth where Thus, essentially the inmum of the average loss on the data equals the expected loss at the parameter that minimizes the average loss, i.e., the maximum likelihood parameter. The above relationship was used in (Gru98). In the remaining subsections we discuss specic examples and give their relative loss bounds. 4.1.1. Density Estimation with a Gaussian Here we derive relative loss bounds for the Gaussian density estimation problem. Consider a Gaussian density over R d with a known and xed Without loss of generality, we will develop the bounds for the special case when is the identity matrix. Similar bounds immediately follow for the general case of xed but arbitrary variance-covariance matrix by a linear transformation argument. The Gaussian density with the identity matrix as the variance-covariance matrix is (Here, x 2 is shorthand for x x.) This density is a member of the exponential family with natural parameter : Cumulant Parameter transformations: functions). Dual convex function: F Loss: L t const. Note that the constant in the loss is immaterial for the bounds and therefore, we set it to zero. For the sake of simplicity, set 2. Recall that for the Incremental O-line Update, with the dierence between the total loss of the Incremental O-line Algorithm and the o-line algorithm is Relative Loss Bounds 19 We use the on-line updates (e.g. (4.9), (4.10)) to rewrite the divergences on the right-hand-side: We want to allow 1 In this case, update (4.9) cannot be applied 1. However, by update (4.8), we have that for any 1 1 , for any 1 (4.12) can rewritten as follows: It is easy to nd two examples x 1 and x 2 for which the dierence (4.14) depends on the order in which the two examples are presented. We now develop an upper bound that is permutation invariant, i.e., it does not depend on order in which the examples are presented. We drop the negative terms from (4.14), use Since we obtain the following relative loss bound: K. S. Azoury and M. K. Warmuth THEOREM 4.4. For Gaussian density estimation with the Incremental O-line Algorithm and t . Note that in the special case when 1 then the o-line algorithm chooses a maximum likelihood parameter and the above bound simplies to 1 4.1.2. Density Estimation with a Gamma Here we give the relative loss bounds for the Gamma distribution. The density with shape parameter and inverse scale parameter is This is a member of the exponential family with natural parameter the density above in terms of can be written as We assume is known and xed. The parameter scales the loss and the divergences. The inverse of is called the dispersion parameter. So for the sake of simplicity we drop just as we ignored the xed variance in the case of Gaussian density estimation. Cumulant Parameter transformations: Dual convex function: F Loss: L t We bound the divergence between t and t+1 , which leads to a relative loss bound for the Incremental O-line Algorithm (see (4.11)): (4. Relative Loss Bounds 21 Using the update (4.10) and the notation r because the t are convex combinations of the elements of fx g. If 1 then the sum of the divergences on the right-hand-side of (4.11) can be bounded by In summary we have the following relative loss bound: THEOREM 4.5. For density estimation with a Gamma distribution using the Incremental O-line Algorithm and 1 Better relative loss bounds that include the case when 1 be possible by bounding (4.15) more carefully. 4.1.3. Density Estimation for the General Exponential Family Here we give a brief discussion of the form the bounds take for any member of the exponential family. We rewrite the divergence between After doing a second order Taylor expansion of F ( t+1 ) at t , this last =e t =e t 22 K. S. Azoury and M. K. Warmuth where e t is a convex combination of t and t+1 . If r 2 F () is constant then we essentially have a Gaussian. The general case may be seen as a local Gaussian with the time-varying curvature. Any reasonable methods have to proceed on a case-by-case basis (Mor82; GPS95) based on the form of r 2 F (), which is the inverse of the variance function. Recall that summing the last term should always give a log(T )-style bound. Sometimes the range of the x t needs to be restricted as done in the previous subsections for density estimation with Gaussian and Gamma distributions. 4.1.4. Linear Regression In this subsection the bounds for linear regression are developed. Here the instance domain X is R d and the label domain Y is R. The parameter domain is also R d and the d components of the parameter vectors 2 are the d linear weights. For a given example parameter vector , the linear model predicts with x t . The square loss is used to measure the discrepancy between the prediction and the label for that example. Note that L t () is not strictly convex in . Thus, we make U 0 () strictly convex so that the initial divergence U 0 strictly convex and our updates always have a unique solution. We use U positive denite matrix. Now the divergence to the initial parameter becomes U 0 (; 0 Thus, for linear regression, the update (4.1) of the Incremental O-line Update becomes: where U t+1 Note that we use the transpose notation x 0 q instead of the dot product because the subsequent derivations will use matrix algebra. The above setup for linear regression is usually interpreted as a conditional density estimation problem for a Gaussian label y t given x t , where the cumulant function in trial t is 1 and the divergence corresponds to a Gaussian prior on . Again we develop the alternate on-line version of (4.16) as done in general in Lemma 4.1. Since U t () equals 1 linear terms, the on-line version becomes Relative Loss Bounds 23 By dierentiating (4.16) for 0 t T , we obtain the Incremental O-line Update for linear regression: This is the standard linear least squares update. It is easy to derive the following recursive versions (for 1 t T Note the correspondence of the above updates to the updates (4.7- 4.10) for density estimation. Also Lemma 4.2 becomes the following quadratic equation (See (4.11) for the corresponding equation in density We now reprove a bound obtained by Vovk (Vov97) for the Incremental O-line Algorithm. (For the sake of simplicity we choose 1 0 as a multiple of the identity matrix I.) A similar bound was proven by Foster for the same algorithm. However, he assumes that the comparator is a probability vector (Fos91). THEOREM 4.6. For linear regression with the Incremental O-line Algorithm and 1 a Tg. Note that this theorem assumes that the predictions x 0 of the labels y t at trial t lie in [ Y; Y ]. If this assumption is not satised, we might use clipping, i.e., the algorithm predicts with the number in [-Y,Y] that is closest to x 0 clipping requires the algorithm to know Y . K. S. Azoury and M. K. Warmuth There is little incentive to work out the details for the Incremental O- line Algorithm because for the algorithm of the next section we can prove a better relative loss bound and the predictions don't need to lie in [ Y; Y ]. Proof: We apply the Update (4.19) twice to the divergence in the sum of the right-hand-side of (4.20). This give the rst two equalities below. The third equality follows from Lemma A.1 of the appendix.2 ( t t+1 In the last inequality we used the assumption that x 0 the fact that z 1 ln z. Note that the last inequality may not hold without the assumption x 0 The theorem now follows from applying these crude approximations to the equality of Lemma (4.2): d a a The last inequality follows from the assumption that x q;i X 2 . The second to last inequality follows from the fact that 1 aI and that the determinant of a symmetric matrix is at most the product of the diagonal elements (See (BB65), Chapter 2, Theorem 7). Q.E.D. Ideally we don't want to use this crude bounding method. The goal is to rewrite the sum of divergences so that further telescoping occurs. For the Incremental On-line Update we have not been able to do that. Below is a partial attempt that follows what we did for Gaussian density Relative Loss Bounds 25 estimation (4.13).2 ( t t+1 In the last equality we use the fact that t 1 is symmetric. Note that the last two terms in the nal expression do not telescope as they did for the Gaussian case (4.13). Surprisingly, for the Forward Algorithm that will be introduced in the next section, the corresponding two terms do telescope. Thus, for Forward Algorithm, one can prove a bound as the one given in Theorem 4.6 except that the last term in the bound is now 1 a 1), a quarter of what it was in Theorem 4.6. In the related problem for density estimation with a Gaussian, the corresponding improved bound (with factor 1 holds for the Incremental O-line Algorithm. 5. Estimating the Future Loss - the Forward algorithm In this section we present our second algorithm called the Forward Algorithm and give some lemmas that are used for proving relative loss bounds. In trial t, the Forward Algorithm expects to see the next example and we allow it to incorporate an estimate of the loss on this next example when choosing its parameter. In regression, \part" of the example, namely the instance x t , is available at trial t before the algorithm must commit itself to a parameter t . So the algorithm can use the instance x t to form an estimate ^ of the loss at trial t. As we shall see in linear regression, incorporating such an estimate in the motivation can be used to include the current instance into the learning rate of the algorithm and this leads to better relative loss bounds. In density estimation, however, there are no instances, yet the algorithm still uses an estimate of the future loss. 26 K. S. Azoury and M. K. Warmuth On-line protocol of the Forward Algorithm Regression: Density estimation: Initial hypothesis is 0 . Initial hypothesis is 0 . For to T do For to T do Get instance x t . :::::::::::: Guess loss on t-th example. Guess loss on t-th example. Update hypothesis t 1 to t . Update hypothesis t 1 to t . Predict with t . Predict with t . Get label y t of t-th example. Get example x t . Incur loss L Incur loss L We now dene the update analogous to the previous section by minimizing a sum of a divergence plus the losses in the past t trials and an estimate of the loss ^ in the next trial. The Forward Algorithm where U t+1 Assumption: The losses L t () (for 1 t T ), the estimated losses are dierentiable and convex functions from the parameter space to the reals. Furthermore, we assume that the argmin U t+1 () (for 1 t T ) always have a solution in . Note that the Incremental O-line Algorithm is a special case of the Forward Algorithm where all the estimated losses ^ are zero. As before there is an alternate on-line motivation of the update using a divergence to the last parameter vector. LEMMA 5.1. For the Forward Algorithm and 1 t T , U we can rewrite the argument of the argmin as: Relative Loss Bounds 27 Thus, since U t ( t ) is a constant, the argmin for t+1 used in the denition (5.1) is the same as the argmin of the lemma. Q.E.D. The following key lemma is a generalization of Lemma 4.2 for the Incremental O-line Algorithm. LEMMA 5.2. For the Forward Algorithm, any sequence of T examples and any 2 , U t+1 Proof: For 0 t T , we expand the divergence U t+1 (; t+1 ) and use rU t+1 ( t+1 As in the proof of Lemma 4.2, this gives us U t+1 (; t+1 Since U t+1 obtain For the special case of Subtracting (5.3) from (5.4) and applying U t () U t ( t (a version of (5.2)), we obtain U t+1 The equation of the lemma follows by summing the above over all T trials and subtracting U 0 sides. Q.E.D. Any relative loss bound for the Forward Algorithm must be based on bounding the right-hand-side of this lemma. 5.1. Density Estimation with the Exponential Family Here we apply the Forward Algorithm to the problem of density estimation with the exponential family of distributions. We choose U 0 28 K. S. Azoury and M. K. Warmuth 0 G() as done for the Incremental O-line Algorithm. Thus, the initial divergence becomes U 0 For the estimated future loss we use ^ const. This may be seen as the average loss of a number of examples for which ( lies in the instance domain, then 0 can be seen as a guess for the future instance with the corresponding loss being (). The estimated loss ^ we rewritten as G (; const. Thus, with the above choices, the Forward Algorithm (5.1) becomes the following (for where U t+1 This is the same as the Incremental O-line Algorithm (4.5) except that the trade-o parameter is now 1 0 . For 1 t T , the on-line motivation becomes This is the same as the on-line motivation of the Incremental O- line Algorithm (4.6) except that 1 t 1 is increased by one to 1 t . The updates (4.7-4.10) and Lemma 4.3 remain the same but the learning rates are shifted: The above updates hold for 1 t T . The rst one holds for well which shows that our choice of the estimate ^ Since the estimated loss is independent of the trial, the estimated losses in the last equality of Lemma 5.2 cancel and we get: Relative Loss Bounds 29 5.2. Density Estimation with a Gaussian In this section, we give a bound for the Forward Algorithm that is better than the corresponding bound for the Incremental O-line Al- gorithm. Following the same steps as in (4.13), we simplify the following divergence: Using this, (5.9) becomes We now set 0 (and thus 1 ) to zero and choose T+1 . Thus, the last three terms of the above equation can be rewritten as:2 2 0: (5.11) Equation (5.10) is bounded by2 X 2 THEOREM 5.3. For Gaussian density estimation with the Forward Algorithm and t . K. S. Azoury and M. K. Warmuth Note that the above bound for the Forward Algorithm is better than the bound for the Incremental O-line algorithm (See Theorem 4.4). The improvement is essentially 2X 2 . 5.3. Density Estimation with a Bernoulli In this subsection we give the relative loss bounds for the Bernoulli distribution. Here the examples x t are coin ips in f0; 1g and the distribution is typically expressed as P is the probability of 1. Let 1 . So the distribution in terms of is This is a member of the exponential family with natural parameter . Cumulant Parameter transformations: 1+e and Dual function: F Loss: L t Consider the Forward Algorithm with 1 In this case (maximum likelihood) and the Forward Algorithm uses t+1 =2 t+1 . We rst develop a concise expression for the total loss of the algorithm. LEMMA 5.4. For Bernoulli density estimation with the Forward Algorithm Y Proof: We rst rewrite the loss at trial t in various ways. Let s t abbreviate We now develop a formula for Note that in all trials t in which x increases by one), the loss L contains the Relative Loss Bounds 31 term ln(s t2 ). Over all T trials, these terms contribute Similarly, in all trials t in which x by one), the loss L contains the term ln(t s t2 ). Over all T trials, these terms contribute From this and the fact that the lemma follows. Q.E.D. Note that the right-hand-side of the expression of the lemma is independent of the order in which the examples were seen. Thus, for Bernoulli distribution, the total loss of the forward algorithm is permutation invariant. By Lemma 4.3, L 1::T and thus Y An equivalent expression using the Gamma function was rst derived by Freund (Fre96) based on the Laplace method of integration. Using the standard approximations of the Gamma function one can bound the right-hand-side of the above by 1 THEOREM 5.5. (Fre96) For Bernoulli density estimation with the Forward Algorithm and 5.4. Linear Regression In this subsection we derive relative loss bounds for the Forward Algorithm when applied to linear regression. As for the Incremental O-line Algorithm, we let U 0 positive denite. The divergence to the initial 0 is again U We use the estimated future loss ^ i.e., the next label y t+1 is guessed as x 0 the Forward Update (5.1) for linear regression becomes: K. S. Azoury and M. K. Warmuth where U t+1 With this denition, U 1 (; 0 is minimized at 0 , and thus dierentiating U t+1 (), we obtain the Forward Update for linear regression (0 t T where Note that t+1 depends on x t+1 . Thus, the Forward Algorithm is different from the Incremental O-line Algorithm (4.17) in that it uses the current instance to form its prediction. For the sake of simplicity we assume for the rest of this section that Recursive versions of the above update are the following We now rewrite the equality of Lemma 5.2 for linear regression. Following the same steps we used for the Incremental O-line Algorithm (4.22) we Relative Loss Bounds 33 Using the above, the argument of the sum on the right-hand-side of Equation (5.15) can be simplied as Note that the last two terms telescope. In the corresponding derivation for the Incremental O-line Update, the last two terms did not telescope (4.22). So now (5.15) with As in Gaussian density estimation (5.10), we will now show that the last three terms of the above equation are zero. First we rewrite B as: where I is the identity matrix. The last term becomes:2 The second to last term simplies to:2 ( T x T+1 x 0 We now sum the last three terms while pulling out the factor 1 34 K. S. Azoury and M. K. Warmuth Thus, the last three terms are zero just as they were for Gaussian density estimation with the Forward algorithm (5.11). Finally, we can use the upper bound (see Theorem 4.6)2 y 2 t . Now the sums on the right-hand-side of (5.16) can be bounded by 1 a ). We now summarize the relative loss bound we proved for the Forward Algorithm: THEOREM 5.6. For linear regression with the Forward Algorithm and a t . Note the above bound for the Forward algorithm is better than the corresponding bound for the Incremental O-line Algorithm (See Theorem 4.6). The improvement is by a factor of four. The above bound was rst proven by Vovk (Vov97) using integration. An alternate proof for the exact expression (5.17) was given by Forster (For99). 6. Relationship to the Bayes' Algorithm There is an alternate method pioneered by Vovk (Vov97), Freund and Yamanishi (Yam98) for proving relative loss bounds. In this section we sketch this method and compare it to ours. A distribution is maintained on the set of parameters . The parameters can be names of algorithms and are called experts in the on-line learning literature 97). The initial work only considered the case when is nite However, the method can also be applied when is continuous Yam98). At the beginning of trial Relative Loss Bounds 35 t, the distribution on has the form R e where P 1 is a prior and > 0 a learning rate. The following type of inequality is the main part of the method: Z Z Z Here LA (t) denotes the loss of the algorithm at trial t. An important special case occurs when when and the loss L q () is a negative log-likelihood with respect to a parameterized density, i.e., We call this the Bayes' Algorithm. In this case, P t as given in (6.1) is the posterior distribution after seeing the rst examples. If the algorithm in trial t predicts with the predictive distribution then (6.2) is an equality (DMW88). In the more general setting (when 6= 1 and the losses are not necessarily negative log-likelihoods), the prediction of the algorithm is chosen so that inequality (6.2) holds no matter what the t-th example will be. Also, the larger the learning rate , the better the resulting relative loss bounds. The learning rate is chosen as large as possible so that a prediction is always guaranteed to exist for which inequality (6.2) holds. The same learning rate is used in all T trials. The inequality is often tight when the examples lie on the boundary of the set of possible examples. By summing the inequality (6.2) over all trials, one gets the bound Z If the above integral cannot be computed exactly, then it is bounded using Laplace's method of integration around the best o-line parameter We would like to point out the following distinction between the above method and the algorithms presented in this paper. The prediction of the Bayes' Algorithm (i.e., the predictive distribution) is usually not represented by a parameter (or expert) in . Instead, the algorithms analyzed in this paper chooses a MAP parameter in in each trial. In the case of the Bernoulli distribution, the Bayes' Algorithm based on Jerey's prior coincides with the Forward 36 K. S. Azoury and M. K. Warmuth Algorithm when 1 (Section 5.3). Similarly, in the case of linear regression with the Gaussian prior, Vovk's algorithm (Vov97) coincides with the Forward Algorithm for linear regression (Section 5.4). However, it is not clear that for other density estimation problems in the exponential family the predictions of the Bayes' Algorithm (or the algorithms produced by for the more general case when 6= 1) are represented by parameters in the parameter space. In contrast, our method of proving relative loss bounds avoids the use of the involved integration methods needed for (6.3) CO96). The parameter we maintain is based on a simple average of the past examples, which is a su-cient statistic for the exponential family. 7. Conclusion In this paper, we presented techniques for proving relative loss bound for density estimation with the exponential family. We gave a number of examples of how to apply our methods, including the case of linear regression. For an exponential density with cumulant function G, we use the Bregman divergence G ( e as the measure of distances between the parameters e and . Thus, the loss L divergence are based on the same function G. However, lemmas 4.2 and 5.2 and the methodology for proving relative loss bounds are more general in that the initial divergence and the loss do not need to be related. These lemmas might be further extended to non-dierentiable convex functions using the generalized notion of Bregman divergences that was introduced by Gordon (Gor99). The parameters maintained by our algorithms are invariant to permuting the past examples. However, the total on-line loss of the algorithms is not permutation invariant. Therefore, an adversary could use this fact and present the examples in an order disadvantageous to the learning algorithm. This suggests that there are algorithms with better relative loss bounds. The Incremental O-line Algorithm and the Forward Algorithm are incomparable in the sense that either one may have a larger total loss. However, we believe that in some sense the Forward Algorithm is better and this needs to be formalized. This belief is inspired by the phenomenon of the Stein estimator in statistics (Ste56), since like the Stein estimator, the Forward Update uses a shrinkage factor when compared to the Incremental O-line Update. We still need to explore how the bounds obtained in this paper relate to the large body of research from the Minimum Description Length Relative Loss Bounds 37 literature (Ris89; Ris96). In this literature, lower and upper bounds on the relative loss of the form d explored extensively, where d is the number of parameters. However, in contrast to the setup used in this paper, the work in the Minimum Description Length literature does not require that the algorithm predicts with a parameter in the parameter space. The methodology developed in this paper for proving relative loss bounds still needs to be worked out for more learning problems. For instance, is there always a log(T )-style relative loss bound for any member of the exponential family (See Section 4.1.3). Another open problem is to prove log(T )-style bounds for logistic regression? Finally, lower bounds on the relative loss need to explored for the case when the algorithm is restricted to predict with a parameter in the parameter space. Such bounds have been shown for linear regression (Vov97). In particular, it was proven that the constant before ln(T ) in the relative loss bound of the Forward Algorithm (Theorem 5.6) is tight. However, no general log(T )-style lower bounds is known for an arbitrary member of the exponential family. Acknowledgments Thanks to Leonid Gurvitz for introducing us to Bregman divergences, and to Claudio Gentile, Peter Grunwald, Georey Gordon, Eiji Taki- moto, and two anonymous referees for many valuable comments. --R Exponentially many local minima for single neurons. Relative loss bounds for on-line density estimation with the exponential family of distributions An analog of the minimax theorem for vector payo The relaxation method of An iterative row-action method for interval convex pro- gramming Universal portfolios with side information. Universal portfolios. Why least squares and maximum entropy? Learning probabilistic prediction functions. Prediction in the worst case. Predicting a binary sequence almost as well as the optimal biased coin. General convergence results for linear discriminant updates. Technical report CMU-CS-99-143 The Minimum Discription Length Principle and reasoning under uncertainty. Approximation to Bayes risk in repeated play Learning algorithms for tracking changing concepts and an investigation into the error surfaces of single arti Sequential prediction of individual sequences under general loss functions. Tracking the best regressor. Conf. on Comput. Additive versus exponentiated gradient updates for linear prediction. Relative loss bounds for multidimensional regression problems. Learning when irrelevant attributes abound: A new linear-threshold algorithm Journal of Computational Complexity The weighted majority algorithm. Generalized Linear Models. Natural exponential families with quadratic variance functions. Stochastic Complexity in Statistical Inquiry Fisher information and stochastic complexity. Convex Analysis. Inadmissibility of the usual estimator for the mean of a multivariate normal distribution. Asymptotically minimax regret for exponential families. In Asymptotically minimax regret by Bayes mixtures. Aggregating strategies. Competitive on-line linear regression Continuous and discrete time nonlinear gradient descent: relative loss bounds and convergence. Minimax redundancy for the class of memoryless sources. IEEE Transactions on Information Theory A decision-theoretic extension of stochastic complexity and its applications to learning --TR --CTR Arindam Banerjee , Inderjit Dhillon , Joydeep Ghosh , Srujana Merugu, An information theoretic analysis of maximum likelihood mixture estimation for exponential families, Proceedings of the twenty-first international conference on Machine learning, p.8, July 04-08, 2004, Banff, Alberta, Canada Shai Shalev-Shwartz , Yoram Singer, A primal-dual perspective of online learning algorithms, Machine Learning, v.69 n.2-3, p.115-142, December 2007 Jrgen Forster , Manfred K. Warmuth, Relative Loss Bounds for Temporal-Difference Learning, Machine Learning, v.51 n.1, p.23-50, April Srujana Merugu , Joydeep Ghosh, A privacy-sensitive approach to distributed clustering, Pattern Recognition Letters, v.26 n.4, p.399-410, March 2005 S. V.N. Vishwanathan , Nicol N. Schraudolph , Alex J. Smola, Step Size Adaptation in Reproducing Kernel Hilbert Space, The Journal of Machine Learning Research, 7, p.1107-1133, 12/1/2006 Nicol Cesa-Bianchi , Claudio Gentile , Luca Zaniboni, Worst-Case Analysis of Selective Sampling for Linear Classification, The Journal of Machine Learning Research, 7, p.1205-1230, 12/1/2006 Claudio Gentile, The Robustness of the p-Norm Algorithms, Machine Learning, v.53 n.3, p.265-299, December Arindam Banerjee , Srujana Merugu , Inderjit S. Dhillon , Joydeep Ghosh, Clustering with Bregman Divergences, The Journal of Machine Learning Research, 6, p.1705-1749, 12/1/2005 Mark Herbster , Manfred K. Warmuth, Tracking the best linear predictor, The Journal of Machine Learning Research, 1, p.281-309, 9/1/2001
bregman divergences;relative loss bounds;worst-case loss bounds;linear regression;exponential family of distributions;on-line algorithms
599656
Linear Programming Boosting via Column Generation.
We examine linear program (LP) approaches to boosting and demonstrate their efficient solution using LPBoost, a column generation based simplex method. We formulate the problem as if all possible weak hypotheses had already been generated. The labels produced by the weak hypotheses become the new feature space of the problem. The boosting task becomes to construct a learning function in the label space that minimizes misclassification error and maximizes the soft margin. We prove that for classification, minimizing the 1-norm soft margin error function directly optimizes a generalization error bound. The equivalent linear program can be efficiently solved using column generation techniques developed for large-scale optimization problems. The resulting LPBoost algorithm can be used to solve any LP boosting formulation by iteratively optimizing the dual misclassification costs in a restricted LP and dynamically generating weak hypotheses to make new LP columns. We provide algorithms for soft margin classification, confidence-rated, and regression boosting problems. Unlike gradient boosting algorithms, which may converge in the limit only, LPBoost converges in a finite number of iterations to a global solution satisfying mathematically well-defined optimality conditions. The optimal solutions of LPBoost are very sparse in contrast with gradient based methods. Computationally, LPBoost is competitive in quality and computational cost to AdaBoost.
Introduction Recent papers [16] have shown that boosting, arcing, and related ensemble methods (hereafter summarized as boosting) can be viewed as margin maximization in function space. By changing the cost function, di#erent boosting methods such as AdaBoost can be viewed as gradient descent to minimize this cost function. Some authors have noted the possibility of choosing cost functions that can be formulated as linear programs (LP) but then dismiss the approach as intractable using standard LP algorithms [14, 6]. In this paper we show that LP boosting is computationally feasible using a classic column generation simplex algorithm [11]. This method performs tractable boosting using any cost function expressible as an LP. We specifically examine the variations of the 1-norm soft margin cost function used for support vector machines [15, 3, 9]. One advantage of these approaches is that immediately the method of analysis for support vector machine problems becomes applicable to the boosting problem. In Section 2, we prove that the LPBoost approach to classification directly minimizes a bound on the generalization error. We can adapt the LP formulations developed for support vector machines. In Section 3, we discuss the soft margin LP formulation. By adopting linear programming, we immediately have the tools of mathematical programming at our disposal. By use of duality theory and optimality conditions, we can gain insight into how LP boosting works mathematically. In Section 4 we examine how column generation approaches for solving large scale LPs can be adapted to boosting. For classification, we examine both standard and confidence-rated boosting. Standard boosting algorithms use weak learners that are classifiers, that is, whose outputs are in the set {-1, +1}. Schapire and Singer [17] have considered boosting weak learners whose outputs reflected not only a classification but also an associated confidence encoded by a value in the range [-1, +1]. They demonstrate that so-called confidence-rated boosting can speed convergence of the composite classifier, though the accuracy in the long term was not found to be significantly a#ected. In Section 5, we discuss the minor modifications needed for LPBoost to perform confidence-rated boosting. The methods we develop can be readily extended to any boosting problem formulated as an LP. We demonstrate this by adapting the approach to regression in Section 6. Computational results and practical issues for implementation of the method are given in Section 7. Motivation for Soft Margin Boosting We begin with an analysis of the boosting problem using methodology developed for support vector machines. The function classes that we will be considering are of the form a set of weak learners which we assume is closed under complementation. Initially, these will be classification functions with outputs in the set {-1, 1}, though this can be taken as [-1, 1] in confidence-rated boosting. We begin, however, by looking at a general function class and quoting a bound on the generalization error in terms of the margin and covering numbers. We first introduce some notation. If D is a distribution on inputs and targets, X -1, 1}, we define the error err D (f) of a function f # F to be the probability we assume that we obtain a classification function by thresholding at 0 if f is real-valued. Definition 2.1. Let F be a class of real-valued functions on a domain X. A #-cover of F with respect to a sequence of inputs set of functions A such that for all f # F, there exists #. The size of the smallest such cover is denoted by N(F, S, #), while the covering numbers of F are the values N(F, S, #). In the remainder of this section we will assume a training set . For a real-valued function f # F we define the margin of an example (x, y) to be yf(x), where again we implicitly assume that we are thresholding at 0. The margin of the training set S is defined to be m S Note that this quantity is positive if the function correctly classifies all of the training examples. The following theorem is given in [8] but it is implicit in the results of [18]. Theorem 2.1. Consider thresholding a real-valued function space F and fix # R + . For any probability distribution D on X -1, 1}, with probability 1 - # over m random examples S, any hypothesis f # F that has margin m S (f) # on S has error no more than err D (f) #(m, F, # log N(F, 2m, #) We now describe a construction originally proposed in [19] for applying this result to cases where not all the points attain the margin #. Let X be a Hilbert space. We define the following inner product space derived from X. Definition 2.2. Let L(X) be the set of real-valued functions f on X with countable support supp(f), that is, functions in L(X) are non-zero only for countably many points. Formally, we require countable and We define the inner product of two functions f, g # L(X) by #f - g# x#supp(f) f(x)g(x). This implicitly defines a norm # 2 . We also introduce |f(x)|. Note that the sum that defines the inner product is well-defined by the Cauchy-Schwarz inequality. Clearly the space is closed under addition and multiplication by scalars. Furthermore, the inner product is linear in both arguments. We now form the product space X - L(X) with the corresponding function class F - L(X) acting on via the composition rule Now for any fixed 1 # > 0 we define an embedding of X into the product space X - L(X) as follows: where # x # L(X) is defined by # x Definition 2.3. Consider using a class F of real-valued functions on an input space X for classification by thresholding at 0. We define the margin slack variable of an example with respect to a function f # F and target margin # to be the quantity # ((x i , y that # i > # implies incorrect classification of The construction of the space X-L(X) allows us to obtain a margin separation of # by using an auxiliary function defined in terms of the margin slack variables. For a function f and target margin # the auxiliary function with respect to the training set S is It is now a simple calculation to check the following two properties of the function (f, 1. (f, g f ) has margin # on the training set # (S). 2. (f, g f )# Together these facts imply that the generalization error of f can be assessed by applying the large margin theorem to (f, g f ). This gives the following theorem: Theorem 2.2. Consider thresholding a real-valued function space F on the domain X. Fix choose G # F - L(X). For any probability distribution D on X -1, 1}, with probability random examples S, any hypothesis f # F for which (f, g f ) # G has generalization error no more than err D (f) #(m, F, #) =m # log N(G, 2m, #) 2/#, and there is no discrete probability on misclassified training points. We are now in a position to apply these results to our function class which will be in the form described we have left open for the time being what the class H of learners might contain. The sets G of Theorem 2.2 will be chosen as follows: a h h, g # Hence, the condition that a function satisfies the conditions of Theorem 2.2 for simply (1) Note that this will be the quantity that we will minimize through the boosting iterations described in later sections, where we will use the parameter C in place of 1/# and the margin # will be set to 1. The final piece of the puzzle that we require to apply Theorem 2.2 is a bound on the covering numbers of GB in terms of the class of weak learners H, the bound B, and the margin #. Before launching into this analysis, observe that for any input x, 2.1 Covering Numbers of Convex Hulls In this subsection we analyze the covering numbers N(GB , m, #) of the set a h h, g # in terms of B, the class H, and the scale #. Assume first that we have an #/B-cover G of the function class H with respect to the set is a class of binary-valued functions then we will take # to be zero and G will be the set of dichotomies that can be realized by the class. Now consider the set V of vectors of positive real numbers indexed by G # {1, . , m}. Let VB be the function class suppose that U be an (# -cover of VB . We claim that the set is a #-cover of GB with respect to the set # (S). We prove this assertion by taking a general function h, g # GB , and finding a function in A within # of it on all of the points # (x i ). First, for each h with non-zero coe#cient a h , select - h # G, such that #h(x i m. Now we form the function - which lies in the set VB , since # h#G a h Furthermore we have that Since U is a # cover of VB there exists - v # U such that - f on # It follows that - f is within # of f on this same set. Hence, A forms a # cover of the class GB . We bound |A| = |U | using the following theorem due to [20], though a slightly weaker version can also be found in [1]. Theorem 2.3. [20] For the class VB defined above we have that log N(VB , m, log Hence we see that optimizing B directly optimizes the relevant covering number bound and hence the generalization bound given in Theorem 2.2 with . Note that in the cases considered |G| is just the growth function BH (m) of the class H of weak learners. Boosting LP for Classification From the above discussion we can see that a soft margin cost function should be valuable for boosting classification functions. Once again using the techniques used in support vector machines, we can formulate this problem as a linear program. The quantity B defined in Equation (1) can be optimized directly using an LP. The LP is formulated as if all possible labelings of the training data by the weak learners were known. The LP minimizes the 1-norm soft margin cost function used in support vector machines with the added restrictions that all the weights are positive and the threshold is assumed to be zero. This LP and variants can be practically solved using a column generation approach. Weak learners are generated as needed to produce the optimal support vector machine based on the output of the all weak learners. In essence the base learner become an 'oracle' that generates the necessary columns. The dual variables of the linear program provide the misclassification costs needed by the learning machine. The column generation procedure searches for the best possible misclassification costs in dual space. Only at optimality is the actual ensemble of weak learners constructed. 3.1 Let the matrix H be a m by n matrix of all the possible labelings of the training data using functions from is the label (1 or - 1) given by weak learner h j # H on the training point x i . Each column H .j of the matrix H constitutes the output of weak learner h j on the training data, while each row H i gives the outputs of all the weak learners on the example x i . There may be up to 2 m distinct weak learners. The following linear program can be used to minimize the quantity in Equation (1): min a,# n a (2) where C > 0 is the tradeo# parameter between misclassification error and margin maximization. The dual of LP (2) is Alternative soft margin LP formulations exist, such as this one for the #-LP Boosting 1 . [14]: a a We remove the constraint # 0 since # > 0 at optimality under the complementation assumption. The dual of this LP (4) is: min u,# These LP formulations are exactly equivalent given the appropriate choice of the parameters C and D. Proofs of this fact can be found in [15, 5] so we only state the theorem here. Theorem 3.1 (LP Formulation Equivalence). If LP (4) with parameter D has a primal solution (-a, - #) and dual solution (-u, - #), then are the primal and dual solutions of LP (2) with parameter . Similarly, if LP 2 with parameter C has primal solution (-a #) and dual solution a- #) and ( - #) are the primal and dual solutions of LP (4) with parameter #. Practically we found #-LP (4) with m# preferable because of the interpretability of the parameter. A more extensive discussion and development of these characteristics for SVM classification can be found in [15]. To maintain dual feasibility, the parameter # must maintain 1 <= D <= 1. By picking # appropriately we can force the minimum number of support vectors. We know that the number of support vectors will be the number of points misclassified plus the points on the margin, and this was used as a heuristic for choice of #. The reader should consult [14, 15] for a more in-depth analysis of this family of cost functions. 3.2 Properties of LP formulation We now examine the characteristics of LP (4) and its optimality conditions to gain insight into the properties of LP Boosting. This will be useful in understanding both the e#ects of the choice of parameters in the model and the performance of the eventual algorithm. The optimality conditions [11] of LP (4) are primal feasibility: a dual feasibility: and complementarity here stated as equality of the primal and dual objectives: Complementarity can be expressed using many equivalent formulations. For example, from the complementarity property, the following equations hold: a As in SVM, the optimality conditions tell us many things. First we can characterize the set of base learners that are positively weighted in the optimal ensemble. Recall that the primal variables a i multiply each base learner. The dual LP assigns misclassification costs u i to each point such that the u i sum to 1. The dual constraint # m "scores" each weak learner h .j . The score is the weighted sum of the correctly classified points minus the weighted sum of the incorrectly classified points. The weak learners with lower scores have greater weighted misclassification costs. The formulation is pessimistic in some sense. The set of best weak learners for a given u will all have a score of #. The dual objective minimizes # so the optimal misclassification cost u will be the most pessimistic one, i.e., it minimizes the maximum score over all the learners. From the complementary slackness condition, a the weak learners with scores equal to # can have positive weights a j in the primal space. So the resulting ensemble will be a linear combination of the weak learners that perform best under the most pessimistic choice of misclassification costs. This interpretation closely corresponds to the game strategy approach of [6] (which is also a LP boosting formulation solvable by LPBoost.) A notable di#erence is that LP (5) has an additional upper bound on the misclassification costs u, 0 # that is produced by the introduction of the soft margin in the primal. From SVM research, we know that both the primal and dual solutions will be sparse and the degree of sparsity will be greatly influenced by the choice of parameter . The size of the dual feasible region depends on our choice of #. If # is too large, forcing D small, then the dual problem is infeasible. For large but still feasible # (D very small but still feasible), the problem degrades to something very close to the equal-cost case, u All the u i are forced to be nonzero. Practically, this means that as # increases, the optimal solution is frequently a single weak learner that is best assuming equal costs. As # decreases (D grows), the misclassification costs, u i , will increase for hard-to-classify points or points on the margin in the label space and will go to 0 for points that are easy to classify. Thus the misclassification costs u become sparser. If # is too small (and D too large) then the meaningless null solution, a = 0, with all points classified as one class, becomes optimal. For a good choice of #, a sparse solution for the primal ensemble weights a will be optimal. This implies that few weak learners will be used. Also a sparse dual u will be optimal. This means that the solution will be dependent only on a smaller subset of data (the support vectors.) Data with are well-classified with su#cient margin, so the performance on these data is not critical. From LP sensitivity analysis, we know that the u i are exactly the sensitivity of the optimal solution to small perturbations in the margin. In some sense the sparseness of u is good because the weak learners can be constructed using only smaller subsets of the data. But as we will see in Section 7, this sparseness of the misclassification costs can lead to problems when practically implementing algorithms. LPBoost Algorithms We now examine practical algorithms for solving the LP (4). Since the matrix H has a very large number of columns, prior authors have dismissed the idea of solving LP formulations for boosting as being intractable using standard LP techniques. But column generation techniques for solving such LPs have existed since the 1950s and can be found in LP text books; see for example [11, Section 7.4]. Column generation is frequently used in large-scale integer and linear programming algorithms so commercial codes such as CPLEX have been optimized to perform column generation very e#ciently [7]. The simplex method does not require that the matrix H be explicitly available. At each iteration, only a subset of the columns is used to determine the current solution (called a basic feasible solution). The simplex method needs some means for determining if the current solution is optimal, and if it is not, some means for generating some column that violates the optimality conditions. The tasks of verification of optimality and generating a column can be performed by the learning algorithm. A simplex-based boosting method will alternate between solving an LP for a reduced H corresponding to the weak learners generated so far and using the weak learning algorithm to generate the best-scoring weak learner based on the dual misclassification cost provided by the LP. This will continue until a well-defined exact or approximate stopping criterion is reached. The idea of column generation (CG) is to restrict the primal problem (2) by considering only a subset of all the possible labelings based on the weak learners generated so far; i.e., only a subset - H of the columns of H is used. The LP solved using - H is typically referred to as the restricted master problem. Solving the restricted primal LP corresponds to solving a relaxation of the dual LP. The constraints for weak learners that have not been generated yet are missing. One extreme case is when no weak learners are considered. In this case the optimal dual solution is - (with appropriate choice of D). This will provide the initialization of the algorithm. If we consider the unused columns to have -a then -a is feasible for the original primal LP. If (-u, - #) is feasible for the original dual problem then we are done since we have primal and dual feasibility with equal objectives. If - a is not optimal then (-u, - #) is infeasible for the dual LP with full matrix H. Specifically, the # is violated for at least one weak learner. Or equivalently, # m # for some j. Of course we do not want to a priori generate all columns of H (H .j ), so we use our weak learner as an oracle that either produces H.j, # for some j or a guarantee that no such H .j exists. To speed convergence we would like to find the one with maximum deviation, that is, the weak learning algorithm H(S, u) must deliver a function - h satisfying Thus - becomes the new misclassification cost, for example i, that is given to the weak learning machine to guide the choice of the next weak learner. One of the big payo#s of the approach is that we have a stopping criterion. If there is no weak learner h for which #, then the current combined hypothesis is the optimal solution over all linear combinations of weak learners. We can also gauge the cost of early stopping since if max h#H # m #, for some # > 0, we can obtain a feasible solution of the full dual problem by taking (-u, - #). Hence, the value V of the optimal solution can be bounded between - #. This implies that, even if we were to potentially include a non-zero coe#cient for all the weak learners, the value of the objective # -D # m can only be increased by at most #. We assume the existence of the weak learning algorithm H(S, u) which selects the best weak learner from a set H closed under complementation using the criterion of equation (10). The following algorithm results Algorithm 4.1 (LPBoost). Given as input training set: S learners a # 0 All coe#cients are 0 , . , 1 Corresponding optimal dual REPEAT Find weak learner using equation hn #H(S,u) Check for optimal solution: If H in # hn Solve restricted master for new costs: argmin # s.t. END a # Lagrangian multipliers from last LP return Note that the assumption of finding the best weak learner is not essential for good performance on the algorithm. Recall that the role of the learning algorithm is to generate columns (weak learners) corresponding to a dual infeasible row or to indicate optimality by showing no infeasible weak learners exist. All that we require is that the base learner return a column corresponding to a dual infeasible row. It need not be the one with maximum infeasibility. This is merely done to improve convergence speed. In fact, choosing columns using "steepest edge" criteria that look for the column that leads to the biggest actual change in the objective may lead to even faster convergence. If the learning algorithm fails to find a dual infeasible learner when one exists than the algorithm may prematurely stop at a nonoptimal solution. small changes this algorithm can be adapted to perform any of the LP boosting formulations by simply changing the restricted master LP solved, the costs given to the learning algorithm, and the optimality conditions checked. Assuming the base learner solves (10) exactly, LPBoost is a variant of the dual simplex algorithm [11]. Thus it inherits all the benefits of the simplex algorithm. Benefits include: 1) Well-defined exact and approximate stopping criteria. Typically, ad hoc termination schemes, e.g. a fixed number of iterations, must be used for the gradient-based boosting algorithms. 2) Finite termination at a globally optimal solution. In practice the algorithm generates few weak learners to arrive at an optimal solution. The optimal solution is sparse and thus uses few weak learners. 4) The algorithm is performed in the dual space of the classification costs. The weights of the optimal ensemble are only generated and fixed at optimality. 5) High-performance commercial LP algorithms optimized for column generation exist that do not su#er from the numeric instability problems reported for boosting [2]. 5 Confidence-rated Boosting The derivations and algorithm of the last two sections did not rely on the assumption that L ij # {-1, +1}. We can therefore apply the same reasoning to implementing a weak learning algorithm for a finite set of confidence-rated functions F whose outputs are real numbers. We again assume that F is closed under complementation. We simply define apply the same algorithm as before. We again assume the existence of a weak learner F (S, u), which finds a function - The only di#erence in the associated algorithm is the weak learner which now optimizes this equation. Algorithm 5.1 (LPBoost-CRB). Given as input training set: S learners a # 0 All coe#cients are 0 Corresponding optimal dual REPEAT Find weak learner using equation Check for optimal solution: H in # f n Solve restricted master for new costs: argmin # s.t. END a # Lagrangian multipliers from last LP return 6 LPBoost for Regression The LPBoost algorithm can be extended to optimize any ensemble cost function that can be formulated as a linear program. To solve alternate formulations we need only change the LP restricted master problem solved at each iteration and the criteria given to the base learner. The only assumptions in the current approach are that the number of weak learners be finite and that if an improving weak learner exists then the base learner can generate it. To see a simple example of this consider the problem of boosting regression functions. We use the following adaptation of the SVM regression formulations. This LP was also adapted to boosting using a barrier algorithm in [13]. We assume we are given a training set of data but now y i may take on any real value. First we reformulate the problem slightly di#erently: s.t. -H i a We introduce Lagrangian multipliers (u, u #), construct the dual, and convert to a minimization problem to yield: s.t. restricted to all weak learners constructed so far becomes the new master problem. If the base learner returns any hypothesis H .j that is not dual feasible, i.e. # m #), then the ensemble is not optimal and the weak learner should be added to the ensemble. To speed convergence we would like the weak learner with maximum deviation, i.e., This is perhaps odd at first glance because the criteria do not actually explicitly involve the dependent variables y i . But within the LPBoost algorithm, the u i are closely related to the error residuals of the current ensemble. If the data point x i is overestimated by the current ensemble function by more than #, then by complementarity u i will be positive and u at the next iteration the weak learner will attempt to construct a function that has a negative sign at point x i . If the point x i falls within the # margin then the u and the next weak learner will try to construct a function with value 0 at that point. If the data point x i is underestimated by the current ensemble function by more than #, then by complementarity will be positive and u at the next iteration the weak learner will attempt to construct a function that has a positive sign at point x i . By sensitivity analysis, the magnitudes of u and are proportional to the changes of the objective with respect to changes in the margin. This becomes even clearer using the approach taken in the Barrier Boosting algorithm for this problem [13]. Equation (15) can be converted to a least squares problem. For So the objective to be optimized by the weak learner can be transformed as follows: The constant term v 2 can be ignored. So e#ectively the weak learner must construct a regularized least squares approximation of the residual function. The final regression algorithm looks very much like the classification case. The variables u i and u # i can be initialized to any initial feasible point. We present one such strategy here assuming that D is su#ciently large. Here (a) denotes the plus function. Table 1: Average Accuracy and Standard Deviations of Boosting using Decision Tree Stumps of stumps in final ensemble LPBoost (n) AB-100 AB-1000 Cancer Ionosphere Algorithm 6.1 (LPBoost-Regression). Given as input training set: S learners a # 0 All coe#cients are 0 Corresponding feasible dual REPEAT Find weak learner using equation Check for optimal solution: H in # hn Solve restricted master for new costs: s.t. END a # Lagrangian multipliers from last LP return a 7 Computational Experiments We performed three sets of experiments to compare the performance of LPBoost, CRB, and AdaBoost on three classification tasks: one boosting decision tree stumps on smaller datasets and two boosting C4.5 [12]. For decision tree stumps six datasets were used. For the C4.5 experiments, we report results for four large datasets with and without noise. Finally, to further validate C4.5, we experimented with ten more additional datasets. The rationale was to first evaluate LPBoost where the base learner solves (10) exactly, then to examine LPBoost in a more realistic environment by using C4.5 as a base learner. All of the datasets were obtained from the UC-Irvine data repository [10]. For the C4.5 experiments we performed both traditional and confidence- rated boosting. 7.1 Boosting Decision Tree Stumps We used decision tree stumps as a base learner on the following six datasets: Cancer (9,699), Diagnostic (30,569), Heart (13,297), Ionosphere (34,351), Musk (166,476), and Sonar (60,208). The number of features and number of points in each dataset are shown, respectively, in parentheses. We report testing set accuracy for each dataset based on 10-fold Cross Validation (CV). We generate the decision tree stumps based on the mid-point between two consecutive points for a given variable. Since there is limited confidence information in stumps, we did not perform confidence-rated boosting. All boosting methods search for the best weak learner which returns the least weighted misclassification error at each iteration. LPBoost can take advantage of the fact that each weak learner need only be added into the ensemble once. Thus once a stump is added to the ensemble it is never evaluated by the learning algorithm again. The weights of the weak learners are adjusted dynamically by the LP. This is an advantage over AdaBoost, since AdaBoost adjust weights by repeatedly adding the same weak learner into the ensemble. The parameter # for LPBoost was set using a simple heuristic: 0.1 added to previously-reported error rates on each dataset in [4] except for the Cancer dataset. Specifically the values of # in the same order of the datasets given above were (0.2, 0.1, 0.25, 0.2, 0.25, 0.3 ). Results for AdaBoost were reported for a maximum number of iterations of 100 and 1000. The 10-fold average classification accuracies and standard deviations are reported in Table 1. LPBoost performed very well both in terms of classification accuracy, number of weak learners, and training time. There is little di#erence between the accuracy of LPBoost and the best accuracy reported for AdaBoost using either 100 or 1000 iterations. The variation in AdaBoost for 100 and 1000 iterations illustrates the importance of well-defined stopping criteria. Typically, AdaBoost only obtains its solution in the limit and thus stops when the maximum number of iterations (or some other heuristic stopping criteria) is reached. There is no magic number of iterations good for all datasets. LPBoost has a well-defined stopping criterion that is reached in a few iterations. It uses few weak learners. There are only 81 possible stumps on the Breast Cancer dataset (nine attributes having nine possible values), so clearly AdaBoost may require the same tree to be generated multiple times. LPBoost generates a weak learner only once and can alter the weight on that weak learner at any iteration. The run time of LPBoost is proportional to the number of weak learners generated. Since the LP package that we used, CPLEX 4.0 [7], is optimized for column generation, the cost of adding a column and reoptimizing the LP at each iteration is small. An iteration of LPBoost is only slightly more expensive that an iteration of AdaBoost. The time is proportional to the number of weak learners generated. For problems in which LPBoost generates far fewer weak learners it is much less computationally costly. In the next subsection, we test the practicality of our methodology on di#erent datasets using C4.5. 7.2 Boosting C4.5 LPBoost with C4.5 as the base algorithm performed well after some operational challenges were solved. In concept, boosting using C4.5 is straightforward since the C4.5 algorithm accepts misclassification costs. One problem is that C4.5 only finds a good solution not guaranteed to maximize (10). This can e#ect the convergence speed of the algorithm and may cause the algorithm to terminate at a suboptimal solution. Another challenge is that the misclassification costs determined by LPBoost are sparse, i.e. of the points. The dual LP has a basic feasible solution corresponding to a vertex of the dual feasible region. Only the variables corresponding to the basic solution can be nonnegative. So while a face of the region corresponding to many nonnegative weights may be optimal, only a vertex solution will be chosen. In practice we found that when many LPBoost converged slowly. In the limited number of iterations that we allowed (25), LPBoost frequently failed to find weak learners that improved significantly over the initial equal cost solution. The weak learners generated using only subsets of the variables were not necessarily good over the full data set. Thus the search was too slow. Alternative optimization algorithms may alleviate this problem. For example, an interior point strategy may lead to significant performance improvements. Note that other authors have reported problems with underflow of boosting [2]. When LPBoost was solved to optimality on decision tree stumps with full evaluation of the weak learners, this problem did not occur. Boosting unpruned decision trees helped somewhat but did not completely eliminate this problem. Stability and convergence speed was greatly improved by adding minimum misclassification costs to the Table 2: Large Dataset Results from Boosting C4.5 LPBoost CRB AdaBoost C4.5 Original Forest 0.7226 0.7259 0.7370 0.6638 Original Adult 0.8476 0.8461 0.8358 0.8289 Original USPS 0.9123 0.9103 0.9103 0.7833 Original OptDigits 0.9249 0.9355 0.9416 0.7958 dual min and . The corresponding primal problem is The primal problem maximizes two measures of soft margin: # corresponds to the minimum margin obtained by all points and # i measures the additional margin obtained by each point. AdaBoost also minimizes a margin cost function based on the margin obtained by each point. This is just one method of boosting multiclass problems. Further investigation of multiclass approaches is needed. We ran experiments on larger datasets: Forest, Adult, USPS, and Optdigits from UCI[10]. LPBoost was adopted to the multiclass problem by defining h j instance x i is correctly classified by weak learner h j and -1 otherwise. Forest is a 54-dimension dataset with seven possible classes. The data are divided into 11340 training, 3780 validation, and 565892 testing instances. There are no missing values. The 15-dimensional Adult dataset has 32562 training and 16283 testing instances. One training point that has a missing value for a class label has been removed. We use 8140 instances as our training set and the remaining 24421 instances as the validation set. Adult is a two-class dataset with missing values. The default handling in C4.5 has been used for missing values. USPS and Optdigits are optical character recognition datasets. USPS has 256 dimensions without missing value. Out of 7291 original training points, we use 1822 points as training data and the rest 5469 as validation data. There are 2007 test points. Optdigits on the other hand has 64 dimensions without missing values. Its original training set has 3823 points. We use 955 of them as training data and the remaining 2868 as validation data. Parameter selection for both LPBoost and AdaBoost was done based on validation set results. Since initial experiments resulted in the same parameter set for both LPBoost and CRB, we set the parameters equal for CRB and LPBoost to expedite computational work. In order to investigate the performance of boosted C4.5 with noisy data, we introduced 15% label noise for all four datasets. The # parameter used in LPBoost and the number of iterations of AdaBoost can significantly a#ect their performance. Thus accuracy on the validation set was used to pick the parameter # for LPBoost and the number of iterations for AdaBoost. Due to the excessive computational work, we limit the maximum number of iterations at 25 for all boosting methods as in [2]. We varied parameter # between 0.03 and 0.11. Initial experiments indicated that for very small # values, LPBoost results in one classifier which assigns all training points to one class. On the other extreme, for larger values of #, LPBoost returns one classifier Parameter0.800.840.03 Parameter0.800.84 (a) Forest Dataset (b) Adult Dataset Parameter0.900.94 Parameter0.920.96 (c) USPS Dataset (d) Optdigits Dataset Figure 1: Validation Set Accuracy by # Value. Triangles are no noise and circles are with noise. which is equal to the one found in the first iteration. Figure 1 shows the validation set accuracy for LPBoost on all four datasets. Based on validation set results, we use (22,19), (25,4), (22,25), and (25,25) number of iterations for original and 15%noisy data respectively for AdaBoost in the Forest, Adult, USPS, and Optdigits datasets. The testing set results using the value of # with the best validation set accuracy are given in Table 2. LPBoost was very comparable with AdaBoost in terms of CPU time. As seen in Table 2, LPBoost is also comparable with AdaBoost in terms of classification accuracy when the validation set is used to pick the best parameter settings. AdaBoost performs better in the case of noisy data. CRB is the least e#ective method in terms of classification accuracy among boosting methods. All boosting methods outperform C4.5. The computational costs of 25 iterations of LPBoost (either variant) and AdaBoost were very similar. We provide some sample CPU times. These timings should be considered only rough estimates. Our experiments were performed on a cluster of IBM RS-6000s used in batch mode. Since the machines are not all identical and are subject to varying loads, run times vary considerable from run to run. For each dataset we give the seconds of CPU time on an RS-6000: Forest AdaBoost =717, LPBoost = 930; Adult AdaBoost = 107, We also conducted experiments by boosting C4.5 on small datasets. Once again there was no strong evidence of superiority of any of the boosting approaches. In addition to six UCI datasets used in decision tree stumps experiments, we use four additional UCI datasets here. These are the House(16,435), Hous- datasets. As in the decision tree stumps experiments, we report results from 10-fold CV. Since the best # value for LPBoost varies between 0.05 and 0.1 for the large datasets, we pick parameter the small datasets. Results are reported in Table 3. C4.5 performed the best on the House dataset. AdaBoost performed the best in four datasets out of ten. LPBoost and CRB had the best classification performance for three and two datasets respectively. When we drop CRB in Table 2 The continuous response variable of Housing dataset was categorized at 21.5. Table 3: Small Dataset Results from Boosting C4.5 LPBoost CRB AdaBoost C4.5 Cancer 0.9585 - House 0.9586 - Housing Ionosphere 0.9373 - 3, LPBoost would in this case perform the best in five datasets, although the parameter # has not been tuned. 8 Discussion and Extensions We have shown that LP formulations of boosting are both attractive theoretically in terms of generalization error bound and computationally via column generation. The LPBoost algorithm can be applied to any boosting problem formulated as an LP. We examined algorithms based on the 1-norm soft margin cost functions for support vector machines. A generalization error bound was found for the classificaiton case. The LP optimality conditions allowed us to provide explanations for how the methods work. In classification, the dual variables act as misclassification costs. The optimal ensemble consists of a linear combination of learners that work best under the worst possible choice of misclassification costs. This explanation is closely related to that of [6]. For regression as discussed in the Barrier Boosting approach to the same formulation [13], the dual multipliers act like error residuals to be used in a regularized least square problem. We demonstrated the ease of adaptation to other boosting problems by examining the confidence-rated and regression cases. Extensive computational experiments found that the method performed well versus AdaBoost both with respect to classification quality and solution time. We found little clear benefit for confidence-rated boosting of C4.5 decision trees. From an optimization perspective, LPBoost has many benefits over gradient-based approaches: finite termination, numerical stability, well-defined convergence criteria, fast algorithms in practice, and fewer weak learners in the optimal ensemble. LPBoost may be more sensitive to inexactness of the base learning algorithm. But through modification of the base LP, we were able to obtain very good performance over a wide spectrum of datasets even in the boosting decision trees where the assumptions of the learning algorithm were violated. The questions of what is the best LP formulation for boosting and the best method for optimizing the LP remain open. Interior point column generation algorithms may be much more e#cient. But clearly LP formulations for classification and regression are tractable using column generation, and should be the subject of further research. Acknowledgements This material is based on research supported by Microsoft Research, NSF Grants 949427 and IIS-9979860, and the European Commission under the Working Group Nr. 27150 (NeuroCOLT2). --R Learning in Neural Networks An empirical comparison of voting classification algorithms: Bagging Combining support vector and mathematical programming methods for classification. A column generation approach to boosting. Prediction games and arcing algorithms. An Introduction to Support Vector Machines. Generalized support vector machines. UCI repository of machine learning databases. New York Barrier boosting. Robust ensemble learning. Boosting the margin: A new explanation for the e Improved boosting algorithms using confidence-rated predictions Structural risk minimization over data-dependent hierarchies Margin distribution bounds on generalization. Analysis of regularised linear functions for classification problems. --TR --CTR Cynthia Rudin , Ingrid Daubechies , Robert E. Schapire, The Dynamics of AdaBoost: Cyclic Behavior and Convergence of Margins, The Journal of Machine Learning Research, 5, p.1557-1595, 12/1/2004 Jinbo Bi , Tong Zhang , Kristin P. Bennett, Column-generation boosting methods for mixture of kernels, Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining, August 22-25, 2004, Seattle, WA, USA Robust Loss Functions for Boosting, Neural Computation, v.19 n.8, p.2183-2244, August 2007 Yi Zhang , Samuel Burer , W. Nick Street, Ensemble Pruning Via Semi-definite Programming, The Journal of Machine Learning Research, 7, p.1315-1338, 12/1/2006 Yijun Sun , Sinisa Todorovic , Jian Li, Increasing the Robustness of Boosting Algorithms within the Linear-programming Framework, Journal of VLSI Signal Processing Systems, v.48 n.1-2, p.5-20, August 2007 Michael Collins, Parameter estimation for statistical parsing models: theory and practice of distribution-free methods, New developments in parsing technology, Kluwer Academic Publishers, Norwell, MA, 2004 Axel Pinz, Object categorization, Foundations and Trends in Computer Graphics and Vision, v.1 n.4, p.255-353, December 2005 Ron Meir , Gunnar Rtsch, An introduction to boosting and leveraging, Advanced lectures on machine learning, Springer-Verlag New York, Inc., New York, NY,
linear programming;boosting;ensemble learning;soft margin;sparseness
599662
On the Dual Formulation of Regularized Linear Systems with Convex Risks.
In this paper, we study a general formulation of linear prediction algorithms including a number of known methods as special cases. We describe a convex duality for this class of methods and propose numerical algorithms to solve the derived dual learning problem. We show that the dual formulation is closely related to online learning algorithms. Furthermore, by using this duality, we show that new learning methods can be obtained. Numerical examples will be given to illustrate various aspects of the newly proposed algorithms.
Introduction We consider the statistical learning problem: to find a parameter from random observations to minimize the expected loss (risk): given a loss function L(ff; x) and n observations independently drawn from a fixed but unknown distribution D, we want to find ff that minimizes the expected loss over x: Z any assumption of the underlying distribution on x, the most natural method for solving (1) using a limited number of observations is by the empirical risk minimization (ERM) method (cf. [13]). That is, we choose a parameter ff that minimizes the observed risk:n More specifically, we consider the following type of regularized linear system with convex loss: where we shall assume that both f and g are convex functions. - is an appropriately chosen positive regularization parameter to balance the two terms. We typically choose g(w) - 0 as a function that penalizes large w. This formulation naturally arises in many statistical learning applications. For example, in order to apply this formulation to linear regression, we can let However, other formulations can also be of interests. For example, in robust estimation, one is interested in using In order to apply this formulation for the purpose of training linear classifiers, we can choose f as a decreasing function, such that f(\Delta) - 0. Examples include support vector machines and the logistic regression where One interesting theoretical result from the VC analysis concerning this (primal) formulation is that dimensional independent generalization error can be obtained with [14]. This VC analysis was extended in [16]. However, it turns out that a careful non-VC analysis [17] can actually be more suitable for this particular problem (both for its primal form and for its dual form - which we will introduce later in this paper). In this paper, we study some numerical and learning aspects of a dual form of (3), which has certain attractive properties compared with the primal formulation. This duality of certain learning problems in the general game-theoretical sense can also lead to the discovery of new learning methodologies. The paper is organized as follows. In Section 2, we derive the dual formulation of (3) and propose a relaxation algorithm to solve the dual problem. Section 3 generalizes the derivation to include equality constraints. Section 4 provides some applications of the proposed algorithms in machine learning. In Section 5, we provide some numerical examples. In Section 6, we study the learning aspect of the dual formulation. Conclusions and some final remarks are made in Section 7. Dual formulation Since (3) is a convex programming problem involving linear transformations of the primal variable w, a dual form can be obtained by introducing auxiliary variables - i for each data point sup -n where k(\Delta) is the dual transform of f(\Delta) (assume f is lower semi-continuous, see [11]): It is well known that k is convex. By switching the order of inf w and sup - , which is valid for the above minimax convex-concave programming problem (a proof of this interchangeability, i.e. strong duality, is given in Appendix A), we obtain -n where w minimizes (5) for fixed - at: -n where we use rg to denote the gradient of g with respect to w. Note that in the main body of the paper, we assume that the gradient of a convex function exists when required. In this case, constraints need to be dealt with by introducing appropriate Lagrangian multipliers as in Section 3. The main reason of this treatment is for numerical considerations. However, for the mathematical proof of strong duality in Appendix A which does not have any direct numerical consequence, we use the generalized definition of convex functions and duality in [11] without assuming differentiability. For example, in the general case, a constraint on a convex function c(z) can be regarded as a modification of c(z) so that c(z) = +1 when z does not satisfies the constraint. Substituting (6) into (5), we obtain -n s:t: rg(w) =-n To simplify notations, we now consider the dual transform of g(\Delta): where h(\Delta) is also a convex function. It follows that We can thus rewrite (7) as the following dual formulation: -n The optimal solution - w to the primal problem can be obtained from -n When this system is non-degenerate (also see Section 3), it gives the following solution: -n As a comparison, we also have the following equation from (4) when f is differentiable at Note that we have derived equation (8) by using two Legendre transforms: k is the dual of f and h is the dual of g. If we write X as the matrix with each data x i as a row, then from the Legendre transformation point of view, the dual transform of - is Xw with respect to f and k; the dual transform of w is 1 with respect to g and h. Consequently, we can regard X as an interaction between the dual variables w and -. This interaction is a linear interaction which is the simplest possible interaction between w and -. In this paper, we propose the following generic relaxation algorithm to solve the dual problem (8), where we denote the dimension of w as d: Algorithm 1 (Dual Gauss-Seidel) find \Delta- i by approximately minimizing update v: -n \Delta- update At each inner iteration i of Algorithm 1, the algorithm essentially fixes all other dual variables - j with j 6= i and find a perturbation \Delta- i of the dual variable - to reduce the objective function (8). Since the objective function is reduced at each step, the algorithm will always converge. If exact optimization is used for ( ), then - converges to the true optimal solution - - of (8). Also if the Hessian of (8) exists and is well-behaved around the optimal solution - -, then (8) can be locally approximated by a quadratic function. It follows that the asymptotic convergence rate of Algorithm 1 is linear if ( ) is minimized exactly [4]. The rate of convergence depends on the spectrum of the Hessian matrix of (8) at the optimal solution - -. The main attractive feature of Algorithm 1 is its simplicity. One might also consider a preconditioned conjugate gradient acceleration [4] with Algorithm 1 as a preconditioner. However, in many interesting cases, k(\Delta) can be non-smooth (containing simple bounds), and hence CG might not help. An interesting aspect of the dual formulation is that each dual variable - i corresponds to a data point x i . In Algorithm 1, at each step, one looks at only one data point - i , which is very similar to online update algorithms. The difference is that in Algorithm 1, we keep the dual variable - that has been computed so far, while for a typical online algorithm, this information is not kept. It is actually not very difficult to convert Algorithm 1 into an online learning method by setting use an appropriate scaling factor n at each step. Minimax style mistake bounds can also be derived accordingly. However, a full-scale study of related issues will be left to another report. In this paper, we shall only provide a simple analysis on the mistake bounds of the empirical risk estimator in Appendix B, which illustrates the basic idea and demonstrates the theoretical connection of the dual batch formulation and online learning. Note that the primal form (3) and the dual form (8) have a striking similarity. Besides the connection with online algorithms, there are several other reasons why we are interested in studying the dual form. For example, we will later see in this paper that if g is the quadratic regularization function Algorithm 1 has an especially simple form. Another reason is that if f is non-smooth but g is smooth, then the one-dimensional optimization problem in the dual Gauss-Seidel algorithm is easier than the one-dimensional optimization problem in the primal Gauss-Seidel algorithm. Furthermore, even if the primal problem is infinite dimensional (that is, d is infinity), the dual problem is still finite dimensional (assuming a finite sample size). This elimination of the primal dimensionality has important generalization performance consequences in machine learning (see Section 6 and Section 7). Finally, the dual form (8) with the relationship (9) generalizes the kernel form of SVM originally investigated by Vapnik [14]. Constraints In order for the dual formulation (8) to be valid, equation (9) has to have a solution. However, in certain circumstances, it is possible that (8) is singular, and hence it has a solution only when the right hand side lies in the range of rg(w) for w 2 R d . This imposes a constraint on X T - where X is the matrix with each row i consisted of data x i . For simplicity, we shall only discuss the case of equality constraint. Inequality constraints can be handled similarly. Since the original problem is a convex optimization problem, therefore the dual problem is also a convex optimization problem. This implies that such an equality constraint on the dual variable - must be a linear constraint. This situation usually arises when g(w) is flat under a linear transformation of w: where C is a matrix and d is a vector. Since Crg(w) j d, therefore by (9), the corresponding constraint imposed on the dual variable is of the following form: Equation (10) has to be modified as -n s: In order to preserve the structure of the dual formulation (8) so that we can employ the Gauss-Seidel update in Algorithm 1, we propose to use the augmented Lagrangian method [3]. This method modifies the dual h(v) of the primal regularization term g(w) in (8) as where s is the Lagrangian multiplier vector corresponding to the constraint (13) and is the same s as in (14). - is a small positive penalty parameter. The following algorithm solves (8) with constraint (13) by utilizing the modified dual h s;- (cf. [3], page 292): Algorithm 2 (Dual Augmented Lagrangian) solve (8) with h(\Delta) replaced by h s;- (\Delta) using Algorithm 1 (use the current (-; v) as the initial point, and update (-; v)) else \Deltas One nice property of the Augmented Lagrangian approach is that if the augmented dual problem can be solved by Algorithm 1 to a sufficiently high accuracy, then the step -=4 can only be executed finitely number of times. This means that upon termination, - is bounded away from zero. Next, we would like to briefly discuss the situation when the primal problem (3) has a convex constraint c(w) - 0, where each component of c(\Delta) is a convex function. Let - - be the corresponding Lagrangian multiplier, then the primal problem can be rewritten as It is well known that - 0 [3], and - for each component c j (w) ! 0. This indicates that - - T c(w) is convex and thus can be regarded as a regularization term similar to -g(w). If we can select the appropriate Lagrangian multiplier -, then we essentially solve the same problem with regularization term -g(w) replaced by -g(w) For learning problems, the exact value Lagrangian - - is either known (for example, for entropy regularized probability distributions investigated later), or non-crucial (since the most appropriate way to determine such a Lagrangian regularization parameter should be some kind of cross-validation anyway). Also in many cases, a constraint on the primal variable w becomes a flat segment in the dual variable -. In such cases, we can apply the unmodified Algorithm 1 to compute - but the relationship to obtain w should be modified accordingly. If we regard a primal inequality constraint as a regularization term, observe that when a parameter - increases, the corresponding c j (w) decreases at the optimal solution, it is thus also possible to use the algorithms suggested in this paper as an inner solution engine and adjust - j appropriately by examining c j ( - w) at the optimal solution. This idea is similar to the modified Lagrangian method we propose to deal with the dual constraint (13). Although a modification of the Augmented Lagrangian method can be applied in many cases, it is usually not recommended due to a variety of reasons. Some other more subtle methods can be employed. However, due to the limitation of space (also because this issue is non-crucial for learning problems), we shall skip further discussions. 4.1 Useful dual pairs In this section, we list a few examples of convex Legendre dualities that are relevant to learning problems. We use p(u) to denote the primal function with primal variable u, and use q(v) to denote the dual function with dual variable v. 1. We assume that K is a symmetric positive definite operator. 2. are dual pairs: 1=p 3. are dual pairs: 1=p are dual pairs: 4. is a set of positive prior. 5. Note that p(u) has a flat dimension p(u a when a is a vector with identical components, therefore v satisfies a constraint and the dual transformation s contains a free Lagrangian parameter s. 7. where s - 0 is a non-negative Lagrangian parameter. 8. 9. are dual pairs: 1=p Note that many of the above examples contain constraints on the dual (some also on the primal) variables. In such case, we can also ignore the constraint and consider the corresponding function when the constraint is not satisfied. The last few examples are of interests because they are relevant to classification problems. It is also very useful to note that the dual of a linear transform of either the primal variable or the primal convex function can be easily computed: a where we assume that S is a non-singular linear transformation. 4.2 The regularization term In this section, we briefly discuss a few regularization conditions for (3) that are of interests. Square regularization One of the most important regularization conditions is the square penalty: where K is a symmetric positive definite operator. In many applications, one choose - the identity matrix. In this case, and hence ( ) in Algorithm 1 can be replaced by minimizing: where Note that system (16) is particularly simple. It has actually been reduced to a small problem of constant size which can be solved in constant time once the inner product a and b are computed. For large problems, the computation of a and b (a can actually be pre-computed) dominates. p-norm regularization We let This is of interests when the data is q-norm bounded since x T w is bounded. The generalization performance is also dimensional independent [16, 17]. In this case, then an approximate Newton's method can be employed to solve ( ). In each of the Newton's iteration for (\Lambda) (usually one may use only one Newton's iteration), we need to compute the derivative part and the second derivative part i;j . In many cases, this computation can be more costly than the evaluation of a and b in the square regularization formulation. However, tricks can be employed to alleviate this problem since an accurate estimate of the second derivative part i;j is less important - we can safely use a good upper-bound on the second derivative. Note that if essentially a constraint on v. In order to obtain w from -, equation (10) has to be modified. Similarly, if is essentially a constraint on The regularization term is given by This is of interests when the data is 1-norm (or entropy) bounded. Typically, we can let be a large number. In this case, Again, an approximate Newton's method is required. The derivative part requires the evaluation of In addition, the second derivative part requires the evaluation of i;j . Entropy regularization This is usually of interests when either the data is infinite-norm bounded or when the weight vector w gives a probability distribution. In this case, unlike using the 1-norm regularization condition which leads to a generalization performance degrading logarithmically on the dimension, the generalization performance of the entropy regularization is dimensional independent [16, 17]. We first consider the normalized entropy for probability distributions: the prior distribution. The dual is where we choose the Lagrangian parameter The derivative term of h(v) in ( ) is The second derivative term of h(v) in ( ) is -n -n Therefore the two terms correspond to the expectation and the variance of x i under the distribution w. Note that if the second derivative (variance) vanishes, a small positive number can be used to regularize the solution. We now consider non-normalized entropy with positive weight w (one can easily deal with general situation by adding a negative weight part): (w The dual is The Newton's approximation of ( ) is straight-forward. Remarks In practice, there is absolutely no reason why we need to choose a regularization term based on a simple primal form. It is perfectly reasonable (and highly recommended) that we design a learning algorithm based on a simple choice of the dual function h(v). Whether its dual g(w) is complicated or not is irrelevant as far as dual algorithms are concerned. For example, consider the dual of the Huber's function having a simple form of h(v) =2 v 2 (jvj - 1), which can be solved relatively easily. The regularization condition g(w) is a good replacement for 1-norm regularization. In general, one can choose h(v) as a piecewise linear or quadratic function. If we would like w to be concentrated around 0, then an appropriate form for h(v) should also have a shape that is concentrated around 0. However, because of the uncertainty principal, the freedom of a dual dimension should be inversely proportional to the freedom of a primal dimension. This can be easily seen in the case of square regularization since the kernel K \Gamma1 for the dual problem is the inverse of the kernel K for the primal problem. If on the other hand, we would like to design an algorithm with w biased toward some nonzero prior - as in the case of entropy regularization, then one only needs to use a h(v) that is monotone increasing. Such a function can be easily constructed by using piece-wise quadratic functions. 4.3 The loss term Regression We first consider the standard square-loss regression where regularization term (15), the line search step ( ) in Algorithm 1 can be solved analytically as: For robust estimation, we are interested in the case that regularization term (15), the line search step ( ) in Algorithm 1 can be solved analytically as: The robustness of naturally explained in the above dual update: since - i is bounded for each i, therefore the contribution of any one data point - i to the final weight w is well under control. This principle can be used to directly design the dual form of a robust regression without resorting to the primal form. For distribution estimation, we consider a modification of the maximum-entropy method with given by the normalized entropy regularization (19). The formulation becomes the maximum-entropy method when - ! 0. However, we conjecture this modification has advantage over the standard maximum-entropy method for the same reason that the soft-margin SVM formulation is often preferred to the optimal-separating hyper-plane method in practice (in the sense of choosing a nonzero regularization parameter -). For SVM, the theoretical advantage of an appropriate nonzero regularization parameter has been demonstrated in [17], even for linearly separable classification problems: it is possible to achieve exponential rates of convergence with appropriate non-zero regularization param- eters. No similar results are known for the optimal-separating hyper-plane method. It has in fact been conjectured in [17] that the generalization performance of the optimal-separating hyper-plane method is slower than exponential in the worst case. In this case of modified maximum-entropy method, the Newton's update corresponding to the line search step ( ) in Algorithm 1 is given by Note that if - ! 0 (the standard maximum-entropy method), then the update fails. The reason is that the quadratic penalty method becomes ill-conditioned when the penalty parameter is close to zero. An easy remedy is to use the modified Lagrangian method which we have already discussed. Likelihood Consider the mixture model estimation problem, where we want to find a distribution w so that the log-likelihood maximized. In this case, the normalized entropy regularization (19). Note that the initial value of - should not be set as zero anymore since We shall thus start with a positive value 1. the Newton's update corresponding to the line search step ( ) in Algorithm 1 is given by If w corresponds to a nicely behaved probability density of a vector random variable in R n , then instead of the entropy regularization, a 2-norm based regularization with appropriate kernel (such as the Fisher kernel) can also be utilized. Next, we consider the logistic regression for classification problems derived from a maximum-likelihood estimate: given by (15). In this case, the Newton step corresponding to ( ) in Algorithm 1 becomes Again we should start with a non-zero initial value of - 2 (0; 1). For example, 0:5 is a good choice. Binary classification For binary classification, we typically choose a non-negative decreasing f such that f(0) ? 0. One example is the logistic regression investigated above. In this section, we examine a few other examples. We let Choose g(w) as (15). In this case, an exact analytical solution can be obtained: With the same f(u), if we replace the square regularization condition with the normalized entropy regularization, then the Newton's update for ( ) becomes shall be chosen based on class label to maximize the margin (see Section 5), and x i shall be the data vector for an in-class member and the negative data vector for an out-of-class member. This algorithm corresponds to the normalized Winnow (exponentiated gradient) update [9] with positive weights in the same way that a support vector machine corresponds to the Perceptron update [10]. To better understand this, observe that the Perceptron update corresponds to the square norm regularization and the Winnow update corresponds to the entropy regularization (for example, see the proofs of both methods in [5], or the comparison of exponentiated gradient versus gradient descent in [8]). The optimal margin SVM for linearly separable problems modifies a Perceptron as minimizing the 2-norm under a margin constraint, which corresponds to the minimization of entropy under the same margin constraint for the Winnow (or exponentiated gradient) family of algorithms. The soft-margin SVM then modifies the optimal margin method by introducing a decreasing loss function f with square regularization in (3). In the case of the Winnow algorithm, this translates to a choice of entropy regularization with a soft margin SVM-like loss function f in the above update rule. In addition, we can use other forms of f(u) such as the standard one used in the standard SVM formulation which we discuss shortly. From the algorithmic point of view, the relationship of SVM and the Perceptron algorithm has been mentioned in [12], chapter 12, where Platt has compared the SVM dual update rule related to (29) to the Perceptron update algorithm. The same analogy of (28) and the Winnow (or exponentiated gradient) family of algorithms can be readily observed due to the normalized exponential form of rh(\Delta). It shall be noted that many discussions of the exponentiated gradient algorithms have emphasized proper matching loss functions (see [6] for example). In our formulation, a careful choice of matching loss is replaced by a proper regularization condition which can be combined with any loss function. Also notice that if non-normalized entropy is used as a regularization condition, then we obtain an algorithm that corresponds to the non-normalized exponentiated gradient update. In a SVM, we choose f as: let g(w) be given by (15). The update is the exact solution for As mentioned above, Platt has derived the same update rule as (29) in [12]. However, his derivation employs Bregman's technique [1] suitable only for some specific problems. In particular, the technique of convex duality which we have adopted in this paper generalizes Bregman's approach. Also, Platt's comment that (29) does not maximize margin is not true. In fact, we have found no statistically significant difference of this method from a standard SVM in our applications. Although special care has to be taken to avoid the potential zero-denominator problem. See the discussion at the end of Section 5 for implementation considerations. It shall also be interesting to mention that in [7], the authors have already adopted the update (29) in their applications. It is worthwhile to mention that in the standard SVM, there is a shift b which is non- regularized, we absorb this b into the last component of w by appending a constant feature (typically 1), then the regularization condition g(w) has a symmetry: g(w where c is the vector with one in the last component and zero elsewhere. In this case, Algorithm 2 has to be employed. The corresponding dual constraint (13) is exact solution for ( ) is modified as: . The introduction of a non-regularized shift b in the standard SVM formulation created some complexity in optimization, although not significantly as illustrated in Section 5. It also seems to have an adverse effect on the generalization analysis by a log(n) factor. Note that the expected generalization performance of O(1=n) with full regularization (see Section 6 and [17]) cannot be achieved if there is a non-regularized dimension, because it is very well known that a non-regularized dimension, with a VC-dimension of 1, contributes a logarithmic factor into the generalization performance term O(1=n) which is worst case tight (for example, see [14]). However, this increased variance may be compensated by potentially reduced bias. The practical difference of using a non-regularized shift versus a regularized shift is unclear. 5 Experiments The goal of this section is to illustrate the proposed algorithms by examples, so that the reader can develop a feeling of the convergence rate of the proposed algorithms in the context of some existing algorithms. Due to the broad scope of this paper and its theoretical nature, it is not illuminating to provide examples for every specific instance of learning formulations we have mentioned in Section 4. We thus only provide two examples, one for Algorithm 1 and one for Algorithm 2. Other instances of the algorithms have similar behaviors. Since our research interests are mainly in natural language processing, we shall illustrate the algorithms by text categorization examples. The standard data set for comparing text categorization algorithms is the Reuters set of news stories, publicly available at http://www.research.att.com/-lewis/reuters21578.html. We use Reuters-21578 with ModApte split to partition the documents into training and validation sets. This data contains 118 classes, with 9603 documents in the training set and documents in the test set. In our experiments, we use word stemming without any stop-word removal. We also use the information gain criterion in [15] to select 1000 most informative word-count features and use only the binary values of the selected features (which indicates that the word either appears, or not appears in the document). In text categorization, the performance is usually measured by precision and recall rather than classification error: positive true positive positive \Theta 100 positive true positive negative \Theta 100 Since a linear classifier contains a threshold parameter that can be adjusted to trade-off the precision and the recall, it is conventional to report the break-even point, where precision equals recall. Since each document in the Reuters dataset can be multiply categorized, it is common to study the dataset as separate binary classification problems, each corresponding to a category. The overall performance can be measured by the micro-averaged precision, recall and the break-even point computed from the overall confusion matrix defined as the sum of individual confusion matrices corresponding to the categories. In the following examples, we only use the top ten categories (the remaining categories are typically very small). The experiments are done on a Pentium II 400 PC under Linux. The timings include training using the training data with feature selection and testings on the test data, but not the parsing of documents. Winnow versus Regularized Winnow In this example, we study the performances of the regularized Winnow corresponding to update (28) and of the standard Winnow algorithm with positive weights. We use a learning rate of 0:001 for the standard Winnow algorithm (approximately optimal for this example): that is, if a prediction is wrong, we shrink the weight by exp(\Gamma0:001x) if the data x is out of class; or multiply the weight by exp(0:001x) if the data x is in class. The prediction rule is: w T x - ' implies out-of-class, and w in-class. w is normalized such that is a predefined parameter. In the regularized winnow algorithm (28), we let out-of-class data with the sign of the data reversed in the training phase. ff is a parameter that attempts to maximize the decision margin between the in-class and the out-of-class data, which is fixed as 0:1 in our examples for illustration. Intuitively this corresponds to let the starting point of weight update with an in-class data be ' ff, and the starting point of weight update with an out-of-class data be our goal is to achieve a margin of size 2ff. The regularization parameter in (28) is fixed as 10 \Gamma4 . We run both algorithms 100 iterations over the data for comparison. Note that kwk and the data x has f0; 1g components, thus w T x - 1. Also taken the sparsity of the data into account, it is reasonable for us to pick 0:3 to reflect a good range of threshold choice. 0:1, the micro-averaged break-even point for Winnow is 83:0, with a CPU time of 23 seconds; the micro-averaged break-even point for the regularized Winnow is 86:3, with a CPU time of 26 seconds. At 0:3, the micro-averaged break-even point for Winnow is 81:6, with a CPU time of 23 seconds; the micro-averaged break-even point for the regularized Winnow is 85:0, with a CPU time of 26 seconds. To have a better feeling of the reported timing, one notes that a C4.5 decision tree inducer with even 500 features (1000 features cannot be handled) take hours to finish training (partly because the sparse structure cannot be utilized). The SMO algorithm for SVM which is one of the fast text categorization algorithms [2] requires more than three minutes. Table 1 shows the break-even points for both algorithms for all the ten categories at 0:1. The regularized Winnow is consistently superior. This difference is statistically sig- nificant, and is comparable of the difference between the SVM and the Perceptron algorithms indicated in Table 2. category Winnow Regularized Winnow acq 82.8 85.4 money-fx 58.7 62.8 grain 78.4 84.7 crude 78.1 78.7 trade 65.3 71.1 interest 61.7 72.5 ship 63.7 75.0 wheat 76.4 83.1 corn 65.5 80.4 micro-average 83.0 86.3 Table 1: Break-even points: Winnow versus Regularized Winnow at Although the results are not as good as those from a SVM (which achieves a state of the art performance on text categorization), this comparison is unfair since we only allow positive weights in our implementation of Winnow style algorithms. This indicates that we only try to find the most indicative words for a particular topic, but ignore all other words even though their appearances in a document may strongly suggest that the document does not belong to the topic. To utilize the additional features, we need a regularized version of the standard Winnow algorithm with both positive and negative weights. Such a conversion can be obtained from a vector version of the duality formulation (the weight w is a matrix and the dual - i at a data point is a vector). Since such an extension is not investigated in this work, we shall thus skip such a comparison. Perceptron versus SVMs In this example, we compare the Perceptron algorithm, the proposed SVM method (30), and the SMO method for SVM described in chapter 12 of [12], which is currently the preferred method for solving a SVM problem in text-categorization [2]. The regularization parameter for the SVMs is fixed as 10 \Gamma3 . The learning rate of the Perceptron is 0:001: that is, if a prediction is wrong, we update the weight by if the data x is out of class; or by 0:001x if the data x is in class. The prediction rule is: w T x - 0 implies out-of-class, and w T x ? 0 implies in-class. We also normalize the weight so that kwk at the end of each iteration over the data, which enhances the performance. The total running time for Perceptron (100 iterations over the training data) is 13 seconds. Its faster speed compared with the Winnow algorithm indicates that Winnow algorithms spend most time in the normalization step 1 . The proposed formulation (30) is exactly implemented as described. We use 50 iterations in each call of Algorithm 1, and only 4 iterations in Algorithm 2. Therefore totally we use 200 iterations over the training data. The running time is 33 seconds. The SMO algorithm is tricky to implement. We have made our best judgment for trade-offs among its internal parameters with the suggestions given in [12] as the starting point. The running time for our particular implementation is 191 seconds. Table 2 includes the comparison (break-even points) of the three algorithms over all ten categorizes and the micro-averaged break-even points. It can be observed that both SVMs are consistently better than the Perceptron algorithm. However, there are some statistically insignificant random discrepancies among the SVMs due to different convergence criteria. It shall also be useful to point out that j is in the order of 10 \Gamma6 at the end of Algorithm 2 for all ten categories. This implies that the dual constraint largely satisfied. Results similar to SVMs (micro-averaged break-even of 91) can be obtained by using (27) and 100 iterations of Algorithm 1, with a total run time of 19 seconds. In this case, a constant feature of value 1 is appended to each data point. category Perceptron SMO Algorithm 2 acq 92.4 95.5 95.0 money-fx 68.7 69.8 75.4 grain 87.9 91.3 88.6 crude 81.0 81.5 84.1 trade 68.6 73.5 73.5 interest 63.4 74.8 77.1 ship 82.0 82.0 80.9 wheat 77.8 83.1 84.7 corn 77.2 87.5 83.9 micro-average 88.5 91.0 91.2 Table 2: Break-even points: Perceptron versus SVMs We would like to mention that although in our examples, we have faithfully implemented the suggested algorithms, it is not important to stick to the specific formulations given in this paper. For example, there are no magic reasons for the starting value of or the 50% decrease in the constraint value, or the update -=4 in Algorithm 2. It is also recommended to use an update value of \Delta- i in ( ) that is smaller than the quantity In our implementation, Winnows are normalized more frequently in the inner iterations to avoid numerical instability. suggested by the Newton's method to gain better numerical stability. For example, we have observed that for Algorithm 1 with (27) and (29), it is useful to use a small fraction of the exact \Delta-updates given by the equations. This is especially important for (29) since the denominator x T can be zero which causes a large change of - (one can replace by a regularized version such as 1 smaller increment alleviates the problem of heavy - oscillation. This phenomenon is less a problem for (30) since a small - gives a large denominator 1 6 Some learning consequences For any (differentiable) convex function h, we can define a distance function d h (w; w 0 ) (also called Bregman divergence [1]) as It has the property that d h (w; w strictly convex, d h (w; w only We now consider any n samples X n 1 of (x; y), let ~ we partition this ~ n samples into m batches of subsamples, with each batch X(i) containing n i data. Let - denote the optimal solution of (8) with the ~ 1 , and let - i denotes the solution of approximate minimizing of (8) with the i-th batch of subsamples: denotes the empirical expectation with respect to the i-th batch of n i samples as in (8). ffl i is a positive approximation error which can be controlled in practice by checking the duality gap with the primal problem (3). Now let - i be the restraint of - to the i-th batch of subsamples, then ~ ~ n- ~ ~ h(- ~ ~ h(- ~ h(- ~ Note that the first order condition of (8) at the optimal solution implies the following estimation equation which is another form of (11): We thus obtain the following inequality: [-d Similar to our analysis of the primal problem in [17], we shall ignore the contribution simplicity. We thus obtain the following fundamental inequality for the dual ~ ~ [d We shall define v x. Then (33) bounds the convergence of v i to v (in terms of the h-Bregman divergence) by the convergence of v i to It is also interesting to compare this inequality with its primal form in [17], where the approximate empirical risk minimizer w n of the primal problem satisfies: d g (w ; w By using the duality of Bregman divergence in [17] and the relationship (11), we have Note that (33) gives better constants. In fact, it is asymptotically tight in constants compared with the asymptotic estimates given in [16, 17]. Although learning bounds of the primal formulation has been investigated in [17], it is insightful to study the implications in terms of the dual variable -. One such bound was given by Vapnik in term of the number of "support-vectors", i.e. the number of nonzero dual variables (see [14]). Although Vapnik's bound is very interesting, it has two fundamental drawbacks. One drawback is that the bound is not asymptotically "correct" in the sense it gives an expected generalization error bound slower than O(1=n) with n samples (since the number of support vectors should usually grow unbounded). However, it has been demonstrated in [17] the expected generalization error should grow at a rate of O(1=n) in the general case; furthermore, the misclassification error of training a linear classifier when the problem is linearly separable can be exponential in n. Note that the later situation is clearly what Vapnik's bound is intended for, therefore the bound can be asymptotically far inferior than the correct rate. The other drawback of Vapnik's bound is that it only handles the situation that the number of support vectors is small. Although there is no indication that when the number of support vectors is large, the generalization performance becomes poor, the bound itself tends to lead the statistical learning community towards thinking that to obtain a good generalization performance, it is somewhat desirable to reduce the number of support vectors - for example, this is clearly the case in the design of support vector machines. However, our analysis, which leads to the "correct" large sample convergence rate, indicates that minimizing the number of support vectors is not so important. In addition to these drawbacks of the support vector concept, we also do no have a characterization of learning problems that can predictably lead to a small number of support vectors. Therefore up to now, the non-trivialness of the bound solely relies on some empirical evidences, which is not entirely satisfactory in theory. The goal of this section is to study the learning aspect of the dual problem more carefully, so that we can characterize the generalization performance in terms of the dual variables. This analysis complements the primal analysis studied in [17]. We let ~ n !1 in (33) and X n 1 is chosen in such a way that it approximates the underlying distribution D. Let - denote the optimal solution in the limit which can be regarded as a random variable with respect to D (that is, we shall assume that the solution to the continuous version of (8) exists. Assume that n simplicity, we denote them by n. By taking expectations EX nover n randomly chosen data X n 1 , we obtain denotes the empirical estimation with data X n 1 , and - n denotes the approximate solution of (8) with error ffl in (31). The random variable - is usually very well-behaved. This is because that in the continuous case, the estimation equation (32) is given by the relationship (11): if the derivative exists (and a subgradient otherwise, see Appendix A), where w is the optimal solution of the primal problem. Note that the right hand side of (34) becomes the convergence of the empirical expectation of a random variable to its mean, which can be estimated by standard probability techniques as illustrated in [17]. For a typical d h that is square-like, the right hand side is variance-like, thus converges at a rate of O(1=n). Detailed case studies have been given in [17], which we shall not repeat. In addition to the expected h-Bregman divergence, we can also obtain an expected exponential lim ~ ~ (d Using the independence assumption of X ~ n 1 , and taking the limit, we obtain that 8ff ? 0: which can be used to obtain a large deviation type exponential probability bound. Moment bounds can also be similarly obtained. See [17] for examples. With (34) and (36), we can obtain an expected generalization error bound and a large deviation style probability bound by using techniques in [17]. As we have pointed out earlier, the primal estimates and the dual estimates are rather similar up to a constant factor of 2 which we shall regard as non-significant for the purpose of deriving generalization bounds. Therefore we shall not repeat the analysis on those examples given in [17]. In order to see that the expected error bound of (33) cannot be improved, we consider (34) with linear loss and quadratic regularization: and In this case, Solving the primal problem, we obtain - KEx, For the dual problem, we have - j b. becomes: which is an equality. Since locally g can usually be approximately by a quadratic regularization and f by a linear loss where b can be (x; y) dependent (we shall intentionally remove the quadratical term in the f expansion which corresponds to the dropped d k term in (33)), therefore asymptotically (33) is tight. 7 Concluding remarks In this paper, we have introduced a dual formulation for a class of regularized linear learning methods with convex risks. This new formulation is related to online learning algorithms and stochastic gradient descent methods. The dual form also leads to a generalization of the kernel formulation for support vector machines. While in a kernel formulation, one usually substitute the primal-dual relationship (10) into the primal formulation (3), our approach emphasizes the completely different dual risk (8). This dual formulation leads to new learning algorithms as well as new insights into certain learning problems. The intermediate primal-dual formulation is related to the minimax online mistake bound framework. However, we pose the problem in a PAC style batch setting. This relationship thus bridges the online learning mistake bound analysis and the PAC analysis. From the numerical point of view, we are able to obtain new batch learning methods from the dual formulation. More importantly, these methods can be derived in a very systematic way. As we have mentioned, it is possible to transform the derived batch learning methods into online learning algorithms, which we shall leave to another report. Appendix B demonstrates the basic ideas for obtaining mistake bounds using (33). It is very natural to ask how general is this duality in machine learning. The primal-dual formulation views the learning problem in a game-theoretical setting: the learner chooses a primal weight variable w to minimize a certain risk; the opponent chooses a dual variable that controls the random sample behavior to maximize the risk. Although the strong duality for convex-concave programming is difficult to extend to general problems, the game-theoretical point of view can still be adopted. We conjecture that even when the strong duality is violated, it may still be possible to design a dual formulation that is appropriate as a learning method. However, there are many open issues in this area requiring future study. We have also studied the learning aspect of the dual formulation (8). Specifically we are able to obtain generalization bounds that have better (asymptotically tight) constants than those from the primal analysis in [17]. An interesting consequence from the dual analysis is that there is no evidence that the number of non-zero dual variables (or support vectors) is of any significance. This may not be very surprising since this number is not stable under even a slight perturbation of the loss function. The generalization performance bound based on the number of support vectors can be asymptotically sub-optimal, especially for linearly separable classification problems the bound was intended for. The dual formulation also provides valuable insights into learning problems. For exam- ple, since the number of dual variables is always independent of the dimensionality of the primal problem, therefore under appropriate regularity assumptions, the dimensionality of the primal problem should not appear in the learning bounds. This suggests that the frequently mentioned notion of "the curse of dimensionality" is not really an issue for many learning problems. This might seem surprising at first. To understand the implications, we consider the high dimensional density estimation problem. The standard argument for "the curse of dimensionality" is that in high dimension, in order to approximate the density function, one needs to fill out a number of points in a box that is exponential in the dimensionality. However, this reasoning is only partially valid. This is because that an appropriate way to measure whether two distributions are similar is by comparing the expectations of a bounded function with respect to these two distributions. Therefore instead of the point-wise convergence criterion, we shall consider the convergence in weak topology where the closeness of two densities are measured by the closeness of their actions on a set of test functions. This implies that the proper question to ask is that given a fixed number of data, how many test functions we can utilize to obtain a stable density estimate. This methodology is used in the maximum entropy method. Note that with appropriate regularity conditions, the number of test functions we can use is dimensional independent. However, since we choose the weak topology for the density estimate, we need to determine the topology of test functions. For a given family of test functions, we need to find an appropriate structure hierarchy to approximate this family. A proper norm can always be defined on the test functions so that a dimensional independent partition is obtainable. The induced dual metric on the density can then be used to measure the convergence of the density estimate. For example, a typical partition of bounded test function is based on a log-exponential criterion that induces the entropy metric on the density space (see the analysis in [17]). This duality between test functions and density weights is essentially the same duality we have investigated in this paper. Furthermore, this method of measuring the complexity of a learning problem is dual to the VC point of view that directly measures the complexity of the parameter space (in our example, the density function to be estimated). The advantage of this dual point of view is that we do not rely on the specific parametric function family one chooses. More importantly, for many learning problems, this complexity can be measured by the convergence rates of random test functions to their means in the test space (see [17]). This indicates that well-established probability tools can be applied to obtain the complexity measurement that is dimensional independent. A Proof of strong duality We would like to show that it is valid to interchange the order of inf w and sup - in the primal-dual formulation (4). We assume that g(w) (as well as other functions involved in the analysis) can take value as +1 which is equivalent to a data-independent constraint on We also assume that the solution to the primal problem exists (unique for simplicity). For notational purposes, let Then our goal is to show that there exists ( - -) such that sup It is well-known (for example, see [11]) that the duality gap sup and (37) is valid if That is, we can find ( - w) such that In this case, ( - w) is called a saddle point. In the following, we demonstrate the existence of a saddle point by construction. Consider w that minimizes the primal problem. It is known ([11], page 264) that there exist subgradients (which is a generalization of the gradient concept for convex functions: see definitions in [11], Section 23), denoted by @(\Delta) 2 , so thatn For readers who are not familiar with convex analysis, the above equation becomes the following estimation equation if the empirical risk is differentiable at - w:n -n By the relationship of subgradients and duality (see [11], page 218), - w achieves the minimum of -n That is, Also by the definition of \Gamma - - i as a subgradient of f(\Delta) at - and the same relationship of subgradients and duality ([11], page 218), - achieves the maximum of That is, This finishes the proof. Conventionally, a subgradient is a set denoted by @(\Delta). However, for notational convenience, we use @(\Delta) to denote a member of a subgradient set in the proof. Online mistake bounds Consider the following scenario: we are given samples the primal variable w i be the weight obtained by the exact solution of the dual problem (8), and v i be its dual v i be the projection of v i onto the first and v i i be the projection of v i onto the i-th sample, as in the case of (33). Then by the same proof of (33): That is This inequality is the fundamental bridge of the online learning formulation and the batch (dual) formulation we have referred to in the paper. To see why this inequality is important: note that if d h is a square like distance (which is usually true), then the right hand side is of the order O(1=k 2 ), which implies that kd h (v small. The standard online learning telescoping technique can then be applied to derive mistake bounds. In our case, this can be done in a fashion that is similar and parallel to the examples studied in [17]. However, the general case will be treated in another dedicated report. In the following, we shall merely provide an illustration by using the square regularization term (15) and draw a conclusion. For (v k That is: (w (v k Now we make an assumption that That is, the Bregman divergence of L is square like (which is true for smooth loss functions). Then by using the estimation equation (32): (v k Summing over from (v k This gives a typical mistake bound that has the correct growth order of log(n) under some standard assumptions; for example: assume that c i - c and v's are K \Gamma1 norm bounded by b, then It is well known that this logarithmic growth is optimal. To see this, consider the one-dimensional It is easy to verify that If we let x then for large k: (w hence the growth rate of log(n) is achieved by simply summing the above equality over k. Note that this logarithmic factor indicates that the correct batch learning rate of O(1=n) cannot be obtained by the typical randomization technique (for example, see [8]) for modifying online algorithms (and mistake bounds) as batch algorithms. It is also important to note that the matching loss function concept (cf. [6]) is not important in our analysis, which allows us to analyze problems with any loss function. The role of the matching loss function corresponds to a proper choice of the regularization term in our analysis which is data dependent rather than loss function dependent. --R The relaxation method of finding a common point of convex sets and its application to the solution of problems in convex programming. Inductive learning algorithms and representations for text categorization. Practical methods of optimization. Matrix computations. General convergence results for linear discriminant updates. Relative loss bounds for single neurons. A discriminative framework for detecting remote protein homologies. Additive versus exponentiated gradient updates for linear prediction. Learning quickly when irrelevant attributes abound: a new linear-threshold algorithm MIT press Convex analysis. Smola., editors. Advances in Kernel Methods Estimation of dependences based on empirical data. Statistical learning theory. A comparative study on feature selection in text categoriza- tion Analysis of regularized linear functions for classification problems. On the primal formulation of regularized linear systems with convex risks. --TR --CTR Fred J. Damerau , Tong Zhang , Sholom M. Weiss , Nitin Indurkhya, Text categorization for a comprehensive time-dependent benchmark, Information Processing and Management: an International Journal, v.40 n.2, p.209-221, March 2004 Tong Zhang , Fred Damerau , David Johnson, Text chunking based on a generalization of winnow, The Journal of Machine Learning Research, 2, 3/1/2002 Zhang , Yue Pan , Tong Zhang, Focused named entity recognition using machine learning, Proceedings of the 27th annual international ACM SIGIR conference on Research and development in information retrieval, July 25-29, 2004, Sheffield, United Kingdom Tong Zhang, Leave-one-out bounds for kernel methods, Neural Computation, v.15 n.6, p.1397-1437, June Ron Meir , Tong Zhang, Generalization error bounds for Bayesian mixture algorithms, The Journal of Machine Learning Research, 4, 12/1/2003 Tong Zhang, Covering number bounds of certain regularized linear function classes, The Journal of Machine Learning Research, 2, p.527-550, 3/1/2002 Qiang Wu , Yiming Ying , Ding-Xuan Zhou, Multi-kernel regularized classifiers, Journal of Complexity, v.23 n.1, p.108-134, February, 2007 Ron Meir , Gunnar Rtsch, An introduction to boosting and leveraging, Advanced lectures on machine learning, Springer-Verlag New York, Inc., New York, NY,
logistic regression;support vector machine;linear model;regulation;augmented Lagrangian;convex duality
599663
Choosing Multiple Parameters for Support Vector Machines.
The problem of automatically tuning multiple parameters for pattern recognition Support Vector Machines (SVMs) is considered. This is done by minimizing some estimates of the generalization error of SVMs using a gradient descent algorithm over the set of parameters. Usual methods for choosing parameters, based on exhaustive search become intractable as soon as the number of parameters exceeds two. Some experimental results assess the feasibility of our approach for a large number of parameters (more than 100) and demonstrate an improvement of generalization performance.
Introduction In the problem of supervised learning, one takes a set of input-output pairs and attempts to construct a classier function f that maps input vectors x 2 X onto labels y 2 Y. We are interested here in pattern recognition or classication, that is the case where the set of labels is simply 1g. The goal is to nd an f 2 F which minimizes the error (f(x) 6= y) on future examples. Learning algorithms usually depend on parameters which control the size of the class F or the way the search is conducted in F . Several techniques exist for performing the selection of these parameters. The idea is to nd the parameters that minimize the generalization error of the algorithm at hand. This error can be estimated either via testing on some data which has not been used for learning (hold- out testing or cross-validation techniques) or via a bound given by theoretical analysis. Tuning multiple parameters Usually there are multiple parameters to tune at the same time and moreover, the estimates of the error are not explicit functions of these parameters, so that the only applicable strategy which is exhaustive search in the parameter space becomes intractable since it would correspond to running the algorithm on every possible value of the parameter vector (up to some discretization). We propose here a methodology for automatically tuning multiple parameters for the Support Vector Machines (SVMs) which takes advantage of the specicity of this algorithm. The SVM algorithm Support vector machines (SVMs) realize the following idea: map an n-dimensional input vector x 2 R n 1 into a high dimensional (possibly innite dimensional) feature space H by and construct an optimal separating hyperplane in this space. Dierent mappings construct dierent SVMs. When the training data is separable, the optimal hyperplane is the one with the maximal distance (in H space) between the hyperplane and the closest image of the vector x i from the training data. For non-separable training data a generalization of this concept is used. Suppose that the maximal distance is equal to M and that the images of the training vectors x are within a sphere of radius R. Then the following theorem holds true [19]. Theorem 1 Given a training set of size ', a feature space H and an hyperplane (w; b), the margin M(w; b; Z) and the radius R(Z) are dened by kwk The maximum margin algorithm takes as input a training set of size ' and return an hyperplane in feature space such that the margin M(w; b; Z) is maximized. Note that supposing the training separable 1 In the rest of this article, we will reference to vectors and matrices using the bold notation means that M > 0. Under this assumption, for all probability measures P underlying the data Z, the expectation of the misclassication probability has the bound The expectation is taken over the random draw of a training set Z of size for the left hand side and size ' for the right hand side. This theorem justies the idea of constructing a hyperplane that separates the data with a large margin: the larger the margin the better the performance of the constructed hyperplane. Note however that according to the theorem the average performance depends on the ratio EfR 2 =M 2 g and not simply on the large margin M . Why multiple parameters ? The SVM algorithm usually depends on several parameters. One of them, denoted C, controls the tradeo between margin maximization and error minimization. Other parameters appear in the non-linear mapping into feature space. They are called kernel parame- ters. For simplicity, we will use a classical trick that allows to consider C as a kernel parameter, so that all parameters will be treated in a unied framework. It is widely acknowledged that a key factor in an SVM's performance is the choice of the kernel. However, in practice, very few dierent types of kernels have been used due to the di-culty of appropriately tuning the parameters. We present here a technique that allows to deal with a large number of parameters and thus allows to use more complex kernels. Another potential advantage of being able to tune a large number of parameters is the possibility of rescaling the attributes. Indeed, when no a priori knowledge is available about the meaning of each of the attributes, the only choice is to use spherical kernels (i.e. give the same weight to each attribute). But one may expect that there is a better choice for the shape of the kernel since many real-world database contain attributes of very dierent natures. There may thus exist more appropriate scaling factors that give the right weight to the right feature. For example, we will see how to use radial basis function kernels (RBF) with as many dierent scaling factors as input dimensions: The usual approach is to consider and to try to pick up the best value for . However, using the proposed method, we can choose automatically good values for the scaling factors i . Indeed, these factors are precisely parameters of the kernel. Moreover, we will demonstrate that the problem of feature selection can be addressed with the same framework since it corresponds to nding those attributes which can be rescaled with a zero factor without harming the generalization. We thus see that tuning kernel parameters is something extremely useful and a procedure that allows to do this would be a versatile tool for various tasks such as nding the right shape of the kernel, feature selection, nding the right tradeo between error and margin, etc. All this gives a rationale for developing such techniques. Our approach We thus see that our goal is not only to nd the hyperplane which maximizes the margin but also the values of the mapping parameters that yield best generalization error. To do so, we propose a minimax ap- maximize the margin over the hyperplane coe-cients and minimize an estimate of the generalization error over the set of kernel parameters. This last step is performed using a standard gradient descent approach. What kind of error estimates We will consider several ways of assessing the generalization error. Validation error: this procedure requires to reduce the amount of data used for learning in order to save some of it for validation. Moreover, the estimates have to be smoothed for proper gradient descent. Leave-one-out error estimates: this procedure gives an estimate of the expected generalization as an analytic function of the parameters. We will examine how the accuracy of the estimates in uences the whole procedure of nding optimal parameters. In particular we will show that what really matters is how the variations of the estimate relate to the variations of the test error rather than how their values are related. Outline The paper is organized as follows. The next section introduces the basics of SVMs. The dierent possible estimates of their generalization error are described in section 3 and section 4 explains how to smooth theses estimates. Then we introduce in section 5 a framework for minimizing those estimates by gradient descent. Section 6 deals with the computation of gradients of error estimates with respect to kernel parameters. Finally, in section 7 and 8, we present experimental results of the method applied to a variety of databases in dierent contexts. Section 7 deals with nding the right penalization along with the right radius for a kernel and with nding the right shape of a kernel. In section 8 are presented results of applying our method to feature selection. Learning We introduce some standard notations for SVMs; for a complete description, see [18]. Let f(x be a set of training examples, x i 2 R n which belong to a class labeled by y 1g. In the SVM methodology, we map these vectors into a feature space using a kernel function K(x denes an inner product in this feature space. Here, we consider a kernel K depending on a set of parameters . The decision function given by an is: where the coe-cients 0 are obtained by maximizing the following functional i2 under the constraints The coe-cients 0 dene a maximal margin hyperplane in a high-dimensional feature space where the data are mapped through a non-linear function such that This formulation of the SVM optimization problem is called the hard margin formulation since no training errors are allowed. Every training point satises the inequality y corresponding an equality is satised. These points are called support vectors. Notice that one may require the separating hyperplane to pass through the origin by choosing a xed This variant is called the hard margin SVM without threshold. In that case, the optimization problem remains the same as above except that the constraint disappears. Dealing with non-separability For the non-separable case, one needs to allow training errors which results in the so called soft margin SVM algorithm [4]. It can be shown that soft margin SVMs with quadratic penalization of errors can be considered as a special case of the hard margin version with the modied kernel [4, 16] where I is the identity matrix and C a constant penalizing the training errors. We will focus in the remainder on the hard margin SVM and use (3) whenever we have to deal with non-separable data. Thus C will be considered just as another parameter of the kernel function. 3 Estimating the performance of an SVM Ideally we would like to choose the value of the kernel parameters that minimize the true risk of the SVM classier. Unfortunately, since this quantity is not accessible, one has to build estimates or bounds for it. In this section, we present several measures of the expected error rate of an SVM. 3.1 Single validation estimate If one has enough data available, it is possible to estimate the true error on a validation set. This estimate is unbiased and its variance gets smaller as the size of the validation set increases. If the validation set is f(x 0 the estimate is where is the step function: 3.2 Leave-one-out bounds The leave-one-out procedure consists of removing from the training data one element, constructing the decision rule on the basis of the remaining training data and then testing on the removed element. In this fashion one tests all ' elements of the training data (using ' dierent decision rules). Let us denote the number of errors in the leave-one-out procedure by L(x It is known [10] that the the leave-one-out procedure gives an almost unbiased estimate of the expected generalization error: err is the probability of test error for the machine trained on a sample of size ' 1 and the expectations are taken over the random choice of the sample. Although this lemma makes the leave-one-out estimator a good choice when estimating the generalization error, it is nevertheless very costly to actually compute since it requires running the training algorithm ' times. The strategy is thus to upper bound or approximate this estimator by an easy to compute quantity T having, if possible, an analytical expression. If we denote by f 0 the classier obtained when all training examples are present and f i the one obtained when example i has been removed, we can which can also be written as Thus, if U p is an upper bound for y p (f 0 get the following upper bound on the leave-one-out error: since for hard margin SVMs, y monotonically increasing 3.2.1 Support vector count Since removing a non-support vector from the training set does not change the solution computed by the machine (i.e. U non-support vector), we can restrict the preceding sum to support vectors and upper bound each term in the sum by 1 which gives the following bound on the number of errors made by the leave-one-out procedure [17]: where N SV denotes the number of support vectors. 3.2.2 Jaakkola-Haussler bound For SVMs without threshold, analyzing the optimization performed by the SVM algorithm when computing the leave-one-out error, Jaakkola and Haussler [8] proved the inequality: which leads to the following upper bound: Note that Wahba et al. [20] proposed an estimate of the number of errors made by the leave-one-out procedure, which in the hard margin SVM case turns out to be which can be seen as an upper bound of the Jaakkola-Haussler one since 3.2.3 Opper-Winther bound For hard margin SVMs without threshold, Opper and Winther [12] used a method inspired from linear response theory to prove the following: under the assumption that the set of support vectors does not change when removing the example p, we have where K SV is the matrix of dot products between support vectors; leading to the following estimate: 3.2.4 Radius-margin bound For SVMs without threshold and with no training errors, Vapnik [18] proposed the following upper bound on the number of errors of the leave-one-out procedure: where R and M are the radius and the margin as dened in theorem 1. 3.2.5 Span bound Vapnik and Chapelle [19, 3] derived an estimate using the concept of span of support vectors. Under the assumption that the set of support vectors remains the same during the leave-one-out procedure, the following equality is true: is the distance between the point and the set p where This gives the exact number of errors made by the leave-one-out procedure under the previous assumption: The span estimate can be related to other approximations: Link with Jaakkola-Haussler bound If we consider SVMs without threshold, the constraint be removed in the denition of the span. Then we can easily upper bound the value of the span: S 2 thus recover the Jaakkola-Haussler bound. Link with R 2 =M 2 For each support vector, we have y the number of errors made by the leave-one-out procedure is bounded by: X It has been shown [19] that the span S p is bounded by the diameter of the smallest sphere enclosing the training points and since the number of errors made by the leave-one-out procedure is bounded by Link with opper-Winther When the support vectors do not change, the hard margin case without threshold gives the same value as the opper-Winther bound, namely: 4 Smoothing the test error estimates The estimate of the performance of an SVM through a validation error (4) or the leave-one-out error (5) requires the use of the step function . However, we would like to use a gradient descent approach to minimize those estimates of the test error. Unfortunately the step function is not dierentiable. As already mentioned in section 3.2.5, it is possible to bound (x 1) by x for x 0. This is how the bound R 2 =M 2 is derived from the leave-one-out error. Nevertheless by doing so, large errors count more than one, therefore it might be advantageous instead to use a contracting function of the form However, the choice of the constants A and B is di-cult. If A is too small, the estimate is not accurate and A is too large, the resulting estimate is not smooth. Instead of trying to pick up the good constants A and B, one can try to get directly a smooth approximation of the test error by estimating posterior probabilities. Recently, Platt proposed the following estimate of the posterior distribution P of an SVM output f(x) [13]: ~ 4.0 -3.0 -2.0 -1.0 -0.0 1.0 -2.348 -0.306 Figure 1: Validation error for dierent values of the width of an RBF kernel. Top left: with a step function, otherwise. Note that on the bottom picture, the minimum is not at the right place where f(x) is the output of the SVM. The constants A and B are found by minimizing the Kullback-Leibler divergence between ~ P and an empirical approximation of P built from a validation set This optimization is carried out using a second order gradient descent algorithm [13]. According to this estimate the best threshold for our SVM classier f is such that PA ;B (x) 0:5). Note that if B 6= 0, we obtained a correction comparable to the usual SVM threshold. By denition the generalization error of our classier is Z Z This error can be empirically estimated as ~ min ~ Note that the labels of the validation set are not used directly in this last step but indirectly through the estimation of the constants A and B appearing in the parametric form of ~ PA ;B . To have a better understanding of this estimate, let us consider the extreme case where there is no error on the validation set. Then the maximum likelihood algorithm is going to yield PA ;B (x) will only take binary values. As a consequence, the estimate of the error probability will be zero. 5 Optimizing the kernel parameters Let's go back to the SVM algorithm. We assume that the kernel k depends on one or several parameters, encoded into a vector thus consider a class of decision functions parametrized by , b and : We want to choose the values of the parameters and such that W (see equation (2)) is maximized (maximum margin algorithm) and T , the model selection criterion, is minimized (best kernel parameters). More precisely, for xed, we want to have choose 0 such that When is a one dimensional parameter, one typically tries a nite number of values and picks the one which gives the lowest value of the criterion We note ~ as an abbreviation for ~ PA ;B (x) T . When both T and the SVM solution are continuous with respect to , a better approach has been proposed by Cristianini et al. [5]: using an incremental optimization algorithm, one can train an SVM with little eort when is changed by a small amount. However, as soon as has more than one component computing T (; ) for every possible value of becomes intractable, and one rather looks for a way to optimize T along a trajectory in the kernel parameter space. Using the gradient of a model selection criterion to optimize the model parameters has been proposed in [2] and demonstrated in the case of linear regression and time-series prediction. It has also been proposed by [9] to optimize the regularization parameters of a neural network. Here we propose an algorithm that alternates the SVM optimization with a gradient step is the direction of the gradient of T in the parameter space. This can be achieved by the following iterative procedure: 1. Initialize to some value. 2. Using a standard SVM algorithm, find the maximum of the quadratic form W: 3. Update the parameters such that T is minimized. This is typically achieved by a gradient step (see below). 4. Go to step 2 or stop when the minimum of T is reached. Solving step 3 requires estimating how T varies with . We will thus restrict ourselves to the case where K can be dierentiated with respect to . Moreover, we will only consider cases where the gradient of T with respect to can be computed (or approximated). Note that 0 depends implicitly on since 0 is dened as the maximum of W . Then, if we have n kernel parameters derivative of respect to p is: 0 xed Having computed the gradient r T way of performing step 3 is to make a gradient step: for some small and eventually decreasing ". The convergence can be improved with the use of second order derivatives (Newton's method): where the Laplacian operator is dened by In this formulation, additional constraints can be imposed through projection of the gradient. 6 Computing the gradient In this section, we describe the computation of the gradient (with respect to the kernel parameters) of the dierent estimates of the generalization error. First, for the bound R 2 =M 2 (see Theorem 1), we obtain a formulation of the derivative of the margin (section 6.1) and of the radius (section 6.2). For the validation error (see equation (4)), we show how to calculate the derivative of the hyperplane parameters 0 and b (see section 6.3). Finally, the computation of the derivative of the span bound (7) is presented in section 6.4. We rst begin with a useful lemma. Suppose we are given an (n1) vector v and an (nn) matrix smoothly depending on a parameter . Consider the function: where Let x be the the vector x where the maximum in L() is attained. Then @ @ x: In other words, it is possible to dierentiate L with respect to as if x did not depend on . Note that this is also true if one (or both) of the constraints in the denition of F are removed. Proof: We rst need to express the equality constraint with a Lagrange multiplier and the inequality constraints with Lagrange multipliers At the maximum, the following conditions are veried: We have @ @ @ (v P x); where the last term can be written as follows, @ (v P @ b @ x @ Using the derivatives of the optimality conditions, namely @ @ @ @ and the fact that either @ @ hence @ (v P and the result follows. 6.1 Computing the derivative of the margin Note that in feature space, the separating hyperplane has the following expansion and it is normalized such that min It follows from the denition of the margin in Theorem 1 that this latter is 1=kwk. Thus we write the bound R 2 =M 2 as R 2 kwk 2 . The previous lemma enables us to compute the derivative of kwk 2 . In- deed, it can be shown [18] and the lemma can be applied to the standard SVM optimization problem (2), giving 6.2 Computing the derivative of the radius Computing the radius of the smallest sphere enclosing the training points can be achieved by solving the following quadratic problem [18]: under constraints We can again use the previous lemma to compute the derivative of the radius: where 0 maximizes the previous quadratic form. 6.3 Computing the derivative of the hyperplane parameters Let us rst compute the derivative of 0 with respect to a parameter of the kernel. For this purpose, we need an analytical formulation for 0 . First, we suppose that the points which are not support vectors are removed from the training set. This assumption can be done without any loss of generality since removing a point which is not support vector does not aect the solution. Then, the fact that all the points lie on the margin can be | {z } where K Y there are n support vectors, H is a (n matrix. The parameters of the SVMs can be written as: We are now able to compute the derivatives of those parameters with respect to a kernel parameter p . Indeed, since the derivate of the inverse of a matrix M depending on a parameter p can be written 3 it follows that and nally We can easily use the result of this calculation to recover the computation @p . Indeed, if we denote ~ ~ T H~ and it turns out that: ~ @ ~ ~ ~ 3 This inequality can be easily proved by dierentiating MM ~ 6.4 Computing the derivative of the span-rule let us consider the span value. Recall that the span of the support vector x p is dened as the the distance between the point and the set dened by (6). Then the value of the span can be written as: Note that we introduced a Lagrange multiplier to enforce the constraint Introducing the extended vector ~ and the extended matrix of the dot products between support vectors ~ the value of the span can be written as: where H is the submatrix of ~ K SV with row and column p removed, and v is the p-th column of ~ K SV . From the fact that the optimal value of ~ is H 1 v, it follows: The last equality comes from the following block matrix identity, known as the \Woodbury" formula [11] A A 2 The closed form we obtain is particularly attractive since we can compute the value of the span for each support vector just by inverting the matrix K SV . Combining equation (12) and (11), we get the derivative of the span ~ @ ~ ~ pp Thus, the complexity of computing the derivative of the span-rule with respect to a parameter p of the kernel requires only the computation of and the inversion of the matrix ~ K SV . The complexity of these operations is not larger than that of the quadratic optimization problem itself. There is however a problem in this approach: the value given by the span- rule is not continuous. By changing smoothly the value of the parameters , the coe-cients p change continuously, but span S 2 does not. There is actually a discontinuity for most support vectors when the set of support vectors changes. This can be easily understood from equation (6): suppose that when changing the value of the parameter from to + ", a point xm is not a support vector anymore, then for all other support vectors the set p is going to be smaller and a discontinuity is likely to appear for the value of S The situation is explained in gure 2: we plotted the value of the span of a support vector x p versus the width of an RBF kernel . Almost everywhere the span is decreasing, hence a negative derivative, but some jumps appear, corresponding in a change in the set of support vectors. Moreover the span is globally increasing: the value of the derivate does not give us a good indication of the global evolution of the span. One way to solve is this problem is to try to smooth the behavior of the span. This can be done by imposing the following additional constraint in the denition of p in equation is a constant. Given this constraint, if a point xm is about to leave or has just entered the set of support vectors, it will not have a large in uence on the span of the other support vectors, since 0 m will be small. The eect of this constraint is to make the set p become \continuous" when the set of support vectors changes. However this new constraint prevents us from computing the span as e-ciently as in equation (12). A possible solution is to replace the constraint 74e-376e-378e-380e-3 Figure 2: Value of p , the sum of the span of the training points for dierent values of the width of an RBF kernel varying in the small vicinity by a regularization term in the computation of the span: With this new denition of the span, equation (12) becomes: where D is a diagonal matrix with elements i and D As shown on gure 3 , the span is now much smoother and its minimum is still at the right place. In our experiments, we took Note that computing the derivative of this new expression is no more di-cult than the previous span expression. It is interesting to look at the leave-one-out error for SVMs without threshold. In this case, the value of the span with regularization writes: As already pointed out in section 3.2.5, if the value of span is: 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.077e-385e-393e-3 Figure 3: Left: the minima of the span with regularization (dashed line) and without regularization (solid line) are close. Right: detailed behavior of the span for dierent values of the regularizer, and we recover the opper-Winther bound. On the other hand, if In this case, the span bound is identical to the Jaakkola-Haussler one. In a way, the span bound with regularization is in between the bounds of opper-Winther and Jaakkola-Haussler. 7 Experiments Experiments of dierent nature have been carried out to assess the performance and feasibility of our method. The rst set of experiments consists in nding automatically the optimal value of two parameters: the width of an RBF kernel and the constant C in equation (3). The second set of experiments corresponds to the optimization of a large number of scaling factors in the case of handwritten digit recognition. We then show that optimizing scaling factors leads naturally to feature selection and demonstrate the application of the method to the selection of relevant features in several databases. 7.1 Optimization details The core of the technique we present here is a gradient descent algorithm. We used the optimization toolbox of Matlab to perform it. It includes second order updates to improve the convergence speed. Cross-validation R 2 =M 2 Span-bound Breast Cancer 26.04 4.74 26.84 4.71 25.59 4.18 Diabetis 23.53 1.73 23.25 1.7 23.19 1.67 Heart 15.95 3.26 15.92 3.18 16.13 3.11 Thyroid 4.80 2.19 4.62 2.03 4.56 1.97 Table 1: Test error found by dierent algorithms for selecting the SVM parameters C and . The rst column reports the results from [14]. In the second and last column, the parameters are found by minimizing R 2 =M 2 and the span-bound using a gradient descent algorithm. 7.2 Benchmark databases In a rst set of experiments, we tried to select automatically the width of a RBF kernel, along the constant C penalizing the training error appearing in equation (3). In order to avoid adding positivity constraints in the optimization problem (for the constant C and the width of the RBF kernel), we use the parameterization turns out to give a more stable optimization. We used benchmark databases described in [14]. Those databases as long as the 100 splits training /test sets are available at http://ida.first.gmd.de/raetsch/data/benchmarks.htm. We followed the same experimental setup as in [14]. On each of the rst 5 training sets, the kernel parameters are estimated using either 5-fold cross-validation, minimization of R 2 =M 2 or the span-bound. Finally, the kernel parameters are computed as the median of the 5 estimations. The results are shown in table 1. It turns out that minimizing R 2 =M 2 or the span estimates yields approximately the same performances as picking-up the parameters which minimize the cross-validation error. This is not very surprising since cross-validation is known to be an accurate method for choosing the hyper-parameters of any learning algorithm. But more interesting is to compare the computational cost of these meth- Cross-validation R 2 =M 2 Span-bound Breast Cancer 500 14.2 7 Diabetis 500 12.2 9.8 Heart 500 9 6.2 Thyroid 500 3 11.6 Titanic 500 6.8 3.4 Table 2: Average number of SVM trainings on one training set needed to select the parameters C and using standard cross-validation or by minimizing or the span-bound. ods. Table shows how many SVM trainings in average are needed to select the kernel parameters on each split. The results for cross-validation are the ones reported in [14]. They tried 10 dierent values for C and and performed 5-fold cross-validation. The number of SVM trainings on each of the 5 training set needed by this method is The gain in complexity is impressive: in average 100 times less SVM training are required to nd the kernel parameters. The main reason for this gain is that there were two parameters to optimize. Because of computational reasons, exhaustive search by cross-validation can not handle the selection of more than 2 parameters, whereas our method can, as highlighted in the next section. Discussion As explained in section 3.2, R 2 =M 2 can seem to be a rough upper bound of the span-bound, which is in an accurate estimate of the test error [3]. However in the process of choosing the kernel parameters, what matters is to have a bound whose minimum is close to the optimal kernel parameters. Even if R 2 =M 2 cannot be used to estimate the test error, the previous experiments show that its minimization yields quite good results. The generalization error obtained by minimizing the span-bound (cf gure are just slightly better. Since the minimization of the latter is more di-cult to implement and to control (more local minima), we recommend in practice to minimize R 2 =M 2 . In the experiments of the following section, we will only relate experiments with this bound, but similar results have been obtained with the span-bound. 7.3 Automatic selection of scaling factors In this experiment, we try to choose the scaling factors for an RBF and polynomial kernel of degree 2. More precisely, we consider kernels of the following and Most of the experiments have been carried out on the USPS handwritten digit recognition database. This database consists of 7291 training examples and 2007 test examples of digit images of size 16x16 pixels. We try to classify digits 0 to 4 against 5 to 9. The training set has been split into 23 subsets of 317 examples and just of this subset has been used during the experiments. To assess the feasibility of our gradient descent approach for nding kernel parameters, we rst used only 16 parameters, each one corresponding to a scaling factor for a squared tile of 16 pixels as shown on gure 4. Figure 4: On each of the 16 tiles, the scaling factors of the 16 pixels are identical. The scaling parameters were initialized to 1. The evolution of the test error and of the bound R 2 =M 2 are plotted versus the number of iterations in the gradient descent procedure in gures 5 (polynomial kernel) and 6 (RBF Note that for the polynomial kernel, the test error went down to 9% whereas the best test error with only one scaling parameter is 9.9%. Thus, Figure 5: Evolution of the test error (left) and of the bound R 2 =M 2 (right) during the gradient descent optimization with a polynomial kernel Figure Evolution of the test error (left) and of the bound R 2 =M 2 (right) during the gradient descent optimization with an RBF kernel by taking several scaling parameters, we managed to make the test error decrease. It might be interesting to see which scaling coe-cients have been found. For this purpose, we took 256 scaling parameters (one per pixel) and minimized with a polynomial kernel. The map of the scaling coe-cient is shown in gure 7. The result is quite consistent with one could expect in situation: the coe-cients near the border of the picture are smaller than those in the middle of the picture, so that these coe-cients can be directly interpreted as measures of the relevance of the corresponding feature. Figure 7: Scaling factors found by the optimization procedure: darker means smaller scaling factor Discussion This experiment can be considered as a sanity check experi- ment. Indeed, it proves it is feasible to choose multiple kernel parameters of an SVM and that it does not lead to overtting. However, the gain in test error was not our main motivation since we did not expect any signi- cant improvement on such a problem where most features play a similar role (taking all scaling factors equal on this database seems a reasonable choice). However as highlighted by gure 7, this method can be a powerful tool to perform feature selection. 8 Feature selection The motivation for feature selection is three-fold: 1. Improve generalization error 2. Determine the relevant features (for explanatory purposes) 3. Reduce the dimensionality of the input space (for real-time applications Finding optimal scaling parameters can lead to feature selection algo- rithms. Indeed, if one of the input components is useless for the classica- tion problem, its scaling factor is likely to become small. But if a scaling becomes small enough, it means that it is possible to remove it without aecting the classication algorithm. This leads to the following idea for feature selection: keep the features whose scaling factors are the largest. This can also be performed in a principal components space where we scale each principal component by a scaling factor. We consider two dierent parametrization of the kernel. The rst one correspond to rescaling the data in the input space: where 2 R n . The second one corresponds to rescaling in the principal components space: where is the matrix of principal components. We compute and using the following iterative procedure: 1. Initialize 2. In the case of principal component scaling, perform principal component analysis to compute the matrix . 3. Solve the SVM optimization problem 4. Minimize the estimate of the error T with respect to with a gradient step 5. Discard dimensions corresponding to small elements in and return to step 2. We demonstrate this idea on two toy problems where we show that feature selection reduces generalization error. We then apply our feature selection algorithm to DNA Micro-array data where it is important to nd which genes are relevant in performing the classication. It also seems in these types of algorithms feature selection improves performance. Lastly, we apply the algorithm to face detection and show that we can greatly reduce the input dimension without sacricing performance. 8.1 Toy data We compared several algorithms The standard SVM algorithm with no feature selection Our feature selection algorithm with the estimate R 2 =M 2 and with the span estimate The standard SVM applied after feature selection via a lter method The three lter methods we used choose the m largest features according to: Pearson correlation coe-cients, the Fisher criterion score 4 , and the Kolmogorov-Smirnov test 5 . Note that the Pearson coe-cients and Fisher criterion cannot model nonlinear dependencies. In the two following articial datasets our objective was to assess the ability of the algorithm to select a small number of target features in the presence of irrelevant and redundant features [21]. For the rst example, six dimensions of 202 were relevant. The probability of equal. The rst three features were drawn as and the second three features fx 4 were drawn as a probability of 0:7, otherwise the rst three were drawn as and the second three as x 1). The remaining features are noise x For the second example, two dimensions of 52 were relevant. The probability of equal. The data are drawn from the following: if are drawn from N( ability, are drawn again from two normal distributions with equal probability, with and the same as before. The rest of the features are noise x In the linear problem the rst six features have redundancy and the rest of the features are irrelevant. In the nonlinear problem all but the rst two features are irrelevant. We used a linear kernel for the linear problem and a second order polynomial kernel for the nonlinear problem. We imposed the feature selection algorithms to keep only the best two features. The results are shown in gure (8) for various training set sizes, taking the average test error on 500 samples over runs of each training set size. The Fisher score (not shown in graphs due to space constraints) performed almost identically to correlation coe-cients. In both problem, we clearly see that our method outperforms the other classical methods for feature selection. In the nonlinear problem, among the r , where r is the mean value for the r-th feature in the positive and negative classes and ris the standard deviation 5 KS tst where fr denotes the r-th feature from each training example, and ^ P is the corresponding empirical distribution. lter methods only the Kolmogorov-Smirnov test improved performance over standard SVMs. RW-Bound & Gradient Standard SVMs Correlation Coefficients Kolmogorov-Smirnov Test RW-Bound & Gradient Standard SVMs Correlation Coefficients Kolmogorov-Smirnov Test (a) (b) Figure 8: A comparison of feature selection methods on (a) a linear problem and (b) a nonlinear problem both with many irrelevant features. The x-axis is the number of training points, and the y-axis the test error as a fraction of test points. 8.2 DNA Microarray Data Next, we tested this idea on two leukemia discrimination problems [6] and a problem of predicting treatment outcome for Medulloblastoma [1]. The rst problem was to classify myeloid versus lymphoblastic leukemias based on the expression of 7129 genes. The training set consists of 38 examples and the test set 34 examples. Standard linear SVMs achieve 1 error on the test set. Using gradient descent on R 2 we achieved an error of 0 using and an error of 1 using 1 gene. Using the Fisher score to select features resulted in 1 error for both 1 and genes. The second leukemia classication problem was discriminating B versus T cells for lymphoblastic cells [6]. Standard linear SVMs makes 1 error for this problem. Using either the span bound or gradient descent on R 2 results in 0 errors made using 5 genes. Using the Fisher score results in 2 errors made using 5 genes. The nal problem is one of predicting treatment outcome of patients that have Medulloblastoma. Here there are 60 examples each with 7129 expression values in the dataset and we use leave-one-out to measure the error rate. A standard SVM with a Gaussian kernel makes 24 errors, selecting genes using the gradient descent on R 2 we achieved an error of 15. 8.3 Face detection The trainable system for detecting frontal and near-frontal views of faces in gray images presented in [7] gave good results in terms of detection rates. The system used gray values of 1919 images as inputs to a second-degree polynomial kernel SVM. This choice of kernel lead to more than 40,000 features in the feature space. Searching an image for faces at dierent scales took several minutes on a PC. To make the system real-time reducing the dimensionality of the input space and the feature space was required. The feature selection in principal components space was used to reduce the dimensionality of the input space [15]. The method was evaluated on the large CMU test set 1 consisting of 479 faces and about 57,000,000 non-face patterns. In Figure 9, we compare the ROC curves obtained for dierent numbers of selected components. The results showed that using more than 60 components does not improve the performances of the system [15]. Figure 9: ROC curves for dierent number of PCA gray features. 9 Conclusion We proposed an approach for automatically tuning the kernel parameters of an SVM. This is based on the possibility of computing the gradient of various bounds on the generalization error with respect to these parame- ters. Dierent techniques have been proposed to smooth these bounds while preserving their accuracy in predicting the location of the minimum of test error. Using these smoothed gradients we were able to perform a gradient descent to search the kernel parameter space, leading to both an improvement of the performance and a reduction of the complexity of the solution (feature selection). Using this method, we chose in the separable case appropriate scaling factors. In the non separable case, this method allows us to choose simultaneously scaling factors and parameter C (see equation 3). The benets of this technique are many. First it allows to actually optimize a large number of parameters while previous approaches only could deal with 2 parameters at most. Even in the case of a small number of parameters, it improves the running time by a large amount. Moreover experimental results have demonstrated that an accurate estimate of the error is not required and that a simple estimate like R 2 =M 2 has a very good behaviour in terms of allowing to nd the right parameters. In a way this renders the technique even more applicable since this estimate is very simple to compute and derive. Finally, this approach avoids holding out some data for validation and thus makes full use of the training set for the optimization of parameters, contrary to cross-validation methods. This approach and the fact that it has be proven successful in various situation opens new directions of research in the theory and practice of Support Vector Machines. On the practical side, this approach makes possible the use of highly complex and tunable kernels, the tuning of scaling factors for adapting the shape of the kernel to the problem and the selection of relevant features. On the theoretical side, it demonstrates that even when a large number of parameter are simultaneously tuned the overtting eect remains low. Of course a lot of work remains to be done in order to properly understand the reasons. Another interesting phenomenon is the fact that the quantitative accuracy of the estimate used for the gradient descent is only marginally relevant. This raises the question of how to design good estimates for parameter tuning rather than accurate estimates. Future investigation will focus on trying to understand these phenomena and obtain bounds on the generalization error of the overall algorithm, along with looking for new problems where this approach could be applied as well as new applications. Acknowledgments The authors would like to thank Jason Weston and Elodie Nedelec for helpful comments and discussions. --R Medulloblastoma diagnosis and outcome prediction by gene expression pro Model selection for support vector ma- chines Support vector networks. Dynamically adapting kernels in support vector machines. Face detection in still gray images. Probabilistic kernel regression models. Adaptive regularization in neural network modeling. On estimation of characters obtained in statistical procedure of recognition. Gaussian processes and svm: Mean Probabilities for support vector machines. Feature selection for face detection. Robust bounds on generalization from the margin distribution. The Nature of Statistical Learning Theory. Statistical Learning Theory. Bounds on error expectation for support vector machines. Generalized approximate cross-validation for support vector machines : another way to look at margin- like quantities Feature selection for support vector machines. --TR --CTR Alex D. Holub , Max Welling , Pietro Perona, Hybrid Generative-Discriminative Visual Categorization, International Journal of Computer Vision, v.77 n.1-3, p.239-258, May 2008 Dit-Yan Yeung , Hong Chang , Guang Dai, Learning the kernel matrix by maximizing a KFD-based class separability criterion, Pattern Recognition, v.40 n.7, p.2021-2028, July, 2007 Tobias Glasmachers , Christian Igel, Gradient-Based Adaptation of General Gaussian Kernels, Neural Computation, v.17 n.10, p.2099-2105, October 2005 Kristin P. Bennett , Michinari Momma , Mark J. Embrechts, MARK: a boosting algorithm for heterogeneous kernel models, Proceedings of the eighth ACM SIGKDD international conference on Knowledge discovery and data mining, July 23-26, 2002, Edmonton, Alberta, Canada Yoram Baram, Learning by Kernel Polarization, Neural Computation, v.17 n.6, p.1264-1275, June 2005 Carl Gold , Alex Holub , Peter Sollich, Bayesian approach to feature selection and parameter tuning for support vector machine classifiers, Neural Networks, v.18 n.5-6, p.693-701, June 2005 Koji Tsuda , Shinsuke Uda , Taishin Kin , Kiyoshi Asai, Minimizing the Cross Validation Error to Mix Kernel Matrices of Heterogeneous Biological Data, Neural Processing Letters, v.19 n.1, p.63-72, February 2004 Carlos Soares , Pavel B. Brazdil, Selecting parameters of SVM using meta-learning and kernel matrix-based meta-features, Proceedings of the 2006 ACM symposium on Applied computing, April 23-27, 2006, Dijon, France Tristrom Cooke, Two Variations on Fisher's Linear Discriminant for Pattern Recognition, IEEE Transactions on Pattern Analysis and Machine Intelligence, v.24 n.2, p.268-273, February 2002 Carlos Soares , Pavel B. Brazdil , Petr Kuba, A Meta-Learning Method to Select the Kernel Width in Support Vector Regression, Machine Learning, v.54 n.3, p.195-209, March 2004 Sayan Mukherjee , Qiang Wu, Estimation of Gradients and Coordinate Covariation in Classification, The Journal of Machine Learning Research, 7, p.2481-2514, 12/1/2006 Alain Rakotomamonjy, Variable selection using svm based criteria, The Journal of Machine Learning Research, 3, 3/1/2003 Malte Kuss , Carl Edward Rasmussen, Assessing Approximate Inference for Binary Gaussian Process Classification, The Journal of Machine Learning Research, 6, p.1679-1704, 12/1/2005 Keith M. Sullivan , Sean Luke, Evolving kernels for support vector machine classification, Proceedings of the 9th annual conference on Genetic and evolutionary computation, July 07-11, 2007, London, England Mingrui Wu , Bernhard Schlkopf , Gkhan Bakir, Building Sparse Large Margin Classifiers, Proceedings of the 22nd international conference on Machine learning, p.996-1003, August 07-11, 2005, Bonn, Germany Andreas Argyriou , Raphael Hauser , Charles A. Micchelli , Massimiliano Pontil, A DC-programming algorithm for kernel selection, Proceedings of the 23rd international conference on Machine learning, p.41-48, June 25-29, 2006, Pittsburgh, Pennsylvania Huseyin Ince , Theodore B. Trafalis, A hybrid model for exchange rate prediction, Decision Support Systems, v.42 n.2, p.1054-1062, November 2006 Sayan Mukherjee , Ding-Xuan Zhou, Learning Coordinate Covariances via Gradients, The Journal of Machine Learning Research, 7, p.519-549, 12/1/2006 Mingrui Wu , Bernhard Schlkopf , Gkhan Bakr, A Direct Method for Building Sparse Kernel Learning Algorithms, The Journal of Machine Learning Research, 7, p.603-624, 12/1/2006 Liefeng Bo , Ling Wang , Licheng Jiao, Feature Scaling for Kernel Fisher Discriminant Analysis Using Leave-One-Out Cross Validation, Neural Computation, v.18 n.4, p.961-978, April 2006 Alain Rakotomamonjy , Francis Bach , Stphane Canu , Yves Grandvalet, More efficiency in multiple kernel learning, Proceedings of the 24th international conference on Machine learning, p.775-782, June 20-24, 2007, Corvalis, Oregon Xue-wen Chen , Jong Cheol Jeong, Minimum reference set based feature selection for small sample classifications, Proceedings of the 24th international conference on Machine learning, p.153-160, June 20-24, 2007, Corvalis, Oregon Training algorithms for fuzzy support vector machines with noisy data, Pattern Recognition Letters, v.25 n.14, p.1647-1656, 15 October 2004 Francis R. Bach , Gert R. G. Lanckriet , Michael I. Jordan, Multiple kernel learning, conic duality, and the SMO algorithm, Proceedings of the twenty-first international conference on Machine learning, p.6, July 04-08, 2004, Banff, Alberta, Canada R. Kumar , A. Kulkarni , V. K. Jayaraman , B. D. Kulkarni, Symbolization assisted SVM classifier for noisy data, Pattern Recognition Letters, v.25 n.4, p.495-504, March 2004 Sren Sonnenburg , Gunnar Rtsch , Christin Schfer , Bernhard Schlkopf, Large Scale Multiple Kernel Learning, The Journal of Machine Learning Research, 7, p.1531-1565, 12/1/2006 Kai-Quan Shen , Chong-Jin Ong , Xiao-Ping Li , Einar P. Wilder-Smith, Feature selection via sensitivity analysis of SVM probabilistic outputs, Machine Learning, v.70 n.1, p.1-20, January 2008 Zhihua Zhang , James T. Kwok , Dit-Yan Yeung, Model-based transductive learning of the kernel matrix, Machine Learning, v.63 n.1, p.69-101, April 2006 Kai-Min Chung , Wei-Chun Kao , Chia-Liang Sun , Li-Lun Wang , Chih-Jen Lin, Radius margin bounds for support vector machines with the RBF kernel, Neural Computation, v.15 n.11, p.2643-2681, November Ming-Wei Chang , Chih-Jen Lin, Leave-One-Out Bounds for Support Vector Regression Model Selection, Neural Computation, v.17 n.5, p.1188-1222, May 2005 Keem Siah Yap , Izham Z. Abidin , Abdul Rahim Ahmad , Zahrul Faizi Hussien , Hooi Loong Pok , Fariq Izwan Ismail , Abdul Malik Mohamad, Abnormalities and fraud electric meter detection using hybrid support vector machine & genetic algorithm, Proceedings of the third conference on IASTED International Conference: Advances in Computer Science and Technology, p.388-392, April 02-04, 2007, Phuket, Thailand Olivier Chapelle, Training a Support Vector Machine in the Primal, Neural Computation, v.19 n.5, p.1155-1178, May 2007 Guang Dai , Dit-Yan Yeung, Kernel selection forl semi-supervised kernel machines, Proceedings of the 24th international conference on Machine learning, p.185-192, June 20-24, 2007, Corvalis, Oregon Yiming Ying , Ding-Xuan Zhou, Learnability of Gaussians with Flexible Variances, The Journal of Machine Learning Research, 8, p.249-276, 5/1/2007 Christian Igel , Tobias Glasmachers , Britta Mersch , Nico Pfeifer , Peter Meinicke, Gradient-Based Optimization of Kernel-Target Alignment for Sequence Kernels Applied to Bacterial Gene Start Detection, IEEE/ACM Transactions on Computational Biology and Bioinformatics (TCBB), v.4 n.2, p.216-226, April 2007 Lior Wolf , Amnon Shashua, Feature Selection for Unsupervised and Supervised Inference: The Emergence of Sparsity in a Weight-Based Approach, The Journal of Machine Learning Research, 6, p.1855-1887, 12/1/2005 Baback Moghaddam , Ming-Hsuan Yang, Learning Gender with Support Faces, IEEE Transactions on Pattern Analysis and Machine Intelligence, v.24 n.5, p.707-711, May 2002 A. Rakotomamonjy, Analysis of SVM regression bounds for variable ranking, Neurocomputing, v.70 n.7-9, p.1489-1501, March, 2007 Yi Wu , Edward Y. Chang, Distance-function design and fusion for sequence data, Proceedings of the thirteenth ACM international conference on Information and knowledge management, November 08-13, 2004, Washington, D.C., USA Abdul Majid , Asifullah Khan , Anwar M. Mirza, Combination of support vector machines using genetic programming, International Journal of Hybrid Intelligent Systems, v.3 n.2, p.109-125, January 2006 Qiang Wu , Yiming Ying , Ding-Xuan Zhou, Multi-kernel regularized classifiers, Journal of Complexity, v.23 n.1, p.108-134, February, 2007 Shin Ando , Hitoshi Iba, Classification of Gene Expression Profile Using Combinatory Method of Evolutionary Computation and Machine Learning, Genetic Programming and Evolvable Machines, v.5 n.2, p.145-156, June 2004 Giorgio Valentini , Thomas G. Dietterich, Bias-Variance Analysis of Support Vector Machines for the Development of SVM-Based Ensemble Methods, The Journal of Machine Learning Research, 5, p.725-775, 12/1/2004 Fabien Lauer , Ching Y. Suen , Grard Bloch, A trainable feature extractor for handwritten digit recognition, Pattern Recognition, v.40 n.6, p.1816-1824, June, 2007 R. Brunelli, verification through finger matching: A comparison of Support Vector Machines and Gaussian Basis Functions classifiers, Pattern Recognition Letters, v.27 n.16, p.1905-1915, December, 2006 R. Brunelli, verification through finger matching: a comparison of support vector machines and Gaussian basis functions classifiers, Pattern Recognition Letters, v.27 n.16, p.1905-1915, December 2006 Gavin C. Cawley , Nicola L. C. Talbot, Constructing Bayesian formulations of sparse kernel learning methods, Neural Networks, v.18 n.5-6, p.674-683, June 2005 Gavin C. Cawley , Nicola L. C. Talbot, Fast exact leave-one-out cross-validation of sparse least-squares support vector machines, Neural Networks, v.17 n.10, p.1467-1475, December 2004 Piyush Kumar , Joseph S. B. Mitchell , E. Alper Yildirim, Approximate minimum enclosing balls in high dimensions using core-sets, Journal of Experimental Algorithmics (JEA), 8, Saher Esmeir , Shaul Markovitch, Anytime Learning of Decision Trees, The Journal of Machine Learning Research, 8, p.891-933, 5/1/2007 Sbastien Gadat , Laurent Younes, A Stochastic Algorithm for Feature Selection in Pattern Recognition, The Journal of Machine Learning Research, 8, p.509-547, 5/1/2007 K. Pelckmans , J. A. Suykens , B. Moor, Additive Regularization Trade-Off: Fusion of Training and Validation Levels in Kernel Methods, Machine Learning, v.62 n.3, p.217-252, March 2006 Gavin C. Cawley , Nicola L. C. Talbot, Preventing Over-Fitting during Model Selection via Bayesian Regularisation of the Hyper-Parameters, The Journal of Machine Learning Research, 8, p.841-861, 5/1/2007 Mathias M. Adankon , Mohamed Cheriet, Optimizing resources in model selection for support vector machine, Pattern Recognition, v.40 n.3, p.953-963, March, 2007 Mingkun Li , Ishwar K. Sethi, Confidence-based classifier design, Pattern Recognition, v.39 n.7, p.1230-1240, July, 2006 Ataollah Abrahamzadeh , Seyed Alireza Seyedin , Mehdi Dehghan, Digital-signal-type identification using an efficient identifier, EURASIP Journal on Applied Signal Processing, v.2007 n.1, p.63-63, 1 January 2007 Ron Meir , Gunnar Rtsch, An introduction to boosting and leveraging, Advanced lectures on machine learning, Springer-Verlag New York, Inc., New York, NY, Zexuan Zhu , Yew-Soon Ong , Manoranjan Dash, Markov blanket-embedded genetic algorithm for gene selection, Pattern Recognition, v.40 n.11, p.3236-3248, November, 2007
support vector machines;gradient descent;leave-one-out procedure;kernel selection;feature selection
599665
Efficient SVM Regression Training with SMO.
The sequential minimal optimization algorithm (SMO) has been shown to be an effective method for training support vector machines (SVMs) on classification tasks defined on sparse data sets. SMO differs from most SVM algorithms in that it does not require a quadratic programming solver. In this work, we generalize SMO so that it can handle regression problems. However, one problem with SMO is that its rate of convergence slows down dramatically when data is non-sparse and when there are many support vectors in the solutionas is often the case in regressionbecause kernel function evaluations tend to dominate the runtime in this case. Moreover, caching kernel function outputs can easily degrade SMO's performance even more because SMO tends to access kernel function outputs in an unstructured manner. We address these problems with several modifications that enable caching to be effectively used with SMO. For regression problems, our modifications improve convergence time by over an order of magnitude.
Introduction A support vector machine (SVM) is a type of model that is optimized so that prediction error and model complexity are simultaneously minimized [13]. Despite having many admirable qualities, research into the area of SVMs has been hindered by the fact that quadratic programming (QP) solvers provided the only known training algorithm for years. In 1997, a theorem [6] was proved that introduced a whole new family of SVM training procedures. In a nutshell, Osuna's theorem showed that the global SVM training problem can be broken down into a sequence of smaller subproblems and that optimizing each subproblem minimizes the original QP problem. Even more recently, the sequential minimal optimization algorithm (SMO) was introduced [7, 9] as an extreme example of Osuna's theorem in practice. Because SMO uses a subproblem of size two, each subproblem has an analytical solution. Thus, for the rst time, SVMs could be optimized without a QP solver. In addition to SMO, other new methods [5, 2] have been proposed for optimizing SVMs online without a QP solver. While these other online methods hold great promise, SMO is the only online SVM optimizer that explicitly exploits the quadratic form of the objective function and simultaneously uses the analytical solution of the size two case. e While SMO has been shown to be eective on sparse data sets and especially fast for linear SVMs, the algorithm can be extremely slow on non-sparse data sets and on problems that have many support vectors. Regression problems are especially prone to these issues because the inputs are usually non-sparse real numbers (as opposed to binary inputs) with solutions that have many support vectors. Because of these constraints, there have been no reports of SMO being successfully used on regression problems. In this work, we derive a generalization of SMO to handle regression problems and address the runtime issues of SMO by modifying the heuristics and underlying algorithm so that kernel outputs can be eectively cached. Conservative results indicate that for high- dimensional, non-sparse data (and especially regression problems), the convergence rate of SMO can be improved by an order of magnitude or more. This paper is divided into six additional sections. Section 2 contains a basic overview of SVMs and provides a minimal framework on which the later sections build. In Section 3, we generalize SMO to handle regression problems. This simplest implementation of SMO for regression can optimize SVMs on regression problems but with very poor convergence rates. In Section 4, we introduce several modications to SMO that allow kernel function outputs to be eciently cached. Section 5 contains numerical results that show that our modications produce an order of magnitude improvement in convergence speed. Finally, Section 6 summarizes our work and addresses future research in this area. 2 Introduction to SVMs Consider a set of data points, d is an input and y i is a target output. An SVM is a model that is calculated as a weighted sum of kernel function outputs. The kernel function can be an inner product, Gaussian basis function, polynomial, or any other function that obeys Mercer's condition. Thus, the output of an SVM is either a linear function of the inputs, or a linear function of the kernel outputs. Because of the generality of SVMs, they can take forms that are identical to nonlinear regression, radial basis function networks, and multilayer perceptrons. The dierence between SVMs and these other methods lies in the objective functions that they are optimized with respect to and the optimization procedures that one uses to minimize these objective functions. In the linear, noise-free case for classication, with y i 2 f1; 1g, the output of an SVM is written as f(x; and the optimization task is dened as: subject to y i Intuitively, this objective function expresses the notion that one should nd the simplest model that explains the data. This basic SVM framework has been generalized to include slack variables for miss-classications, nonlinear kernel functions, regression, as well as other extensions for other problem domains. It is beyond the scope of this paper to describe the derivation of all of these extensions to the basic SVM framework. Instead, we refer the reader to the excellent tutorials [1] and [11] for introductions to SVMs for classication and regression, respectively. We delve into the derivation of the specic objective functions only as far as necessary to set the framework from which we present our own work. In general, one can easily construct objective functions similar to Equation 1 that include slack variables for misclassication and nonlinear kernels. These objective functions can also be modied for the special case of performing regression, i.e., with y i 2 R instead of y 1g. Such objective functions will always have a component that should be minimized and linear constraints that must be obeyed. To optimize the objective function, one converts it into the primal Lagrangian form which contains the minimization terms minus the linear constraints multiplied by Lagrange multipliers. The primal Lagrangian is converted into a dual Lagrangian where the only free parameters are the Lagrange multipliers. In the dual form, the objective function is quadratic in the Lagrange multipliers; thus, the obvious way to optimize the model is to express it as a quadratic programming problem with linear constraints. Our contribution in this paper uses a variant of Platt's sequential minimal optimization method that is generalized for regression and is modied for further eciencies. SMO solves the underlying QP problem by breaking it down into a sequence of smaller optimization subproblems with two unknowns. With only two unknowns, the parameters have an analytical solution, thus avoiding the use of a QP solver. Even though SMO does not use a QP solver, it still makes reference to the dual Lagrangian objective functions. Thus, we now dene the output function of nonlinear SVMs for classication and regression, as well as the dual Lagrangian objective functions that they are optimized with respect to. In the case of classication, with y i 2 f1; 1g, the output of an SVM is dened as: where K(x a ; x b ) is the underlying kernel function. The dual objective function (which should be minimized) is: subject to the box constraint 0 i C; 8 i and the linear constraint 0: C is a user-dened constant that represents a balance between the model complexity and the approximation error. Regression for SVMs minimize functionals of the form:N where jj is an -insensitive error function dened as: jxj otherwise and the output of the SVM now takes the form of: e Intuitively, i and i are \positive" and \negative" Lagrange multipliers (i.e., a single weight) that obey 0 The dual form of Equation 4 is written as where one should minimize the objective function with respect to and , subject to the constraints: The parameter C is the same user-dened constant that represents a balance between the model complexity and the approximation error. In later sections, we will make extensive use of the two dual Lagrangians in Equations 3 and 6, and the SVM output functions in Equations 2 and 5. 3 SMO and Regression As mentioned earlier, SMO is a new algorithm for training SVMs. SMO repeatedly nds two Lagrange multipliers that can be optimized with respect to each other and analytically computes the optimal step for the two Lagrange multipliers. When no two Lagrange multipliers can be optimized, the original QP problem is solved. SMO actually consists of two parts: (1) a set of heuristics for eciently choosing pairs of Lagrange multipliers to work on, and (2) the analytical solution to a QP problem of size two. It is beyond the scope of this paper to give a complete description of SMO's heuristics. More information can be found in Platt's papers [7, 9]. Since SMO was originally designed (like SVMs) to only be applicable to classication problems, the analytical solution to the size two QP problem must be generalized in order for SMO to work on regression problems. The bulk of this section will be devoted to deriving this solution. 3.1 Step Size Derivation We begin by transforming Equations 5,6, and 7 by substituting . Thus, the new unknowns will obey the box constraint C i C; 8 i . We will also use the shorthand . The model output and objective function can now be written as: e with the linear constraint Our goal is to analytically express the minimum of Equation 9 as a function of two parameters. Let these two parameters have indices a and b so that a and b are the two unknowns. We can rewrite Equation 9 as a k aa +2 2 a b k ab + a v a where L c is a term that is strictly constant with respect to a and b , and v i is dened as a k ai with f Note that a superscript is used above to explicitly indicate that values are computed with the old parameter values. This means that these portions of the expression will not be a function of the new parameters (which simplies the derivation). If we assume that the constraint, true prior to any change to a and b , then in order for the constraint to be true after a step in parameter space, the sum of a and b must be held xed. With this in mind, let s a b . We can now rewrite Equation 10 as a function of a single Lagrange multiplier by substituting s a To solve Equation 12, we need to compute its partial derivative with respect to b ; however, Equation 12 is not strictly dierentiable because of the absolute value function. Neverthe- less, if we take djxj=dx = sgn(x), the resulting derivative is algebraically consistent: @L d a setting Equation 13 to zero yields: a v a f a k aa a a k aa a a f From Equation 14, we can write a recursive update rule for b in terms of its old value: [y b y a a f While Equation 15 is recursive because of the two sgn() functions, it still has a single solution that can be found quickly, as will be shown in the next subsection. a < 0 < b Figure 1: The derivative as a function of b If the kernel function obeys Mercer's condition, then the derivative (Equation 13) will always be strictly increasing. 3.2 Finding Solutions Figure how the partial derivative (Equation 13) of the dual Lagrangian function with respect to b behaves. If the kernel function of the SVM obeys Mercer's condition (as all common ones do), then we are guaranteed that will always be true. If is strictly positive, then Equation 13 will always be increasing. Moreover, if s is not zero, then it will be piecewise linear with two discrete jumps, as illustrated in Figure 1. Putting these facts together means that we only have to consider ve possible solutions for Equation 13. Three possible solutions correspond to using Equation 15 with (sgn( a ) set to -2, 0, and 2. The other two candidates correspond to setting b to one of the transitions in Figure 1: We also need to consider how the linear and boxed constraints relate to one another. In particular, we need lower and upper bounds for b that insure that both a and b are within the C range. Using: with L and H being the lower and upper bounds, respectively, guarantees that both parameters will obey the boxed constraints. 3.3 KKT Conditions The step described in this section will only minimize the global objective function if one or both of the two parameters violates a Karush-Kuhn-Tucker (KKT) condition. The KKT conditions for regression are: These KKT conditions also yield a test for convergence. When no parameter violates any KKT condition, then the global minimum has been reached within machine precision. 3.4 Updating the Threshold To update the SVM threshold, we calculate two candidate updates. The rst update, if used along with the new parameters, forces the SVM to have f a = y a . The second forces neither update for the other two parameters hits a constraint, then the two candidate updates for the threshold will be identical. Otherwise, we average the candidate updates. a a y a new a old a new b old new a old a new b old These update rules are nearly identical to Platt's original derivation. Complete Update Rule SMO can work on regression problems if the following steps are performed. Pick two parameters, a and b , such that at least one parameter violates a KKT condition as dened in Equation 18. Compute { Try Equation 15 with (sgn( a ) sgn( b )) equal to -2, 0, and 2. If the new value is a zero to Equation 13, then accept that as the new value. { If the above step failed, try b equal to 0 or s . Accept the value that has the property such that all positive (negative) perturbations yield a positive (negative) value for Equation 13. If raw new b < L, set new L. Otherwise, set new Set new a b new b . Set new specied in Equations 19 and 20. The outer loop of SMO|that is, all of the non-numerical parts that make up the heuristics| can remain the same. As will be discussed in Section 5, further modications can be made to SMO that improve the rate of convergence on regression problems by as much as an order of magnitude. e While further progress can be made: 1. If this is the rst iteration, or if the previous iteration made no progress, then let the working set be all data points. 2. Otherwise, let the working set consist only of data points with non-bounded Lagrange multipliers. 3. For all data points in the working set, try to optimize the corresponding Lagrange multiplier. To nd the second Lagrange multiplier: 3.1. Try the best one (found from looping over the non-bounded multipliers) according to Platt's heuristic, or 3.2. Try all among the working set, or 3.3. Try to nd one among the entire set of Lagrange multipliers. 4. If no progress was made and working set was all data points, then done. Figure 2: Basic Pseudo-code for SMO 4 Building a Better SMO As described in Section 2, SMO repeatedly nds two Lagrange multipliers that can be optimized with respect to each other and analytically computes the optimal step for the two Lagrange multipliers. Section 2 was concerned with the analytical portion of the algorithm. In this section, we concentrate on the remainder of SMO which consists of several heuristics that are used to pick pairs of Lagrange multipliers to optimize. While it is beyond the scope of this paper to give a complete description of SMO, Figure 2 gives basic pseudo-code for the algorithm. For more information, consult one of Platt's papers [7, 9]. Referring to Figure 2, notice that the rst Lagrange multiplier to work on is chosen at line 3; and its counterpart is chosen at line 3.1, 3.2, or 3.3. SMO attempts to concentrate its eort where it is most needed by maintaining a working set of non-bounded Lagrange multipliers. The idea is that Lagrange multipliers that are at bounds (either 0 or C for classication, or 0 or C for regression) are mostly irrelevant to the optimization problem and will tend to keep their bounded values. At best, each optimization step will take time proportional to the number of Lagrange multipliers in the working set and, at worst, will take time proportional to the entire data set. However, the runtime is actually much slower than this analysis implies because each candidate for the second Lagrange multiplier requires three kernel functions to be evaluated. If the input dimensionality is large, then the kernel evaluations may be a signicant factor in the time complexity. All told, we can express the runtime of a single SMO step as O (p W d is the probability that the second Lagrange multiplier is in the working set, W is the size of the working set, and d is the input dimensionality. The goal of this section is to reduce the runtime complexity for a single SMO step down e to O (p 0 W Additionally, a method for reducing the total number of required SMO steps is also introduced, so we also reduce the cost of the outer most loop of SMO as well. Over the next ve subsections, several improvements to SMO will be described. The most fundamental change is to cache the kernel function outputs. However, a naive caching policy actually slows down SMO since the original algorithm tends to randomly access kernel outputs with high frequency. Other changes are designed either to improve the probability that a cached kernel output can be used again or to exploit the fact that kernel outputs have been precomputed. 4.1 Caching Kernel Outputs A cache is typically understood to be a small portion of memory that is faster than normal memory. In this work, we use cache to refer to a table of precomputed kernel outputs. The idea here is that frequently accessed kernel outputs should be stored and reused to avoid the cost of recomputation. Our cache data structure contains an inverse index, I, with M entries such that I i refers to the index (in the main data set) of the ith cached item. We maintain a two-dimensional MM array to store the cached values. Thus, for any 1 < we either have the precomputed value of k ab stored in the cache or we have space allocated for that value and a ag set to indicate that the kernel output needs to be computed and saved. The cache can have any of the following operations applied to it: returns one of three values to indicate that k ab is either (1) not in the cache, (2) allocated for the cache but not present, or (3) in the cache. ab and force it into the cache, if it is not present already. The least recently used indices in I are replaced by a and b. return k ab by the fastest method available. mark indices a and b as the most recently used elements. We use a least recently used policy for updating the cache as would be expected but with the following exceptions: For all i, k ii is maintained in its own separate space since it is accessed so frequently. If SMO's working set is all Lagrange multipliers (as determined in step 1 of Figure 2), then all accesses to the cache are done without tickles and without inserts. If the working set is a proper subset and both requested indices are not in part of the working set, then the access is done with neither a tickle nor an insert. Without the above modication, caching kernel outputs in SMO usually degrades the runtime because of the frequency of cache misses and the extra overhead incurred. Our modied caching policy makes caching benecial; however, the next set of heuristic can improve the eectiveness of caching even more. 4.2 Eliminating Thrashing As shown in lines 3.1, 3.2, and 3.3 of Figure 2, SMO uses a hierarchy of selection methods in order to nd a second multiplier to optimize along with the rst. It rst tries to nd a very good one with a heuristic. If that fails, it settles for anything in the working set. But if that fails, SMO then starts searching through the entire training set. Line 3.3 causes problems in SMO for two reasons. First, it entails an extreme amount of work that results in only two multipliers changing. Second, if caching is used, line 3.3 could interfere with the update policies of the cache. To avoid these problems, we use a heuristic which entails a modication to SMO such that line 3.3 is executed only if the working set is the entire data set. We must execute it, in this case, to be sure that convergence is achieved. Platt [8] has proposed a modication with a similar goal in mind. In our example source code (which can be accessed via the URL given at the end of this paper) this heuristic corresponds to using the command-line option -lazy, which is short for \lazy loops". 4.3 Optimal Steps The next modication to SMO takes advantage of the fact that cached kernel outputs can be accessed in constant time. Line 3.1 of Figure 2 searches over the entire working set and nds the multiplier that approximately yields the largest step size. However, if kernel outputs for two multipliers are cached, then computing the change to the objective function that results from optimizing the two multipliers takes constant time to calculate. Thus, by exploiting the cached kernel outputs, we can greedily take the step that yields the most improvement. Let b be the rst multiplier selected in line 3 of Figure 2. For all a such that k ab is cached, we can calculate new values for the two multipliers analytically and in constant time. Let the old values for multipliers use superscripts, as in a and b . Moreover, let i be shorthand for the new and old values for the SVM output. 1 The change to the classication objective function (Equation 3) that results from accepting the new multipliers is: y a a k aa 0 ) a y a (f y a a k aa ab (y a y b a b y a y b a a Equation 21 is derived by substituting for in Equation 3, and rewriting the equation so that all terms are trivially dependent or independent on a and/or b . Afterwards, the dierence between two choices for the two multipliers can be calculated without any summations because the independent terms cancel. 1 Note that in this section, we refer to all Lagrange multipliers by and not . We do this to maintain consistency with earlier sections, even though this notation con icts with Equations 3 and 6. e The change to the regression objective function (Equation can be similarly calculated a (f a y a2 a k aa b y b2 k ab ( a b a b Thus, we modify SMO by replacing line 3.1 in Figure 2 with code that looks for the best second multiplier via Equation 21 or 22 for all a such that k ab is cached. In our example source code, this heuristic corresponds to using the command-line option -best, which is short for \best step". 4.4 On Demand Incremental SVM Outputs The next modication to SMO is a method to calculate SVM outputs more rapidly. Without loss of generality, assume we have an SVM that is used for classication and that the output of the SVM is determined from Equation 2 (but with substituted for ). There are at least three dierent ways to calculate the SVM outputs after a single Lagrange multiplier, Use Equation 2, which is extremely slow. Change Equation 2 so that the summation is only over the nonzero Lagrange multipliers Incrementally update the new value with f Clearly, the last method is the fastest. SMO, in its original form, uses the third method to update the outputs whose multipliers are non-bounded (which are needed often) and the second method when an output is needed that has not been incrementally updated. We can improve on this method by only updating outputs when they are needed, and by computing which of the second or third method above is more ecient. To do this, we need two queues with maximum sizes equal to the number of Lagrange multipliers and a third array to store a time stamp for when a particular output was last updated. Whenever a Lagrange multiplier changes value, we store the change to the multiplier and the change to 0 in the queues, overwriting the oldest value. When a particular output is required, if the number of time steps that have elapsed since the output was last updated is less than the number of nonzero Lagrange multipliers, we can calculate the output from its last known value and from the changed values in the queues. However, if there are fewer nonzero Lagrange multipliers, it is more ecient to update the output using the second method. Since the outputs are updated on demand, if the SVM outputs are accessed in a nonuniform manner, then this update method will exploit those statistical irregularities. In our example source code, this heuristic corresponds to using the command-line option -clever, which is short for \clever outputs". 4.5 SMO with Decomposition Using SMO with caching along with all of the proposed heuristics yields a signicant runtime improvement as long as the cache size is at nearly as large as the number of support vectors in the solution. When the cache size is too small to t all of the kernel outputs for each support vector pair, accesses to the cache will fail and runtime will be increased. This particular problem can be addressed by combining Osuna's decomposition algorithm [6] with SMO. The basic idea is to iteratively build an M M subproblem with 2 < M < N , solve the subproblem, and then iterate with a new subproblem until the entire optimization problem is solved. However, instead of using a QP solver to solve the subproblem, we use SMO and choose M to be as large as the cache. The benets of this combination are two-fold. First, much evidence indicates that decomposition can often be faster than using a QP solver. Since the combination of SMO and decomposition is functionally identical to standard decomposition with SMO as the QP solver, we should expect the same benet. Second, using a subproblem that is the same size as the cache guarantees that all of the kernel outputs required will be available at every SMO iteration except for the rst for each subproblem. However, we note that our implementation of decomposition is very naive in the way it constructs subproblems, since it essentially works on the rst M randomly selected data points that violate a KKT condition. In our example source code, this heuristic corresponds to using the command-line option -ssz M , which is short for \subset size". 5 Experimental Results To evaluate the eectiveness of our modications to SMO we chose the Mackey-Glass system [4] as a test case because it is highly chaotic (making it a challenging regression problem) and well-studied. The Mackey-Glass system is described by the delay-dierential equation: dx dt For all experiments, we used the parameter settings 1 (for numerical integration), which yields a very chaotic time series with an embedding dimension of 4. To perform forecasting, we use a time-delay embedding [12] to approximate the map: with equal to 4, 6, or 8. Thus, we are predicting 85 time steps into the future with an SVM with 4, 6, or 8 inputs. The purpose of this work is not to evaluate the prediction accuracy of SVMs on chaotic time series as has been done in [5]. Our focus is on the amount of time required to optimize a support vector machine. Since the objective function for optimizing SVMs is quadratic with linear constraints, all SVMs will have either a single global minimum or a collection of minima that are identical in the objective function valuation. Hence, excepting minor numerical dierences between implementations, all SVM optimization routines essentially 0.60.811.21.4 (a) true predicted0.50.70.91.11.30 50 100 150 200 250 300 350 400 true predicted0.611.4 (c) true support vector0.611.4 true support vector Figure 3: The Mackey-Glass system: actual and predicted time series for (a) two-dimensional phase space plots to show the location of support vectors for (c) and (d) nd the same solution; they only dier in how they nd the solution, how long it takes to get there, and how much memory is required. Figure 3 shows four plots from two training runs that illustrate the Mackey-Glass time series and phase-space. The time series plots show predictions for the two values of , and the phase-space plots show the location of the support vectors in a two dimensional slice of the time-delay embedding. The rst part of our experimental results are summarized in Tables 1 and 2. In these experiments, the time series consisted of 500 data points which, depending on the values of d, , and T , yield a number of exemplars less than 500. The major blocks (three in each table) summarize a specic problem instance which has a unique set of values for and d. Within each block, we performed all combinations of using SMO with and without caching, with and without decomposition, and with and without all three heuristics. Each block in the tables also contains results from using the Royal Holloway / AT&T / GMD FIRST SV Machine code (RAGSVM) [10]. RAGSVM can work with three dier- ent optimization packages, but only one optimizer is freely available for research that can be used on regression problems: BOTTOU, an implementation of the conjugate gradient method. Entries in the blocks labelled as \QP" use RAGSVM with BOTTOU without the chunking option. Entries labelled as \QP/Chunk" use \sporty chunking" which uses the decomposition method with the specied subset size and the QP solver on the subproblem. In general, the training runs were congured as similarly as possible, each using Gaussian kernels of the form: K(x a all congurations produces results nearly identical to RAGSVM with respect to the value of the objective function found. However, the run times are dramatically dierent for the two implementations. For these sets of experiments, SMO with caching and the heuristics consistently gave the fastest run times, often performing orders of magnitude faster than regular SMO, QP, and decomposition. The speed improvements for SMO ranged from a factor of 3 to as much as 25. Interestingly, on these experiments, SMO with decomposition consistently yielded inferior run times compared to SMO without decomposition, regardless of other runtime options. Our motivation for combining SMO with decomposition was to make caching effective on problems with many data points. Since the rst set of experiments only used 500 data points, we used the same Mackey-Glass parameters to generate a time series with 10,000 data points for further experimentation. Table 3 summarizes the second set of experiments. For these experiments, we chose to only vary whether SMO was used with or without decomposition. As can be seen in the table, SMO without decomposition gives nearly an order of magnitude improvement in runtime compare to RAGSVM while SMO with decomposition yields even faster run times. However, SMO with decomposition yields a very high standard deviation with the fastest and slowest run times being 391 and 1123 seconds, respectively. We suspect that the high standard deviation is a result of our naive implementation of decomposition. Nevertheless, the worst case for SMO with decomposition is nearly as good as the best for SMO without decomposition. Moreover, on this problem set, SMO with decomposition can be nearly 25 times faster than decomposition with a QP solver. In fact, the solutions found by SMO in all experiments from Table 3 are superior to the RAGSVM solutions in that the nal objective function values are signicantly larger in magnitude in the SMO runs. e training subset cache options objective number CPU std. method size size (for SMO) value of SVs time dev. problem instance: SMO 100 100 none 15:9198 70:5 42:72 7:53 SMO 100 100 all 15:9247 67:9 7:64 1:04 QP | | | 15:9002 63 85:22 | QP/Chunk 100 | | 15:8809 59 20:24 | problem instance: SMO 100 100 none 5:4620 63:2 35:70 6:25 SMO 100 100 all 5:4636 62:7 6:06 0:93 QP | | | 5:4698 59 62:86 | QP/Chunk 100 | | 5:4619 problem instance: SMO 100 100 none 2:3005 55:4 13:65 3:80 SMO 100 100 all 2:3031 53 3:45 0:59 QP | | | 2:2950 51 40:86 | QP/Chunk 100 | | 2:2899 38 6:30 | Table 1: Experimental results (part 1/2): all SMO results are averaged over ten trials. Entries where heuristics have the value of \all" indicate that \lazy loops" (from Section 4.2), \best step" (Section 4.3), and \clever outputs" (Section 4.4) are all used. The entries for the subset size indicate the size for decomposition (with \0" meaning no decomposition). All times are in CPU seconds on a 500 MHz Pentium III machine running Linux. Ecient SVM Training Flake & Lawrence training subset cache options objective number CPU std. method size size (for SMO) value of SVs time dev. problem instance: SMO 100 100 none 84:0284 196:8 184:12 22:32 SMO 100 100 all 83:8655 195:3 40:60 5:69 QP | | | 84:0401 194 186:63 | QP/Chunk 100 | | 84:0290 188 316:54 | problem instance: SMO 100 100 none 48:1120 170:5 278:76 31:27 SMO 100 100 all 48:1283 169 75:09 14:38 QP | | | 48:1430 159 245:67 | QP/Chunk 100 | | 48:1505 164 310:21 | problem instance: SMO 100 100 none 27:8421 164:9 289:26 29:13 SMO 100 100 all 27:8663 159:8 76:66 12:69 QP | | | 27:8958 149 257:40 | QP/Chunk 100 | | 27:8941 144 329:91 | Table 2: Experimental results (part 2/2): all SMO results are averaged over ten trials. Entries where heuristics have the value of \all" indicate that \lazy loops" (from Section 4.2), \best step" (Section 4.3), and \clever outputs" (Section 4.4) are all used. The entries for the subset size indicate the size for decomposition (with \0" meaning no decomposition). All times are in CPU seconds on a 500 MHz Pentium III machine running Linux. e training subset cache options objective number CPU std. method size size (for SMO) value of SVs time dev. SMO 500 500 all 93:8975 393:25 625:45 295:85 QP/Chunk 500 | | 87:2486 287 9314:89 | Table 3: Experimental results for problem instance data points in the time series. SMO statistics are over four trials. All times are in CPU seconds on a 500 MHz Pentium III machine running Linux. But why does SMO with decomposition help on large data sets? For a caching policy to be eective, the cached elements must have a relatively high probability of being reused before they are replaced. On large data sets, this goal is far more dicult to achieve. Moreover, SMO must periodically loop over all exemplars in order to check for convergence. Using SMO with decomposition makes caching much easier to implement eectively because we can make the subset size for decomposition the same size as the cache, thus guaranteeing that cached elements can be reused with high probability. 6 Conclusions This work has shown that SMO can be generalized to handle regression and that the run-time of SMO can be greatly improved for datasets dense with support vectors. Our main improvement to SMO has been to implement caching along with heuristics that assist the caching policy. In general, the heuristics are designed to either improve the probability that cached kernel outputs will be used or exploit the fact that cached kernel outputs can be used in ways that are infeasible for non-cached kernel outputs. Our numerical results show that our modications to SMO yield dramatic runtime improvements. Moreover, our implementation of SMO can outperform state-of-the-art SVM optimization packages that use a conjugate gradient QP solver and decomposition. Because kernel evaluations are more expensive the higher the input dimensionality, we believe, but have not shown, that our modications to SMO will be even more valuable on larger datasets with high input dimensionality. Preliminary results indicate that these changes can greatly improve the performance of SMO on classication tasks that involve large, high-dimensional, and non-sparse data sets. Future work will concentrate on incremental methods that gradually increase numerical accuracy. We also believe that the improvement to SMO described in [3] can be adapted to regression problems as well. Moreover, altering our decomposition scheme should yield further improvements. Acknowledgements We thank Tommy Poggio, John Platt, Edgar Osuna, Constantine Papageorgious, and Sayan Mukherjee for helpful discussions. Special thanks to Tommy Poggio and the Center for Biological and Computational Learning at MIT for hosting the rst author during this research. e A Source Code Availability The source code used in this work is part of NODElib, the Neural Optimization and Development library. NODElib is freely available under a \copyleft" licensing agreement, and can be downloaded from http://www.neci.nj.nec.com/homepages/flake/nodelib.tgz. --R A tutorial on support vector machines for pattern recognition. The Kernel-Adatron: a fast and simple learning procedure for support vector machines Improvements to Platt's SMO algorithm for SVM classi Oscillation and chaos in physiological control systems. Nonlinear prediction of chaotic time series using support vector machines. An improved training algorithm for support vector machines. Fast training of support vector machines using sequential minimal optimiza- tion Private communication Using sparseness and analytic QP to speed training of support vector ma- chines Detecting strange attractors in turbulence. The Nature of Statistical Learning Theory. --TR --CTR Gary W. Flake , Eric J. Glover , Steve Lawrence , C. Lee Giles, Extracting query modifications from nonlinear SVMs, Proceedings of the 11th international conference on World Wide Web, May 07-11, 2002, Honolulu, Hawaii, USA Adriano L. I. Oliveira, Letters: Estimation of software project effort with support vector regression, Neurocomputing, v.69 n.13-15, p.1749-1753, August, 2006 Shuo-Peng Liao , Hsuan-Tien Lin , Chih-Jen Lin, A note on the decomposition methods for support vector regression, Neural Computation, v.14 n.6, p.1267-1281, June 2002 Chih-Chung Chang , Chih-Jen Lin, Training v-support vector regression: theory and algorithms, Neural Computation, v.14 n.8, p.1959-1977, August 2002 Vivek Sehgal , Lise Getoor , Peter D Viechnicki, Entity resolution in geospatial data integration, Proceedings of the 14th annual ACM international symposium on Advances in geographic information systems, November 10-11, 2006, Arlington, Virginia, USA Quan Yong , Yang Jie , Yao Lixiu , Ye Chenzhou, An improved way tomake large-scale SVR learning practical, EURASIP Journal on Applied Signal Processing, v.2004 n.1, p.1135-1141, 1 January 2004 Jian-xiong Dong , Adam Krzyzak , Ching Y. Suen, Fast SVM Training Algorithm with Decomposition on Very Large Data Sets, IEEE Transactions on Pattern Analysis and Machine Intelligence, v.27 n.4, p.603-618, April 2005
support vector machines;optimization;regression;caching;quadratic programming;sequential minimal optimization
599666
A Simple Decomposition Method for Support Vector Machines.
The decomposition method is currently one of the major methods for solving support vector machines. An important issue of this method is the selection of working sets. In this paper through the design of decomposition methods for bound-constrained SVM formulations we demonstrate that the working set selection is not a trivial task. Then from the experimental analysis we propose a simple selection of the working set which leads to faster convergences for difficult cases. Numerical experiments on different types of problems are conducted to demonstrate the viability of the proposed method.
Introduction The support vector machine (SVM) is a new and promising technique for classication. Surveys of SVM are, for example, Vapnik (1995, 1998) and Scholkopf et al. (1998). Given training vectors x i in two classes, and a vector y 2 R l such that 1g, the support vector technique requires the solution of the following optimization problem: l Training vectors x i are mapped into a higher (maybe innite) dimensional space by the function . The existing common method to solve (1.1) is through its dual, a nite quadratic programming problem: where e is the vector of all ones, C is the upper bound of all variables, Q is an l by l positive semidenite is the kernel. The diculty of solving (1.2) is the density of Q because Q ij is in general not zero. In this case, Q becomes a fully dense matrix so a prohibitive amount of memory is required to store the matrix. Thus traditional optimization algorithms such as Newton, Quasi Newton, etc., cannot be directly applied. Several authors (for example, Osuna et al. (1997), Joachims (1998), Platt (1998), and Saunders et al. (1998)) have proposed decomposition methods to conquer this diculty and reported good numerical results. Basically they separate the of the training set to two sets B and N , where B is the working set and If we denote B and N as vectors containing corresponding elements, the objective value is equal to 1 T N QNN N e T N N . At each iteration, N is xed and the following sub-problem with the variable B is solved: where QBB QBN QNB QNN is a permutation of the matrix Q and q is the size of B. The strict decrease of the objective function holds and the theoretical convergence was studied in Chang et al. (1999). Usually a special storage using the idea of a cache is used to store recently used Q ij . Hence the computational cost of later iterations can be reduced. However, the computational time is still strongly related to the number of iterations. As the main thing which aects the number of iterations is the selection of working sets, a careful choice of B can dramatically reduce the number of iterations. This will be the main topic of this paper. Instead of (1.1), in this paper, we decide to work on a dierent SVM formulation: l Its dual becomes a bound-constrained problem: This formulation was proposed and studied by Mangasarian and Musicant (1999), and Friess et al. (1998). We think it is easier to handle a problem without general linear constraints. More importantly, when solving (1.2), a numerical diculty is on deciding whether a variable is at the bound or not because it is generally not recommended to compare a oating-point number with another one. For example, to calculate b of (1.2), we use the following KKT condition y Therefore, we can calculate b by (1.6) where i is any element in B. However, when implementing (1.6), we cannot directly compare i to 0 or C. In SV M light by Joachims (1998), a small introduced. They consider i to be free if i a and i C a . Otherwise, if a wrong i is considered, the obtained b can be erroneous. On the other hand, if the bounded formulation is used and appropriate solvers for sub-problem (2.9) are used, it is possible to directly compare i with 0 or C without needing an a . For example, in Lin and More (1999), they used a method called \project gradient" and in their implementation all values at bounds are done by direct assignments. Hence it is safe to compare i with 0 or C. To be more precise, for oating-point computation, if i C is assigned somewhere, a future oating-point comparison between C and C returns true as they both have the same internal representation. Later in this paper we will also show that bounded formulations provide more exibility on the selection of the working set. Of course we may worry that (1.5) produces a solution which is not as good as that of (1.2). Indeed (1.5) is nding a separating hyperplane passing through the origin with the maximal margin on data [(x i In Mangasarian and Musicant (1999, Proposition 2.1), they showed that under some conditions, (1.2) and (1.5) produce the same decision function. However, in Cristianini and Shawe-Taylor (2000), they showed that this approach can increase the VC-dimension so the error rate for classifying test data may not be as good as using (1.2). Up to now there is no numerical experiments on this issue. In this paper we will conduct some comparisons. Results indicate that practically (1.5) is an acceptable formulation. In Section 2, through tests of dierent selections of the working set, we show that nding a good strategy is not a trivial task. Based on our observations, we propose a simple selection which leads to faster convergences in dicult cases. In Section 3, we implement the proposed algorithm as the software BSVM and compare it with SV M light (Joachims, 1998) on problems with dierent size. After obtaining classiers from training data, we also compare error rates for classifying test data by using (1.2) and (1.5). Finally in Section 4, we present discussions and conclusions. A preliminary version of the software BSVM is available at the authors' homepage. z 2 Selection of the Working Set Among existing methods, Osuna et al. (1997), and Saunders et al. (1998) nd the working set by choosing elements which violate the KKT condition. Platt (1998) has a special heuristic but his algorithm is mainly on the case when 2. A systematic way is proposed by Joachims (1998). In his software SV M light , the following problem is solved: y where we represent is the solution at the kth iteration, rf( k ) is the gradient of f() at k . Note that jfd i j d i 6= 0gj means the number of components z BSVM is available at http://www.csie.ntu.edu.tw/~cjlin/bsvm of d which are not zero. The constraint (2.2) implies that a descent direction involving only q variables is obtained. Then components of k with non-zero d i are included in the working set B which is used to construct the sub-problem (2.9). Note that d is only used for identifying B but not as a search direction. Joachims (1998) showed that the computational time for solving (2.1) is mainly on nding the q=2 largest and q=2 smallest elements of y Hence the cost is O(ql) which is aordable in his implementation. Therefore, following SV M light , for solving (1.5), a natural method to choose the working set B is by a similar problem: d ; (2.4) where C otherwise. Note that now f() becomes 1 This problem is essentially the same as except that we strictly enforce 0 Note that in (2.1). if 0 < it is possible that ( k is not in [0; C]. The use of is like that you draw a small circle and then nd the best linear approximation of f() in the intersection of a disk and the feasible region. Since d is only used for deciding B, if instead any ; 0 < 1 is used in (2.4), the same B is obtained. Of course we can consider another type of constraints without restricting the size of d: We do not consider this as a good method because in nal iterations, any consideration should be in a small region. Note that solving (2.3) is very easy by calculating the following vector: contains indices of the smallest q elements of v. Interestingly, for the bound- constrained formulation, solving (2.3) is the same as nding maximal violated elements of the KKT condition. Note that elements which violate the KKT condition are Hence, the q maximal violated elements are the smallest q elements of v. A similar relation between the KKT condition of (1.2) and (2.2) is not very easy to see as the KKT condition of (1.2) involves the number b which does not appear in (2.2). An interpretation is given by considers possible intervals of b and select the most violated points through end points of these intervals. These approaches are reasonable as intuitively we think that nding the most violated elements is a natural choice. However, unlike SV M light , this selection of the working set does not perform well. In the rest of this paper we name our implementation BSVM. In Table 2.1, by solving the problem heart from the Statlog collection (Michie, Spiegelhalter, & Taylor, 1994), we can see that BSVM is much worse than SV M light . Table 2.1: Problem heart: comparison in early iterations light iter. obj. #free #C y light takes only 63 iterations but BSVM takes 590 iterations. In this experiment, we use K(x methods use similar stopping criteria and the initial solution is zero. The column \#C" presents the number of elements of k which are at the upper bound C. Columns y number of elements in B in two dierent classes. Note that here for easy experiments, we use simple implementation of SV M light and BSVM written in MATLAB. We observe that in each of the early iterations, all components of the working set are in the same class. The decrease of objective values of BSVM is much slower than that of light . In addition, the number of variables at the upper bound after seven SV M light iterations is many more than that of BSVM while BSVM produces iterations with more free variables. We explain this observation as follows. First we make some assumptions for easy description: 1. and + d are solutions of the current and next iterations, respectively. 2. B is the current working set, where all elements are from the same class with y that is, y In other words, we assume that at one iteration, the situation where all elements of the working are in the same class happens. 3. We will show that it is more possible that components with y will be selected in the next working set. Note that We also know that In early iterations, most elements are at zero. If for those nonzero elements, v i of (2.6) are not too small, (2.3) is essentially nding the smallest elements of rf( d). For the next iteration, since v will not be included the working set again. For elements in N , we have Therefore, if ((Q not small, in the next iteration, elements with y to be selected because rf(+d) i becomes smaller. For the example in Table 2.1, we really observe that the sign of most rf() i is changed in every early iteration. The explanation is similar if y We note that (2.7) and (2.8) hold because of the RBF kernel. For another popular kernel: the polynomial kernel all attributes of data are scaled to [ holds. Hence (2.7) and (2.8) remain valid. Next we explain that when the above situation happens, in early iterations, very few variables can reach the upper bound. Since we are solving the following sub-problem: it is like that the following primal problem is solved: If components in B are in the same class, (2.10) is a problem with separable data. Hence that B are in general not equal to C. Thus the algorithm has diculties to identify correct bounded variables. In addition, the decrease of the objective function becomes slow. On the other hand, the constraint y T in (2.1) of SV M light provides an excellent channel for selecting the working set from two dierent classes. To be more precise, when most are zero, selecting some of the largest elements of y is like selecting elements with y Conversely, the smallest elements of y are from data with y This can be seen in the columns of the number of y 2.1. Another explanation is from the rst and second order approximations of the optimization is the current solution which is considered as a xed vector and d is the variable, problem (1.3) is equivalent to solving Since (1.3) is like to select the best q elements such that the linear part of (2.11) is minimized. Similarly, (2.9) is equivalent to solving Clearly a main dierence between (2.11) and (2.12) is that y B involves in a term d T (y B y T (y T d) 2 in the objective value of (2.12) but for (2.11), y B appears in one of its constraints: Therefore, since we are now using a linear approximation for selecting the working set, for (2.12), d T (y B y T B )d is a quadratic term which is not considered in (2.3). Thus (2.3) does not know that (y T d) 2 should not be too large. On the other hand, for remains as a constraint so it is like that (y T d) 2 is implicitly minimized. In one word, (2.1) and (2.3) both come from the linear approximation but one contains more information than the other. Based on this observation, we try to modify (2.3) by selecting a d which contains the best q=2 elements with y and the best q=2 elements with y 1. The new result is in Table 2.2 where a substantial improvement is obtained. Now after seven iterations, both algorithms reach solutions which have the same number of components at the upper bound. Objective values are also similar. Table 2.2: Problem heart: a new comparison in early iterations light iter. obj. #free #C iter. obj. #free #C iteration #free Figure 2.1: # of free variables (line: BSVM, dashed: SV M light ) However, in Table 2.2, BSVM still takes more iterations than SV M light . We observe very slow convergence in nal iterations. To improve the performance, we analyze the algorithm in more detail. In Figure 2.1, we present the number of free variables in each iteration. It can be clearly seen that BSVM goes through points which have more free variables. Since the weakest part of decomposition method is that it cannot consider all variables together in each iteration (only q are selected), a larger number of free variables causes more diculty. In other words, if a component is correctly identied at C or 0, there is no problem of numerical accuracy. However, it is in general not easy to decide the value of a free variable are not considered together. Comparing to the working set selection (2.1) of SV M light , our strategy of selecting q=2 elements with y very natural. Therefore, in the middle of the iterative process more variables are not correctly identied at the upper bound so the number of free variables becomes larger. This leads us to conjecture that we should keep the number of free variables as small as possible. A possible strategy to achieve this is by adding some free variables in the previous iteration to the current working set. Table 2.3: Working sets of nal iterations: BSVM iter. B # in iter.+2 Table 2.4: Working set in nal iterations: SV M light iter. B # in iter.+2 The second observation is on elements of the working set. When we use (2.3) to select B, in nal iterations, components of the working set are shown in Table 2.3. In Table 2.4, working sets of running SV M light are presented. From the last column of Table 2.3, it can be seen that the working set of the kth iteration is very close to that of the iteration. However, in Table 2.4, this situation is not that serious. For this example, at nal solutions, there are using (1.5) and 25 by (1.2). For BSVM, in the second half iterations, the number of free variables is less than 30. Note that in nal iterations, the algorithm concentrates on deciding the value of free variables. Since in each iteration we select 10 variables in the working set, after the sub-problem (2.9) is solved, gradient at these 10 elements become zero. Hence the solution of (2.3) mainly comes from the other free variables. This explains why working sets of the kth and iterations are so similar. Apparently a selection like that in Table 2.3 is not an appropriate one. We mentioned earlier that the weakest part of the decomposition method is that it cannot consider all variables together. Now the situation is like two groups of variables are never considered together so the convergence is extermely slow. Based on these observations, we propose the following scheme for the selection of the working set: Let r be the number of free variables at k If r > 0, then Select indices of the largest min(q=2; r) elements in v, where Select the (q min(q=2; r)) smallest elements in v into B. else Select the q=2 smallest elements with y smallest elements with Algorithm 2.1: Selection of the working set That is, (q min(q=2; r)) elements are still from a problem like (2.3) but min(q=2; r) elements are from free components with largest jrf( k in the previous working set satisfy rf( k there are not too many such elements, most of them are again included in the next working set. There are exceptional situations where all are at bounds. When this happens, we choose q=2 best elements with y best elements with y following the discussion for results in Table 2.2. The motivation of this selection is described as follows: consider minimizing f() =2 T A e T , where A is a positive semidenite matrix and there are no constraints. This problem is equivalent to solving If the decomposition method is used, B k 1 is the working set at the (k 1)st iteration, and A is written as we have AB k 1 Therefore, similar to what we did in (2.3), we can let B k , the next working set, contain the smallest q elements of rf( k In other words, elements violate KKT condition are selected. Thus B k will not include any elements in only holds at the kth iteration. When is updated to k+1 , the equality fails again. Hence this is like a zigzaging process. From the point of view of solving a linear system, we think that considering some inequalities and equalities together is a better method to avoid the zigzaging process. In addition, our previous obervations suggest the reduction of the number of free variables. Therefore, basically we select the q=2 most violated elements from the KKT condition and the q=2 most satised elements at which i is free. Using Algorithm 2.1, BSVM takes about 50 iterations which is fewer than that of light . Comparing to the 388 iterations presented in Table 2.2, the improvement is dramatic. In Figure 2.2, the number of free variables in both methods are presented. It can be clearly seen that in BSVM, the number of free variables is kept small. In early iterations, each time q elements are considered and some of them move to the upper bound. For free variables, Algorithm 2.1 tends to consider them again in subsequent iterations so BSVM has more opportunities to push them to the upper bound. Since now the feasible region is like a box, we can say that BSVM walks closer to walls of this box. We think that in general this is a good property as the decomposition method faces more diculties on handeling Algorithm 2.1 belongs to the class of working set selections discussed in Chang et al. (1999). Therefore, BSVM theoretically converges to an optimal point of (1.5). iteration #free Figure 2.2: # of free variables (line: BSVM, dashed: SV M light ) Computational Experiments In this section, we describe the implementation of BSVM and present the comparison between BSVM and SV M light (Version 3.2). Results show that BSVM converges faster than light for dicult cases. The computational experiments for this section were done on a Pentium III-500 using the gcc compiler. Table 3.1: RBF kernel and light (without shrinking) Problem n SV(BSV) Mis. Obj. Iter. Time SV(BSV) Mis. Obj. Iter. Time australian 690 245( 190) diabetes 768 447( 434) 168 -413.57 130 0.48 447( 435) 168 -413.56 105 0.39 german 1000 599( vehicle 846 439( 414) 210 -413.27 178 0.85 439( 414) 210 -413.02 332 0.94 letter 15000 569( 538) 104 -451.18 238 22.85 564( 531) 103 -446.98 349 24.38 shuttle 435006190(6185) 1117 -5289.17 2948 479.206164(6152) 1059 -5241.41 1120 449.27 dna 2000 696( 537) 50 -427.91 326 8.56 697( 533) 50 -427.38 253 6.14 segment fourclass 862 411( 403) 168 -383.87 190 0.73 408( 401) 167 -383.58 124 0.41 web4 7366 856( 285) 123 -326.12 787 13.94 869( 281) 126 -326.07 876 19.82 Table 3.2: RBF kernel and Table 3.3: Polynomial kernel and light (without shrinking) Problem n SV(BSV) Mis. Obj. Iter. Time SV(BSV) Mis. Obj. Iter. Time australian 690 283( 242) 95 -227.98 117 0.36 284( 238) 95 -227.93 188 0.46 diabetes 768 539( 532) 231 -499.41 105 0.47 538( 532) 230 -499.24 99 0.37 german 1000 624( 527) 202 -516.42 244 1.36 625( 527) 203 -516.24 236 1.03 vehicle 846 440( 412) 212 -422.69 90 0.72 443( 403) 212 -422.18 217 0.69 letter 15000 1034(1020) 172 -783.91 199 31.65 1040(1015) 172 -783.05 223 28.17 shuttle 4350017699(17698) 7248 -15560.58 3706 1084.8617700(17694) 7248 -15560.17 3008 1118.19 dna 2000 1103( 772) 464 -906.09 222 12.39 1103( 772) 464 -905.58 216 7.66 segment fourclass 862 485( 480) 195 -444.25 236 0.70 485( 479) 195 -443.76 125 0.41 Table 3.4: Polynomial kernel and Table 3.5: RBF kernel: Using SV M light with shrinking Problem n SV(BSV) Mis. Obj. Iter. Time SV(BSV) Mis. Obj. Iter. Time australian 690 245( 190) 98 -201.64 504 0.75 223( 55) 28 -81199.77 119658 176.44 diabetes 768 447( 435) 168 -413.56 105 0.38 377( 273) 128 -302463.70 75141 115.26 german 1000 599( 512) 189 -502.77 311 1.17 509( vehicle letter 15000 564( 531) 103 -446.98 349 20.36 152( 52) 6 -55325.74 27290 135.39 shuttle 435006164(6152) 1059 -5241.41 1120 478.281488(1467) 137 -1188414.66 24699 1243.39 dna 2000 697( 533) 50 -427.38 253 6.15 408( segment fourclass 862 408( 401) 167 -383.58 124 0.41 89( 74) 2 -53885.74 11866 19.41 iteration and (a) SV M light iteration and (b) BSVM Figure 3.1: Problem fourclass: number of SV(line) and free SV(dashed) Table rate by 10-fold cross validation (Statlog) or classifying test data (adult) australian 85.36 86.23 85.65 85.51 85.94 84.06 82.17 80.29 77.97 diabetes 76.80 77.19 76.67 76.53 76.01 74.97 74.32 73.02 72.63 german 75.40 75.00 75.90 72.70 69.70 69.00 68.80 69.10 68.70 heart 81.85 80.74 80.37 78.89 77.41 75.56 75.18 74.07 74.07 segment 99.65 99.70 99.70 99.74 99.78 99.78 99.74 99.70 99.83 vehicle 74.95 78.97 79.56 81.67 82.39 85.35 85.23 86.17 85.34 adult1 84.23 83.96 83.03 80.54 80.22 79.59 79.43 79.43 79.43 adult4 84.40 84.19 83.83 81.84 81.00 79.73 79.42 79.28 79.27 Table 3.7: BSVM: Accuracy rate by 10-fold cross validation (Statlog) or classifying test data (adult) australian 85.36 86.23 85.65 85.51 85.94 84.06 82.17 80.15 77.97 diabetes 76.93 77.19 76.93 76.53 76.01 75.10 74.32 73.02 72.63 german heart 82.22 80.74 79.63 78.52 77.41 75.93 75.18 74.07 74.07 segment 99.65 99.70 99.70 99.74 99.78 99.78 99.74 99.74 99.83 vehicle 74.95 78.97 79.56 81.79 82.50 85.23 85.23 86.29 85.34 adult4 84.40 84.19 83.83 81.84 81.00 79.74 79.42 79.28 79.27 light uses the following conditions as the termination criteria: where To have a fair comparison, we use similar criteria in BSVM: Note that now there is no b in the above conditions. For both SV M light and BSVM, we set We solve the sub-problem (2.9) using the software TRON by Lin and More (1999) x . TRON is designed for large sparse bound-constrained problems. Here the sub-problem is a very small fully dense problem so there are some redundant operations. We plan to write a dense version of TRON in the near future. As pointed out in existing work of decomposition methods, the most expensive step in each iteration is the evaluation of the q columns of the matrix Q. In other words, we maintain the vector Q so in each iteration, we have to calculate Q( k+1 k ) which involves q columns of Q. To avoid the recomputation of these columns, existing methods use the idea of a cache where recently used columns are stored. In BSVM, we now have a very simple implement of the least-recently-used caching strategy. In the future, we plan to optimize its performance using more advanced implementation techniques. For experiments in this section, we use 160MB as the cache size for both BSVM and SV M light . We test problems from dierent collections. Problems australian to segment are from the Statlog collection (Michie et al., 1994). Problem fourclass is from Ho and Kleinberg (1996). Problems adult1 and adult4 are compiled by Platt (1998) from the UCI \adult" data set (Murphy & Aha, 1994). Problems web1 to web7 are also from Platt. Note that all problems from Statlog (except dna) and fourclass are with real numbers so we scale them to [ Some of these problems have more than 2 classes so we treat all data not in the rst class as in the second class. Problems dna, adult, and web problems are with binary representation so we do not conduct any scaling. We test problems by using RBF and polynomial kernels. For the RBF kernel, we use problems and fourclass. We use K(x for adult and web problems following the setting in Joachims (1998). For the polynomial kernel, we have K(x cases. For each kernel, we test Usually is a good initial guess. As it is dicult to nd out the optimal C, a procedure is to try dierent Cs and compare error rates obtained by cross validation. In Saunders et al. (1998), they point out that plotting a graph of error rate on dierent Cs will typically give a bowl shape, where the best value of C is somewhere in the middle. Therefore, we think it may be necessary to solve problems with large Cs so we test cases with In addition, the default C of SV M light is 1000. Numerical results using are presented in Tables 3.1 to 3.4. The column \SV(BSV)" represents the number of support vectors and bounded support vectors. The column \Mis." is the number of misclassied training data while the \Obj." and \Iter." columns are objective values and the number of iterations, respectively. Note that here we present the objective value of the dual (that is, (1.2) and (1.5)). We also present the computational time (in seconds) in the last column. SV M light implements a technique called \shrinking" x TRON is available at http://www.mcs.anl.gov/~more/tron Table 3.8: Iterations and q: BSVM, australian 13592 3288 1395 682 diabetes 21190 3478 1201 461 german 16610 6530 3453 2126 vehicle 10594 1964 636 335 Table 3.9: Iterations and q: SV M light , australian 101103 71121 62120 34491 diabetes 75506 43160 37158 41241 german 43411 31143 28084 24529 heart 5772 3321 3068 1982 vehicle 177188 113357 107344 90370 which drops out some variables at the upper bound during the iterative process. Therefore, it can work on a smaller problem in most iterations. Right now we have not implemented similar techniques in BSVM so in Tables 3.1{3.4 we present results by SV M light without using this shrinking technique. Except this option, we use all default options of SV M light . Note that here we do not use the default optimizer of SV M light (version 3.2) for solving (1.2). Following the suggestion by Joachims (2000), we link SV M light with LOQO (Van- derbei, 1994) to achieve better stability. To give an idea of eects on using shrinking, in Table 3.5 we present results of SV M light using this technique. It can be seen that shrinking is a very useful technique for large problems. How to eectively incorporate shrinking in BSVM is an issue for future investigation. From Tables 3.1 to 3.4, we can see that results obtained by BSVM, no matter number of support vectors, number of misclassied data, and objective values, are very similar to those by SV M light . This suggests that using BSVM, a formula with an additional term b 2 =2 in the objective function, does not aect the training results much. Another interesting property is that the objective value of BSVM is always smaller than that of SV M light . This is due to the properties that y T in (1.2) and the feasible region of (1.2) is a subset of that of (1.5). To further check the eectiveness of using (1.5), in Tables 3.6 and 3.7, we present error rates of testing small Statlog problems by 10-fold cross validation. There are test data available for adult problems so we also present error rates for classifying them. Results suggest that for these problems, using (1.5) produces a classier which is as good as that of using (1.2). When light take about the same number of iterations. However, it can be clearly seen that when methods take many more iterations. For most problems we have tested, not only those presented here, we observe slow convergence of decomposition methods when C is large. There are several possible reasons which cause this diculty. We think that one of them is that when C is increased, the number of free variables in the iterative process is increased. In addition, the number of free variables at the nal solution is also increased. Though both the numbers of support and bounded support vectors are decreased when C is increased, in many cases, bounded variables when When C is increased, the separating hyperplane tries to to t as many training data as possible. Hence more points (i.e. more free to be at two planes w the decomposition method has more diculties on handling free variables, if the problem is ill-conditioned, more iterations are required. As our selection of the working set always try to push free variables to be bounded variables, the number of free variables is kept small. Therefore, the convergence seems faster. It can be clearly seen that for almost all cases in Tables 3.2 and 3.4, BSVM takes fewer iterations than SV M light . Problem fourclass in Table 3.2 is the best example to show the characteristic of BSVM. For this problem, at the nal solution, the number of free variables is small. In the iterative process of BSVM, many free variables of iterates are in fact bounded variables at the nal solution. BSVM considers free variables in subsequent iterations so all bounded variables are quickly identied. The number of free variables is kept small so the slow local convergence does not happen. However, SV M light goes through an iterative process with more free variables so it takes a lot more iterations. We use Figure 3.1 to illustrate this observation in more detail. It can be seen in Figure 3.1(a) that the number of free variables in SV M light is increased to about 70 in the beginning. Then it is dicult do identify whether they should be at the bounds or not. Especially in nal iterations, putting a free variable on a bound can take thousands of iterations. On the other hand, the number of free variables of BSVM is always small (less than 40). We also note that sometimes many free variables in the iterative process are still free in the nal solution. Hence BSVM may pay too much attention on them or wrongly put them as bounded variables. Therefore, some iterations are wasted so the gap between BSVM and light is smaller. An example of this is adult problems. Next we study the relation between number of iterations and q, the size of the working set. Using the RBF kernel and results are in Tables 3.8 and 3.9. We nd out that by using BSVM, number of iterations is dramatically decreased as q becomes larger. On the other hand, using SV M light , the number of iterations does not decrease much. Since optimization solvers costs a certain amount of computational time in each iteration, this result shows that SV M light is only suitable for using small q. On the other hand, Algorithm 2.1 provides the potential of using dierent q in dierent situations. We do not conduct experiments on large problems here as our optimization solver is currently not very ecient for dense sub-problems. 4 Discussions and Conclusions From an optimization point of view, decomposition methods are like \coordinate search" methods or \alternating variables method" (Fletcher, 1987, Chapter 2.2). They have slow convergences as the rst and second order information is not used. In addition, if the working set selection is not appropriate, though the strict decrease of the objective value holds, the algorithm may not converge (see, for example, Powell (1973)). However, Even with such disadvantages, the decomposition method has become one of the major methods for SVM. We think the main reason is that the decomposition method is ecient for SVM in the following situations: 1. C is small and most support vectors are at the upper bound. That is, there are not in the iterative process. 2. The problem is well-conditioned even though there are many free variables. For example, we do not think that adult problems with belong to the above cases. They are dicult problems for decomposition methods. If for most applications we only need solutions of problems which belong to the above situations, current decomposition methods may be good enough. Especially a SMO type (Platt, 1998) algorithm has the advantage of not requiring any optimization solver. How- ever, if in many cases we need to solve dicult problems (for example, C is large), more optimization knowledge and techniques should be considered. We hope that practical applications will provide a better understanding on this issue. Regarding the SVM formulation, we think (1.5) is simpler than (1.1) but with similar quality for our test problems. In addition, in this paper we experiment with dierent implementation of the working set selection. The cost is always the same: O(ql) by selecting some of the largest and smallest rf( k ). This may not be the case for regular SVM formulation (1.1) due to the linear constraint y T In SV M light , the implementation is simple because (2.1) is very special. If we change constraints of (2.1) to 0 the solution procedure may be more complicated. Currently we add b 2 =2 into the objective function. This is the same as nding a hyperplane passing through the origin for separating data It was pointed out by Cristianini and Shawe-Taylor (2000) that the number 1 added may not be the best choice. Experimenting with dierent numbers can be a future issue for improving the performance of BSVM. In Section 2, we demonstrate that nding a good working set is not an easy task. Sometimes a natural method turns out to be a bad choice. It is also interesting to note that for dierent formulations (1.2) and (1.5), similar selection strategies give totally dierent performance. Therefore, for any new SVM formulations, we should be careful that existing selections of the working set may not perform well. Finally we summarize some possible advantages of BSVM: 1. It uses a simpler formula which is a bound-constrained optimization problem. 2. It keeps the number of free variables as low as possible. This in general leads to faster convergences for dicult problems. 3. Algorithm 2.1 tends to consider free variables in the current iteration again in subsequent iterations. Therefore, corresponding columns of these elements are naturally cached. Acknowledgments This work was supported in part by the National Science Council of Taiwan via the grant NSC 89-2213-E-002-013. The authors thank Chih-Chung Chang for many helpful discussions and comments. Part of the software implementation beneted from his help. They also thank Thorsten Joachims, Pavel Laskov, and John Platt for helpful comments. --R The analysis of decomposition methods for support vector machines. An introduction to support vector machines. Practical methods of optimization. The kernel adatron algorithm: a fast and simple learning procedure for support vector machines. Making large-scale svm learning practical Machine learning Fast training of support vector machines using sequential minimal optimization. On search directions for minimization. Support vector machine reference manual (Tech. LOQO: An interior point code for quadratic programming (Tech. Statisical learning theory. --TR --CTR Chih-Chung Chang , Chih-Jen Lin, Training v-support vector regression: theory and algorithms, Neural Computation, v.14 n.8, p.1959-1977, August 2002 Daniela Giorgetti , Fabrizio Sebastiani, Multiclass text categorization for automated survey coding, Proceedings of the ACM symposium on Applied computing, March 09-12, 2003, Melbourne, Florida Chih-Chung Chang , Chih-Jen Lin, Training -Support Vector Classifiers: Theory and Algorithms, Neural Computation, v.13 n.9, p.2119-2147, September 2001 Nikolas List , Hans Ulrich Simon, General Polynomial Time Decomposition Algorithms, The Journal of Machine Learning Research, 8, p.303-321, 5/1/2007 Wei-Chun Kao , Kai-Min Chung , Chia-Liang Sun , Chih-Jen Lin, Decomposition methods for linear support vector machines, Neural Computation, v.16 n.8, p.1689-1704, August 2004 Rameswar Debnath , Masakazu Muramatsu , Haruhisa Takahashi, An Efficient Support Vector Machine Learning Method with Second-Order Cone Programming for Large-Scale Problems, Applied Intelligence, v.23 n.3, p.219-239, December 2005 Don Hush , Patrick Kelly , Clint Scovel , Ingo Steinwart, QP Algorithms with Guaranteed Accuracy and Run Time for Support Vector Machines, The Journal of Machine Learning Research, 7, p.733-769, 12/1/2006 Daniela Giorgetti , Fabrizio Sebastiani, Automating survey coding by multiclass text categorization techniques, Journal of the American Society for Information Science and Technology, v.54 n.14, p.1269-1277, December Tzu-Chao Lin , Pao-Ta Yu, Adaptive Two-Pass Median Filter Based on Support Vector Machines for Image Restoration, Neural Computation, v.16 n.2, p.332-353, February 2004 Simon I. Hill , Arnaud Doucet, Adapting two-class support vector classification methods to many class problems, Proceedings of the 22nd international conference on Machine learning, p.313-320, August 07-11, 2005, Bonn, Germany Tatjana Eitrich , Bruno Lang, Efficient optimization of support vector machine learning parameters for unbalanced datasets, Journal of Computational and Applied Mathematics, v.196 n.2, p.425-436, 15 November 2006 Ningning Guo , Libo Zeng , Qiongshui Wu, A method based on multispectral imaging technique for White Blood Cell segmentation, Computers in Biology and Medicine, v.37 n.1, p.70-76, January, 2007 Luca Zanni , Thomas Serafini , Gaetano Zanghirati, Parallel Software for Training Large Scale Support Vector Machines on Multiprocessor Systems, The Journal of Machine Learning Research, 7, p.1467-1492, 12/1/2006 Cheng-Lung Huang , Mu-Chen Chen , Chieh-Jen Wang, Credit scoring with a data mining approach based on support vector machines, Expert Systems with Applications: An International Journal, v.33 n.4, p.847-856, November, 2007 Tatjana Eitrich , Bruno Lang, On the optimal working set size in serial and parallel support vector machine learning with the decomposition algorithm, Proceedings of the fifth Australasian conference on Data mining and analystics, p.121-128, November 29-30, 2006, Sydney, Australia
support vector machines;decomposition methods;classification
599667
Feasible Direction Decomposition Algorithms for Training Support Vector Machines.
The article presents a general view of a class of decomposition algorithms for training Support Vector Machines (SVM) which are motivated by the method of feasible directions. The first such algorithm for the pattern recognition SVM has been proposed in Joachims, T. (1999, Schlkopf et al. (Eds.) Advances in kernel methods-Support vector learning (pp. 185208). MIT Press). Its extension to the regression SVMthe maximal inconsistency algorithmhas been recently presented by the author (Laskov, 2000, Solla, Leen, & Mller (Eds.) Advances in neural information processing systems 12 (pp. 484490). MIT Press). A detailed account of both algorithms is carried out, complemented by theoretical investigation of the relationship between the two algorithms. It is proved that the two algorithms are equivalent for the pattern recognition SVM, and the feasible direction interpretation of the maximal inconsistency algorithm is given for the regression SVM. The experimental results demonstrate an order of magnitude decrease of training time in comparison with training without decomposition, and, most importantly, provide experimental evidence of the linear convergence rate of the feasible direction decomposition algorithms.
Introduction Computational complexity of SVM training algorithms is attracting increasing interest, as applications of SVM extend to problems of larger and larger size. Requests have been recently made for algorithms capable of handling problems containing examples [14]. The basic training algorithm [16] involves a solution to a quadratic programming problem the size of which depends on the size of the training data set. For the training data set of size l, the pattern recognition SVM quadratic program has l variables with non-negativity constraints, l inequality constraints and one equality constraint. The regression quadratic program has 2l variables with non-negativity constraints, 2l inequality constraints and one equality constraint. In addition, the basic formulation of the SVM training algorithm requires storage of the kernel matrix of size l \Theta l or 2l \Theta 2l respectively. Thus, the running time and storage of the kernel matrix are the two main optimization-related bottlenecks of SVM training algorithms 1 . Another possible bottleneck is computation of the kernel matrix. If real dimension of data points is large, this time may become comparable with training time. However First SVM implementations used general purpose optimization packages (such as MINOS, LOQO and others) that were not designed for problems of such size. It was soon discovered that these packages were not suitable for solutions to problems involving more than a few hundred examples. The early special-purpose methods, proposed to speed-up training, have not brought much relief. Chunking [15] prescribes iteration through the training data, accumulating support vectors and adding a "chunk" of new data until no more changes to the solution occur. The main problem with this method is that when the percentage of support vectors is high it essentially solves the problem of almost the full size more than once. Another method proposed by Kaufmann [4] modifies traditional optimization algorithms (a combination of Newton's and conjugate gradient methods) to yield the overall complexity of O(s 3 ) per iteration, where s is the (a priori unknown) number of support vectors. This can be a significant improvement over O(l 3 ), however the number of support vectors in not guaranteed to be small. Decomposition was the first practical method for solving large-scale SVM training problems. It was originally proposed for the pattern recognition SVM [9] and subsequently extended to the regression SVM in [8]. The key idea of decomposition is to freeze all but a small number of optimization variables, and to solve a sequence of constant-size problems. The set of variables optimized at a current iterations is denoted as the working set. Because the working set is re-optimized, the value of the objective function is improved at each itera- tion, provided the working set is not optimal before re-optimization. Iteration is stopped when termination criteria, derived from Karush-Kuhn-Tucker (KKT) conditions, are satisfied to a required precision. Selection of the working set is the most important issue in the decomposition algorithms. First, the provision that the working set must be sub-optimal before re-optimizaiton, is crucial to prevent the algorithm from cycling. Therefore, it is important to have criteria to test sub-optimality of any given working set. Second, working set selection affects the rate of convergence of the algorithm: if sub-optimal working sets are selected more or less at random the algorithm converges very slowly. Finally, working set selection is imporant in theoretical analysis of decomposition algorithms; in particular, in the recent convergence proof by Chang et. al. [2]. The original decomposition algorithm essentially addressed only the first issue-the design of its termination criteria in all but pathological cases prevents composition of already optimal working sets. Its implementation featured some unpublished heuristics which provided reasonable convergence speed. Ob- viously, a formal framework for working set selection was highly desirable. One such framework is the method of feasible directions, proposed in the optimization theory in 1960 by Zoutendijk [18]. The connection between this method and the working set selection problem was first discovered by Joachims in a paper it will be assume in the rest of this article that kernel computation is not the main factor contributing to the complexity of training. that has drawn wide attention [3]. However, Joachims' algorithm is limited to the pattern recognition case because it uses the fact that the labels are \Sigma1. The main goal of the current article is to provide a unified treatment of the working set selection problem within the framework of the method of feasible directions. Specifically, the first two issues raised above are addressed, in a common way for the pattern recognition and the regression SVM: - a criterion is proposed to identify sub-optimal working sets - a heuristic, which shares the motivation with the optimality criterion, is proposed for (approximately) optimal working set selection. The new algorithm, termed the "maximal inconsistency algorithm", is applicable for both pattern recognition and the regression SVM. To further reveal the machinery of the new algorithm, it is shown that for the pattern recognition SVM the new algorithm is equivalent to Joachims' algorithm, and for the regression SVM a similar algorithm exists based on the feasible direction princi- ple. Similar to the pattern recognition case, the maximal inconsistency algorithm satisfies theoretical requirements crucial for the proof of convergence. These relationships allow to classify both algorithms as "feasible direction decomposition" algorithms. The article is organized as follows. Section 2 provides basic formulations of decomposition algorithms for the pattern recognition and the regression SVM. Section 3 presents the method of feasible directions. Sections 4 and 5 cover the issues related to feasible direction decomposition algorithms for the pattern recognition and the regression SVM respectively. Exposition in these sections is carried out in different fashion. Section 4 is presented in a more or less chronological order. It starts with Joachims' algorithm, fully motivated by the feasible direction method. Then the criterion for testing optimality of a working set is presented, and the maximal inconsistency working set selection rule is derived from this criterion. Finally, equivalence between the maximal inconsistency algorithm and Joachims' algorithm is proven. The order of presentation is reversed for the regression SVM in Section 5. The maximal inconsistency algorithm is introduced first, followed by its interpretation as a feasible direction decomposition algorithm. Experimental results for the regression SVM are presented in Section 6. The classical problem of training the SVM, given the data f(x and hence, the kernel matrix can be expressed as the following quadratic program: Maximize W ( ~ ff T D ~ ff subject to: c T ~ ~ ~ where interpretation of symbolilc components of (1) varies between the pattern recognition and the regression cases. For the pattern recognition SVM, ~ For the regression SVM, ~ ff ff * \Gammay K \GammaK \GammaK K Details of formulation of SVM training problems can be found in [16], [17], [11], [13]. As it was mentioned in the introduction, the main idea of decomposition is to allow only a subset of optimization variables to change weights at a current iteration. The iteration process is repeated until the termination conditions are met. Let ~ ff B denote the variable included in current working set (of fixed size q) and let ~ ff N denote the rest of the variables. The corresponding parts of vectors c and ~ y will also bear subscripts N and B. Matrix D will be partitioned into NB and DNN . It will be further required that, for the regression SVM, both ff i and ff * are either included in or omitted from the working set. 2 Optimization of the working set turns out to be also a quadratic program. This can be seen by rearranging the terms of the objective function and the equality constraint in (1), and dropping the terms independent of ~ ff B from the objective. The resulting quadratic program (sub-problem) is formulated as follows Maximize WB ( ~ subject to: c T ~ ~ The termination conditions of the decomposition algorithm are derived from the KKT conditions ([9], [8]). It is best to consider them separately for the two types of SVM. For the pattern recognition SVM, let l where b is the threshold of SVM computed as [3]: l Strictly speaking this rule is not required in decomposition, however it facilitates formulation of sub-problems to be solved at each iteration. Then the point satisfies the KKT provided: For the regression SVM, let l where l Then the point satisfies the KKT conditions provided: Conditions (7) or (10) are checked for individual points : if, at a given iteration, one of them is violated for some point, this point is exchanged with some point in the current working set. Thus, the new working set is sub-optimal, and a strict improvement of the overall objective function is achieved. The problem with using conditions (7) or (10) is that they require knowledge of the threshold b which is also the Lagrange multiplier for the equality constraint of the SVM problem. The formulas given in (6) and (9) require that the set SV of unbounded support vectors is non-empty. Usually this assumption is true, however it cannot be guaranteed. While a simple trick can rectify the problem for the pattern recognition SVM, by letting a similar trick doesn't work for the regression SVM. Overcoming this problem has been the initial motivation for the new termination condition proposed in this article. Instead of individual points, optimality of the entire working set will be considered. The new condition is described in detail in Section 4.2. Intelligent selection of working sets is possible by utilizing ideas of the method of feasible directions introduced next. 3 The Method of Feasible Directions Let\Omega be a feasible region of a general constrained optimization problem. Then a vector d is said to be a feasible direction at the point ff 2\Omega , if there exists such that ff 2\Omega for all 0 . The main idea of the method of feasible direction is to find a path from the initial feasible solution to the optimal solution by making steps along feasible directions. At each iteration the feasible direction algorithm proceeds as follows: - find the optimal feasible direction-that is, the feasible direction providing the largest rate of increase of the objective function. - determine the step length along the feasible direction that maximizes the objective function ("line search"). The algorithm terminates when no feasible direction can be found which improves the objective function. For a general constrained optimization problem in the form Maximize f(ff) subject to: Aff b the optimal feasible direction is found by solving the direction finding linear program: Maximize rf T d subject to: Ad 0 The method of feasible directions can be applied directly to SVM training [8]. In this case, the respective optimal feasible direction problem can be stated as follows: Maximize ~ g T d (13) subject to: c T where the definitions of ~ g and c vary between the two SVM formulations. It turns out that solving the linear problem of the full size at each iteration is expensive, and the overall performance of this method for SVM training is inferior to traditional optimization methods. However, with a slight modification, an approximate solution to the optimal feasible direction problem can be obtained in linear time, and this solution provides a powerful guidance for working set selection. This approximate solution lies at the core of the feasible direction decomposition algorithms described in the ensuing sections. 4 Feasible Direction Decomposition of the Pattern Recognition SVM 4.1 Joachim's Decomposition Algorithm The key observation of Joachims is that adding a requirement that only q components of d be non-zero provides a straightforward working set selection rule: the variables corresponding to those non-zero components are to be included in the new working set. Unlike Zoutendijk's method, the optimal feasible direction vector is not to be followed exactly. With re-optimization assumed to be cheap, one can afford finding an optimal solution in the entire subspace spanned by non-zero components of d, instead of doing line search strictly along d. Unfor- tumately, with the additional constraint, the optimal feasible direction problem becomes intractable. Therefore, one has to seek an approximate solution. One such solution is realized in Joachims' algorithm. In the rest of this section a detailed account of this solution is presented-in order to provide some insight and to underline the ideas used in the extension of this algorithm to the regression SVM. The approximate solution is obtained by changing the normalization constraint (17) to With this normalization, in order to satisfy the equality constraint (14) (recall that for the pattern recognition SVM the equality constraint is y T suffices that the number of elements with sign matches between d i and y i is equal to the number of elements with sign mismatches between d i and y i . Obviously, for a working set of size q this condition holds only when each number is equal to q=2. Therefore, the equality constraint (14) can be enforced by performing two passes on the data: the "forward pass" selects q=2 elements with sign mismatches, and the "backward pass"-q=2 elements with sign matches 3 . How should directions be determined for the elements? Recall that the goal is to maximize the objective function (13) subject to constraints. In the absense of constraints the maximum of the objective function would have been achieved by selecting q points with the highest values of jg i j and assigning directions them. Let's consider the largest contribution fl k to the objective function provided by some point k, subject to equality constraints. During the forward pass the signs of d k and y k must be different, therefore: (\Gammag and hence, combining the subscripts, 3 The motivation for the names "forward" and "backward" will be clear shortly. Likewise, for the backward pass the signs of d k and y k must be the same, therefore (\Gammag and hence, combining the subscripts, Thus the quantity g i y i reflects the element's contribution to the objective function subject to the equality constraint. The working set composition rule can then be stated as follows: sort data elements by g i y i in increasing order 4 and select q=2 elements from the front of the list (hence, the "forward pass"), and q=2 elements from the back of the list (hence, the "backward pass"). Finally, to account for inequality constraints (15) and (16), some points may have to be skipped if they violate one of these constraints. For such points, the direction leading to improvement of the objective function of the optimal feasible direction problem is infeasible. Joachims' algorithm is summarized in Algorithm 1. Algorithm 1 Joachims' SVM decomposition algorithm. Let S be a list of all samples. while (termination conditions (7) are not met) in increasing order select q=2 samples from the front of S such that (15) and (16) (forward pass) select q=2 samples from the back of S such that (15) and (16) (backward pass) - re-optimize the working set 4.2 Optimality of a Working Set As it was mentioned earlier, pointwise termination criteria in Osuna's and Joachims' algorithms require knowledge of the threshold b of the SVM. This threshold can be difficult to calculate, especially for the regression SVM. In this section an alternative termination condition is presented which allows to determine In practice, sorting which takes O(n log n) operations can be replaced with heap-based algorithms yielding the complexity of O(n log q) or O(q log n) depending on how the heap is built. whether or not the entire working set is sub-optimal and hence suitable for re- optimization. The new conditions are based on examination of KKT conditioins for the standard form of a quadratic program. The exposition in this section concentrates on the pattern recognition SVM, whereas a similar result for the regression SVM is presented in section 5.1. Consider the quadratic problem (1)-(2) of the pattern recongition SVM. The standard form of a quadratic program is obtained by transforming all constraints to either quality on non-negativity constraints, adding the slack variables when necessary. In particular, to cast the problem (1)-(2), a vector of slack variables added for every ff i ! C constraint, and a slack variable with the 0 value is added to represent the requirement for equality constraint to be satisified. For notational purposes the following matrices and vectors are introduced: I In the matrix notation (18) all constraints of the original problem (1)-(2) can be compactly expressed as: z 0 (19) Now the Karush-Kuhn-Tucker Theorem ([1], p. 36) can be stated as follows: Theorem 1 (Karush-Kuhn-Tucker Theorem). The primal vector z solves the quadratic problem (1) if and only if it satisfies (19) and there exists a dual vector \Upsilon 0 (21) It follows from the Karush-Kuhn-Tucker Theorem that if for all u satisfying conditions (21) - (22) the system of inequalities (20) is inconsistent then the solution of problem (1) is not optimal. Since the sub-problem (4) was obtained by merely re-arranging terms in the objective function and the constraints of the initial problem (1), the same conditions guarantee that the sub-problem (4) is not optimal. Thus, the main strategy for identifying sub-optimal working sets will be to enforce inconsistency of the system (20) while satisfying conditions Notice that all constant terms in (20) represent the negative gradient vector y. Thus each inequality in (20) can be written as follows: Consider three cases, according to the values that ff i can take: In this case, the complementarity condition (22) implies that \Gammag 2. ff In this case, the complementarity condition (22), implies that AE Then inequality (23) becomes \Gammag 3. In this case, the complementarity condition (22), implies that Then inequality (23) becomes \Gammag It can be easily seen that enforcing the complementarity constraint (22) causes to become the only free variable in the system (20). Each point restricts to a certain interval on a real line. Such intervals will be denoted as -sets in the rest of the article. The rules for computation of -sets can be summarized as follows: \Gammag i ]; if ff [\Gammag The development in this section is summarized in the following theorem: Theorem 2. The vector ff solves the quadratic program (1) - (2) if and only if intersection of -sets computed by (27) is non-empty. It also follows from the expressions (27) that if at least one ff i is strictly between the bounds, then at the optimal solution the intersection of all -sets (which is non-empty by the Kuhn-Tucker theorem) is a single point set. This is consistent with the known property of SVM that at the optimal solution The intersection of -sets at the optimal solution can only be a non-empty, non single point set if all variables are at the bounds. In this case any point from the intersection of -sets can be taken as b; in particular, the value suggested in (11). 4.3 Maximal Inconsistency Algorithm While inconsistency of the working set at each iteration guarantees convergence of decomposition, the rate of convergence is quite slow if arbitrary inconsistent working sets are chosen. A natural heuristic is to select "maximally inconsistent" working sets, in a hope that such choice would provide the greatest improvement of the objective function. The notion of "maximal inconsistency" is easy to define: let it be the gap between the smallest right boundary and the largest left boundary of -sets of elements in the training set: 0!i!l l 0!i!l r where l i are the left and the right boundaries respectively (possibly minus or plus infinity) of the -set M i . It is convenient to require that the largest possible inconsistency gap be maintained between all pairs of points comprising the working set. The obvious implementation of this strategy is to select q=2 elements with the largest values of l and q=2 elements with the smallest values of r . One feature of Joachims' method needs to be retained - rejection of Zoutendijk- infeasible points (cf. (15), (16)). Inclusion of such points into the working set doesn't make sense anyway because their values of ff will not change after re- optimization. In the pattern recognition case, the -set constraints are not capable of encoding feasibility 5 . Since the notion of the direction is not explicitly maintained in the maximal inconsistency algorithm the feasibility test needs tobe modified slightly: the point is infeasible if ff and The maximal inconsistency strategy is summarized in Algorithm 2. Algorithm 2 Maximal inconsistency algorithm for the pattern recognition SVM. Let S be a list of all samples. while (intersection of all -sets is empty) according to the rules (27) for all elements in S select q=2 feasible samples with the largest values of l ("left pass") select q=2 feasible samples with the smallest values of r ("right pass") - re-optimize the working set 4.4 Equivalence between Joachims' Algorithm and the Maximal Inconsistency Algorithm So far the motivation for the maximal inconsistency algorithm has been purely heuristic. Does inconsistency gap indeed provide a good measure of optimality 5 They will be in the regression case. for a working set at a given iteration? An affirmative answer is developed in this section, by showing the equivalence between Joachims' algorithm and the maximal inconsistency algorithm. To show that the algorithms are equivalent we have to prove that they produce identical working sets at each iteration 6 and that their termination conditions are equivalent. The two propositions below handle each claim. Proposition 1. The working set of Joachims' algorithm is identical to the working set of maximal inconsistency algorithm at each iteration. Proof. The statement above will be proved for the half of the working set; namely, that the set of elements selected by the "forward pass" of Joachims' algorithm is identical to the set of elements selected by the "right pass" of the maximal inconsistency algorithm. Similar argument allows to establish equivalence of the other half of working sets. Let F be the set of all feasible samples at some iteration. Let r J (p) denote the rank (position) of sample p in the array obtained by sorting F by y i r I (p) be the rank of sample p in the array obtained by sorting F by r Let the set H q=2g be the half of the working set selected by the "forward pass" of Joachims' algorithm. Let p be the sample whose r J q=2, i.e. the element in H J with the largest value of the key. Let H I r (p) r (p)g. We are going to prove that H J j H I . For any sample p i selected by the "forward pass" d \Gammay i . Considering the possible values of ff i , we conclude that, for any p 2 We can see that the order of r (p) is preserved when mapping H J 7! H I . Therefore, if To prove set equivalence, it remains to be shown that if p 2 H I then p 2 H J . Suppose, by the way of contradiction this is not the case, i.e. there exists an sample ~ p such that r (~p) ! r (p) and ~ What is r (~p) equal to? Three possible cases are covered in (28), and in each of them r . In this case r (~p) ! r (p) ) r J (~p) ! r J (p) which contradicts our previous conclusion that r J (~p) r J (p). In the remaining two cases of (27) which contradicts our assumption that r (~p) ! r (p). Thus we can conclude that H J j H I . Proposition 2. Termination conditions of the Joachims' algorithm are satisfied if and only if the termination conditions of the maximal inconsistency algorithm are satisfied. 6 Since both algorithms use identical feasibility check for every sample, it is obvious that infeasible samples will never be included in a working set in both algorithms. Proof. The maximal inconsistency algorithm terminates when the system (20) is consistent while at the same time conditions (21) - (22) are enforced. Hence, the KKT conditions are satisfied, and consequently, the algorithm terminates if and only if the optimal solution is found. Likewise, termination conditions have an "if and only if" relationship to the KKT conditions and hence to the optimality of the solution, except when the solution contains all variables strictly at the bounds and (11) is used for calculation of b. In the latter case, however, condition (11) satisfies the KKT conditions of the primal SVM training problem (to which the problem (1) - (2) is a dual). Then it follows from Dorn's duality theorem ([6]. p. 124), that the solution of the dual problem is also optimal. Hence, both algorithms terminate at the same point in the solution space. 5 Feasible Direction Decomposition of the Regression 5.1 Maximal Inconsistency Algorithm We now turn our attention to the maximal inconsistency algorithm for the regression SVM. Recall that the quadratic program for the latter is given by equations (1) and (3). The derivation will progress in the same way as in the pattern recognition case and will consist of: (a) stating the Karush-Kuhn-Tucker Theorem for the standard form of QP, (b) derivation of rules for computation of -sets, and (c) defining the inconsistency gap to be used for working set selection in the algorithm. The standard form of QP for the regression SVM is defined by the following matrices: I ~ in terms of which the constraints can expressed in the same way as in the pattern recognition case: ~ z 0 (30) The statement of the Karush-Kuhn-Tucker Theorem, as well as its use to test optimality of the working set, remain the same (see Theorem 1 and the ensuing discussion). For the regression SVM, each inequality in (20) has one of the following forms: * where l Considering the possible values of ff i we have: 1. In this case s Then inequality (31) becomes: 2. ff becomes: 3. inequality (31) becomes: Similar reasoning for ff * i and inequality (32) yields the following results: 1. ff * 2. ff * 3. Finally, taking into account that for the regression SVM ff i ff * the rules for computation of -sets for the regression SVM are the following: For the regression SVM, the new termination condition is stated in the following theorem. Algorithm 3 Maximal inconsistency algorithm for the regression SVM. Let S be a list of all samples. while (intersection of -sets is empty) according to the rules (34) for all elements in S select q=2 feasible samples with the largest values of l ("left pass") select q=2 feasible samples with the smallest values of r ("right pass") - re-optimize the working set Theorem 3. The vector ff solves the quadratic program (1) - (3) if and only if intersection of -sets computed by (34) is non-empty. The maximal inconsistency algorithm for the regression SVM is summarized in Algorithm 3. Feasibility of samples is tested by the following rule: during the left pass skip samples with ff during the right pass skip samples with Justification of this rule is given in Lemma 1 in Section 5.2. 5.2 Interpretation of the Maximal Inconsistency Algorithm in the Feasible Direction Framework As it was shown in Section 4.4, the maximal inconsistency algorithm is equivalent to Joachims' algorithm which was motivated by Zoutendijk's feasible direction problem. In this section it will be demonstrated that the maximal inconsistency algorithm for the regression SVm can also be interpreted as a feasible direction algorithm. Recall the SVM optimal feasible direction problem stated in (13) - (17). The problem-specific components ~ and c have the following expressions for the regression SVM: ~ * where * and OE is defined in (33). In addition, a feasible direction algorithm must satisfy the constraint To develop an equivalent feasible direction algorithm, we will construct a mapping \Phi ~ ff which maps the state of the maximal inconsistency algorithm to a direction vector d, and a normalization Nd similar to Joachims' normalization which replaces (17). The construction will possess the following properties: 1. At each iteration, \Phi ~ ff is the solution to the optimal feasible direction problem with normalization Nd . 2. Termination condition of the maximal inconsistency algorithm holds if and only if the solution to the optimal feasible direction problem is a zero direction Intuitively, the first property shows that working sets selected by the maximal inconsistency algorithm are the same as those selected by a feasible direction algorithm using normalization Nd . The second property ensures that both algorithms terminate at the same time. Consider the normalization and the mapping (\Phi ~ or (0; \Gamma1), whichever is feasible, during the left pass or (0; 1), whichever is feasible, during the right pass (0; 0), if sample i is infeasible or not reached For the sake of brevity, the optimal feasible direction problem comprising equations will be denoted as the feasible direction problem. First, we need to make sure that \Phi ~ ff is not ambiguous, i. e. that only one of the non-zero directions suggested in (39) is feasible. Lemma 1. Mapping \Phi ~ ff is not ambiguous. Proof. Let us denote directions (1; 0); (0; \Gamma1); (\Gamma1; 0); (0; 1) as Ia, Ib, IIa, IIb (Type I directions are assigned during the left pass, and Type II directions- during the right pass). Table 1 shows feasibility of different directions depending on the values of optimization variables: Infeasibility of directions marked by y Table 1. Feasibility of directions Optimization variables Feasible Infeasible is due to the special property of regression SVM that ff i ff * It follows from the table that at each pass only one direction is feasible. This lemma justifies the feasibility test of the maximal inconsistency algo- rithm. It is clear from Table 1 that during the left pass there is no feasible direction for samples with ff during the right pass there is no feasible direction for samples with ff The next two lemmas show that \Phi ~ ff provides a solution to the feasible direction problem. Lemma 2. \Phi ~ ff satisfies all constraints of the feasible direction problem. Proof. The equality constraint of the optimal feasible dirction problem for the regression SVM has the form: l l d * be the number of selected elements with directions f1; 0g,f\Gamma1; 0g, f0; \Gamma1g, f0; 1g respectively. Then l l d * By the selection policy: from which it follows that Hence, \Phi ~ ff satisfies the equality constraint of the optimal feasible direction problem Inequality constraints and the cardinality constraint are trivially satisfied by the construction of \Phi ~ ff . Lemma 3. \Phi ~ ff provides the optimal value of the objective function of the feasible direction problem. Proof. Let B l and B r denote the halves of the working set selected by the left and the right passes respectively. Suppose, by the way of contradiction, that there exists a feasible sample i such that g i d i ? For any element k considered during the left pass k if (0; \Gamma1) is feasible Therefore, if which contradicts the hypothesis that Likewise, for any element k considered during the right pass k if (0; 1) is feasible Therefore, if \Gammag which contradicts the hypothesis that Lemma 4. Intersection of -sets is non-empty if an only if the feasible direction problem has a zero solution. Proof. By Theorem 3, non-empty intersection of -sets implies optimality of the solution to the quadratic program (1) - (3) which rules out existence of a non-zero feasible direction which would otherwise have have led to a new optimal solution. On the other hand, if the optimal solution to the feasible direction problem is zero, this implies that all other feasible directions have negative projections on the gradient vector, and hence decrease the value of the objective function. It follows that the solution of the quadratic program (1) - (3) is optimal, and hence intersection of -sets is non-empty. prove the two properties of the mapping \Phi ~ ff and the normalization Nd claimed earlier in this section. 6 Experimental Results The aim of this section is to provide insight into some properties of feasible direction decomposition algorithms that might explain their behaviour in different situations. In particular, the following issues are addressed: scaling factors. This is the traditional way of analyzing performance of SVM training algorithms, introduced by Platt [10] and Joachims [3]. To perform at least qualitative comparison with their results, a similar evaluation is performed for the maximal inconsistency algorithm. - Experimental convergence rates. In traditional optimization literature algorithms are most often evaluated in terms of their convergence rates. Since the decomposition algorithms borrow their core ideas from optimization theory and are iterative, it is natural to attempt to establish their rates of con- vergence. It will be shown that the maximal inconsistency algorithm seems to have linear rate of convergence which is consistent with known linear convergence rates for gradient descent methods. Profiled scaling factors. While decreasing the number of iterations is highly desirable, it must not be achieved at a cost of significantly increasing the cost of an iteration. It is therefore important to investigate the "profile" of one iteration of the decomposition algorithm. Experimental evaluation of the new algorithm was performed on the modified KDD Cup 1998 data set. The original data set is available under http://www.ics.uci.edu/kdd/databases/kddcup98/kddcup98.html. The following modifications were made to obtain a pure regression problem: - All 75 character fields were eliminated. fields CONTROLN, ODATEDW, TCODE and DOB were elimi- tated. The remaining 400 features and the labels were scaled between 0 and 1. Initial subsets of the training database of different sizes were selected for evaluation of the scaling properties of the new algorithm. Experiments were run on a SUN4U/400 Ultra-450 workstation with 300MHz clock and 2048M RAM. RBF kernel with cache size of 300M were used. The value of the box constraint C was 1, and the working set of size was used. Two sets of experiments were performed: one using the full set of 400 features, another one using only the first 50 features ("reduced set"). As it turns out, the second problem is more constrained, with a larger proportion of bounded support vectors. Also, for the full set of features kernel computation dominates the overall training time. 6.1 Overall Scaling Factors The training times, with and without decomposition, for different samples sizes, are displayed in Tables 2 and 3, for the full and the reduced sets of features respectively. The scaling factors are computed by plotting training times versus sample sizes on a log-log scale and fitting straight lines. The SV-scaling factors are obtained in the same fashion, only using the number of unbounded support vectors instead of the sample size as an abscissa. The actual plots are shown in Figure 1. It can be easily seen that decomposition improves the running time by an order of magnitude. It's scaling factors are also significantly better. The scaling factors are consistent with the scaling factors presented by Platt [10] and Joachims [3] for the pattern recognition SVM. A number of other interesting findings can be made from the results above. First, it is easily seen that the training with decomposition does not produce an identical solution to training without. The solutions differ in the number of support vectors, especially for the more constrained problem with the reduced set of features. This difference is due to the fact that the termination conditions 7 In order for the results to be conceptually compatible with Joachims' I used the old point-wise termination conditions. Table 2. Training time (sec) and number of SVs for the KDD Cup problem. Examples no dcmp dcmp time total SV BSV time total SV BSV 1000 91.193 454 0 24.907 429 0 2000 665.566 932 2 118.131 894 2 5000 10785.4 2305 7 914.359 2213 7 10000 92684.7 4598 28 4958.26 4454 26 scaling factor: 3.03 2.29 SV-scaling factor: 2.86 2.13 Table 3. Training time (sec) and number of SVs for the KDD Cup problem, reduced feature set. Examples no dcmp dcmp time total SV BSV time total SV BSV 500 16.958 114 29 14.175 128 26 1000 129.591 242 2000 998.191 445 114 178.752 656 104 5000 10759.6 977 323 929.523 1667 255 10000 79323.2 1750 633 2782.35 3383 491 scaling factor: 2.80 1.76 SV-scaling factor: 3.12 1.60 logT Scaling factors for SVM training with and without decomposition (a) logT Scaling factors for SVM training with and without decomposition (b) Fig. 1. Scaling factor fits: (a) full set of features (Table 2), (b) reduced set of features Table of the decomposition algorithm require that KKT conditions be satisfied only to a given numerical precision. Thus the decomposition algorithm does have a disadvantage of producing an approximate solution, which can be further seen from Tables 4 and 5. These tables display the values of the objective functions attained by training with and without decomposition, and their ratio. The latter shows that in the relative turns, a solution of the more constrained problem with the reduced feature set is roughly 10 times worse that the solution of the less constrained problem with the fulls feature set. However, no deviation of the accuracy with the sample size is observed. Another important observation is that the scaling factors and the SV-scaling factors vary among different problems. For the two particular problems, a possible explanation might be that the fixed termination accuracy is in fact looser for the more constrained problem, thereby producing a less accurate solution but taking less time in doing so. In general, however, the results above demonstrate that the scaling factors produce a rather crude measure of performance of the decomposition algorithms 8 . Table 4. Objective function values for KDD Cup problem. Examples no dcmp dcmp ratio 1000 0.43501 0.43488 0.99970 2000 1.27695 1.27662 0.99974 5000 3.19561 3.19414 0.99953 10000 6.74862 6.74507 0.99947 Table 5. Objective function values for KDD Cup problem, reduced feature set. Examples no dcmp dcmp ratio 500 1.11129 1.10823 0.99724 1000 3.25665 3.24853 0.99750 2000 6.41472 6.39787 0.99456 5000 14.5490 14.5164 0.99776 10000 26.9715 26.9119 0.99779 8 The scaling factors also vary in the results of Joachims [3]. 6.2 Convergence Rates In optimization literature, a common performance measure for iterative algorithms is convergence rate. The notion of the convergence rate is generally defined for any numeric sequence; for the purpose of analysis of decomposition algorithms we will be concerned with the sequence of objective function values. The following definitions are taken from [7]. Let x k be a sequence in IR n that converges to x * . Convergence is said to be Q-linear if there is a constant r 2 (0; 1) such that sufficiently large, The prefix "Q" stands for "quotient" because the quotient of successive distances from the limit point is considered. Likewise, convergence is said to be Q-superlinear if lim and is said to be of order p (for p ? 1) or quadratic (for M; for all k sufficiently large. where M is a positive constant not necessarily less than 1. It can be easily seen that a Q-convergent sequence of order strictly greater than 1 converges Q-superliearly 9 . Convergence rates can be observed experimentally by recording the values of the objective function through the course if iteration and plotting the respective ratios versus the iteration number. Sample plots are shown in Figures 2 and 3 for both problems on a training sample of size 10000. Limit points have been obtained from training without decomposition. Similar plots have been observed in other experiments. It is evident from the convergence plots that the decomposition algorithm converges linearly but not superlinearly or quadratically 10 . The plots also reveal that the training problem is very ill-conditioned, as the ratio stays very close to 1. The above results are consistent with known linear convergence rates for gradient descent methods for unconstrained optimization. Noteworthy is particular semblance for the full feature set problem in which most of the variables stay away from the upper bounds and thus resemble an unconstrained case. Another important message is that convergence analysis (experimental or theoretical) is of special importance for decomposition algorithms. Unlike the scaling factors it reveals the effects of conditioning on the algorithm's performance. 9 The prefix "Q" will be omitted in the rest of the presentation in this section. It is difficult to see from the plot for the reduced feature set, but there is a tiny margin of 0:0001 which seprates the ratios from 1. 0.9920.9940.9960.998iteration linear ratio (a) linear 1000 2000 3000 4000 5000 6000 7000 8000 90000.961.021.06 iteration ratio 1000 2000 3000 4000 5000 6000 7000 8000 9000100200300 iteration quadratic ratio (c) quadratic Fig. 2. Convergence rates for the full feature space 1000 2000 3000 4000 5000 6000 70000.9910.9930.9950.9970.999 iteration linear ratio (a) linear 1000 2000 3000 4000 5000 6000 70000.960.981.011.03 iteration ratio 1000 2000 3000 4000 5000 6000 70001216iteration quadratic ratio (c) quadratic Fig. 3. Convergence rates for the reduced feature space 6.3 Profiled Scaling Factors The overall processing performed during an iteration of the feasible direction decomposition algorithm can be broken up into 5 main steps: 1. Optimization: optimization proper and calculation of support vectors. 2. Update of gradients. 3. Kernel evaluation: all requests for dot products (from all modules of the system). Notice that with caching of kernel evaluations, this operation is not equally distributed across iterations: at the beginning it takes longer when kernels must be computed; towards the end all kernels end up in cache 11 . 4. Selection: computation of maximal violation of KKT conditions, left and right passes. 5. Evaluation: computation of objective function and threshold. In the following section the scaling factors per iteration are established for the five factors (overall scaling factors for kernel evaluation). Optimization scaling factors. The values of obtained selection scaling factors are 0.237 for the full feature space and 0.176 for the reduced feature space, however the quality of fits is low. The expected behavior was constant-time per iteration, because the working sets are of constant size. Perhaps, for larger data sets conditioning of sub-problems deteriorates slightly, thus increasing the number of iterations in the optimizer 12 . The fits are displayed in Figure 4 2.2 2.4 2.6 2.8 3.2 3.4 3.6 3.8 4 -3.6 -3.4 -3.2 -2.6 -2.4 -2.2 log logT opt Optimization scaling factor (a) full set of features 2.2 2.4 2.6 2.8 3.2 3.4 3.6 3.8 4 -3.6 -3.4 -3.2 -2.6 -2.4 -2.2 log logT opt Optimization scaling factor (b) reduced set of features Fig. 4. Optimization scaling factor fits. 11 In the experiments above enough memory was allocated for the kernel cache to hold the values of kernels for all support vectors. 12 The current implementation uses MINOS to solve optimization problems. Update scaling factors. The values of obtained update scaling factors are 1.060 for the full feature space and 1.064 for the reduced feature space. This coinsides with the theoretical expectations of linear growth order of update op- eration. The fits are displayed in Figure 5. 2.2 2.4 2.6 2.8 3.2 3.4 3.6 3.8 4 -2.6 -2.4 -2.2 -1.4 -1.2 log logT update Update scaling factor (a) full set of features 2.2 2.4 2.6 2.8 3.2 3.4 3.6 3.8 4 -2.6 -2.4 -2.2 -1.4 -1.2 log logT update Update scaling factor (b) reduced set of features Fig. 5. Update scaling factor fits. Kernel scaling factors. Kernel scaling factors are computed based on the timing accumulated over the entire run. The obtained values are 2.098 and 2.067 for the full and the reduced sets of features respectively. This coincides with the expected quadratic order of growth. The fits are displayed in Figure 6. logT kernel Kernel scaling factor (a) full set of features logT kernel Kernel scaling factor (b) reduced set of features Fig. 6. Kernel scaling factor fits. Selection scaling factors. The values of obtained selection scaling factors are 1.149 for the full feature space and 1.124 for the reduced feature space. This is close to the theoretical expectations of linear growth order of selection operation 13 . The fits are displayed in Figure 7. 2.2 2.4 2.6 2.8 3 3.2 3.4 3.6 3.8 4 -2.6 -2.4 -2.2 -1.4 -1.2 (a) full set of features 2.2 2.4 2.6 2.8 3.2 3.4 3.6 3.8 4 -2.6 -2.4 -2.2 -1.4 -1.2 log logT selection Selection scaling factor (b) reduced set of features Fig. 7. Selection scaling factor fits. Evaluation scaling factors. The values of obtained evaluation scaling factors are 1.104 for the full feature space and 1.118 for the reduced feature space. This is close to the theoretical expectations of linear growth order of evaluation operation. The fits are displayed in Figure 8. Conclusions The unified treatment of the working set selection in decomposition algorithms presented in this article provides a general view of decomposition methods based on the principle of feasible direction, regardless of the particular SVM formula- tion. Implementation of the maximal inconsistency strategy is straightforward for both pattern recognition and regression SVM, and either of the termination conditions can be used. Formal justification of the maximal inconsistency strategy provides a useful insight into the mechanism of working set selection. The experimental results demonstrate that, similar to the pattern recognition case, significant decrease of training time can be achieved by using the decomposition algorithm. While the scaling factors of the decomposition algorithms are significantly better than those of straightforward optimization, a word of 13 The implementation uses heap-based method whose theoretical running time order is O(n log q). The logarithmic factor does not feature in the scaling factor because q is assumed constant. 2.4 2.6 2.8 3.2 3.4 3.6 3.8 4 log logT evaluation Evaluation scaling factor (a) full set of features 2.2 2.4 2.6 2.8 3.2 3.4 3.6 3.8 4 log logT evaluation Evaluation scaling factor (b) reduced set of features Fig. 8. Evaluation scaling factor fits. caution needs to be said with regard to the constants. It can be seen from the profiled experiments that the worst-case growth orders can only be given on a per-iteration basis, and the number of iterations, which depends on the convergence rate and the required precision, adds another dimension to running time analysis. The linear convergence rate observed in the experiments suggests that the progress towards the optimal solution can be slow. Additional investigation of the impact of problem conditioning is necessary. A number of open questions remain regarding the SVM decomposition al- gorithms. Can the linear convergence rate be established theoretically? Can a super-linear or a quadratic convergence rate be achieved by a different algo- rithm? Finally, extremely far-reaching results can be borne by investigation of conditioning of the training problem: since the latter is a by-product of a number of factors, such as the choice of kernel, the box constraint, the risk functional, etc, conditioning of the optimization problem might be useful to guide the choice of SVM parameters. --R Quadratic Programming. The analysis of decomposition methods for support vector machines. Making large-scale support vector machine learning practical Solving the quadratic problem arising in support vector classi- fication An improved decomposition algorithm for regression support vector machines. Nonlinear Programming. Numerical Optimization. Support Vector Machines: Training and Applications. Improved training algorithm for support vector machines. Fast training of support vector machines using sequential minimal optimization. Support Vector Learning. Advances in Kernel Methods - Support Vector Learning Learning with Kernels. A tutorial on support vector regression. Estimation of Dependences Based on Empirical Data. The Nature of Statistical Learning Theory. Statistical Learning Theory. Methods of Feasible Directions. --TR --CTR Shuo-Peng Liao , Hsuan-Tien Lin , Chih-Jen Lin, A note on the decomposition methods for support vector regression, Neural Computation, v.14 n.6, p.1267-1281, June 2002 Chih-Chung Chang , Chih-Jen Lin, Training v-support vector regression: theory and algorithms, Neural Computation, v.14 n.8, p.1959-1977, August 2002 Chih-Wei Hsu , Chih-Jen Lin, A Simple Decomposition Method for Support Vector Machines, Machine Learning, v.46 n.1-3, p.291-314, 2002 Rameswar Debnath , Masakazu Muramatsu , Haruhisa Takahashi, An Efficient Support Vector Machine Learning Method with Second-Order Cone Programming for Large-Scale Problems, Applied Intelligence, v.23 n.3, p.219-239, December 2005 Nikolas List , Hans Ulrich Simon, General Polynomial Time Decomposition Algorithms, The Journal of Machine Learning Research, 8, p.303-321, 5/1/2007 Pavel Laskov , Christian Gehl , Stefan Krger , Klaus-Robert Mller, Incremental Support Vector Learning: Analysis, Implementation and Applications, The Journal of Machine Learning Research, 7, p.1909-1936, 12/1/2006 Don Hush , Patrick Kelly , Clint Scovel , Ingo Steinwart, QP Algorithms with Guaranteed Accuracy and Run Time for Support Vector Machines, The Journal of Machine Learning Research, 7, p.733-769, 12/1/2006 Tatjana Eitrich , Bruno Lang, On the optimal working set size in serial and parallel support vector machine learning with the decomposition algorithm, Proceedings of the fifth Australasian conference on Data mining and analystics, p.121-128, November 29-30, 2006, Sydney, Australia Hyunjung Shin , Sungzoon Cho, Neighborhood Property--Based Pattern Selection for Support Vector Machines, Neural Computation, v.19 n.3, p.816-855, March 2007
support vector machines;training;working set selection;decomposition algorithms;methods of feasible directions
599674
PAC Analogues of Perceptron and Winnow Via Boosting the Margin.
We describe a novel family of PAC model algorithms for learning linear threshold functions. The new algorithms work by boosting a simple weak learner and exhibit sample complexity bounds remarkably similar to those of known online algorithms such as Perceptron and Winnow, thus suggesting that these well-studied online algorithms in some sense correspond to instances of boosting. We show that the new algorithms can be viewed as natural PAC analogues of the online p-norm algorithms which have recently been studied by Grove, Littlestone, and Schuurmans (1997, Proceedings of the Tenth Annual Conference on Computational Learning Theory (pp. 171183) and Gentile and Littlestone (1999, Proceedings of the Twelfth Annual Conference on Computational Learning Theory (pp. 111). As special cases of the algorithm, by taking p &equals; 2 and p &equals; we obtain natural boosting-based PAC analogues of Perceptron and Winnow respectively. The p &equals; case of our algorithm can also be viewed as a generalization (with an improved sample complexity bound) of Jackson and Craven's PAC-model boosting-based algorithm for learning sparse perceptrons (Jackson & Craven, 1996, Advances in neural information processing systems 8, MIT Press). The analysis of the generalization error of the new algorithms relies on techniques from the theory of large margin classification.
INTRODUCTION One of the most fundamental problems in computational learning theory is that of learning an unknown linear threshold function from labeled examples. Many different learning algorithms for this problem have been considered over the past several decades. In particular, in recent years many researchers have studied simple online additive and multiplicative update algorithms, namely the Perceptron and Winnow algorithms and variants thereof [3, 5, 8, 14, 15, 16, 25, 26, 27, 28, 33, 36]. This paper takes a different approach. We describe a natural parameterized family of boosting-based PAC algorithms for learning linear threshold functions. The weak hypotheses used are linear functionals and the strong classifier obtained is a linear threshold function. Although these new algorithms Supported in part by an NSF Graduate Fellowship, by NSF grant CCR-95-04436 and by ONR grant N00014-96-1-0550. are conceptually and algorithmically very different from Perceptron and Winnow, we establish performance bounds for the new algorithms which are remarkably similar to those of Perceptron and Winnow; we thus refer to the new algorithms as PAC analogues of Perceptron and Winnow. We hope that the analysis of these new algorithms will yield fresh insights into the relationship between boosting and online algorithms. We give a unified analysis of our Perceptron and Winnow analogues which includes many other algorithms as well. Grove, Littlestone and Schuurmans [16] have shown that Perceptron and (a version of) Winnow can be viewed as the cases of a general online p-norm linear threshold learning algorithm, where p - 2 is any real number. We present PAC-model boosting-based analogues of these online p-norm algorithms for any value 2 - p - 1: The PAC-model Perceptron and Winnow analogues mentioned above are respectively the cases of this general algorithm. The case of our algorithm can also be viewed as a generalization of Jackson and Craven's PAC-model algorithm for learning "sparse perceptrons" [20]. Their algorithm boosts using weak hypotheses which are single Boolean lit- erals; this is similar to what the case of our algorithm does. Our analysis of the case generalizes their algorithm to deal with real-valued rather than Boolean input variables and yields a substantially stronger sample complexity bound than was established in [20]. Section 2 of this paper contains preliminary material, including an overview of the online p-norm algorithms from [15, 16]. In Section 3 we present a simple PAC-model p-norm algorithm and prove that it is a weak learning algorithm for all 2 - In Section 4 we apply techniques from the theory of large margin classification to show how our learning algorithm can be boosted to a strong learning algorithm with small sample complexity. Finally, in Section 5 we compare our PAC algorithms with the analogous online algorithms, extend our algorithm to the case discuss the relationship between the case of our algorithm and the Jackson-Craven algorithm for learning sparse perceptrons. 1.1 RELATED WORK Several authors have studied linear threshold learning algorithms which work by combining weak predictors. Freund and Schapire [14] describe an algorithm which combines intermediate Perceptron algorithm hypotheses using a weighted majority vote (so the final classifier is a depth-2 threshold circuit) and prove bounds on the generalization error of the resulting classifier. Their algorithm does not use boosting to combine the Perceptron hypotheses but rather weights them according to their survival time. Ji and Ma [21] propose a random-search-and-test approach to find weak classifier linear threshold functions and combine them by a simple majority vote (thus also obtaining a depth-2 threshold circuit). Our approach is closest to that of Jackson and Craven [20] who use boosting to combine single literals into a strong hypothesis linear threshold function. As described in Section 5, the case of our algorithm strengthens and generalizes their results. More generally, we also note that Freund and Schapire [12] and Schapire [32] have exhibited a close relationship between boosting and online learning. We start with some geometric definitions. For a point ~ to denote the p-norm of ~ namely The 1-norm of ~ x is k~xk the q-norm is dual to the p-norm if 1 hence the 1-norm and the 1-norm are dual to each other and the 2- norm is dual to itself. In this paper p and q always denote dual norms. The following facts are well known (e.g. [37] pp. H- older Inequality: j~u \Delta ~ Minkowski Inequality: k~u ~ Throughout this paper the example space X is a subset of linear threshold function over X is a function f such that the function sign(z) takes value 1 if z - 0 and takes value We note that the standard definition of a linear threshold function allows a nonzero threshold, i.e. can be any real number. However, any linear threshold function of this more general form over n variables is equivalent to a linear threshold function with threshold 0 over our definition incurs no real loss of generality. We write kXk p to denote sup ~ x2X k~xk We use the symbol u;X to denote the quantity ~ x2X which is a measure of the separation between examples in X and the hyperplane whose normal vector is ~ u: We assume throughout the paper that kXk p ! 1; i.e. the set X is bounded, and that ffi ~ there is some nonzero lower bound on the separation between the hyperplane defined by ~ u and the examples in X . 2.1 PAC LEARNING For ~ denote an example oracle which, when queried, provides a labeled example where ~ x is drawn according to the distribution D over X: We say that an algorithm A is a strong learning algorithm for ~ u on X if it satisfies the following condition: there is a function X) such that for any distribution D over X; for A makes at most m(ffl; ffi; ~ calls to EX(~u; D); and with probability at least A outputs a hypothesis h 1g such that Pr x2D [h(~x) 6= sign(~u \Delta ~ We say that such a hypothesis h is an ffl-accurate hypothesis for ~ under D and that the function m(ffl; ffi; ~ X) is the sample complexity of algorithm A: As our main result we describe a strong learning algorithm and carefully analyze its sample complexity. To do this we must consider algorithms which do not satisfy the strong learning property but are still capable of generating hypotheses that have some slight advantage over random guessing (such so-called weak learning algorithms were first considered by Kearns and Valiant in [24]). Let be a finite sequence of labeled examples from X and let D be a distribution over S: For we say that We say that an algorithm A is a (1=2 \Gamma fl)-weak learning algorithm for ~ u under D if the following condition holds: for any finite set S as described above and any distribution D on if A is given D and S as input then A outputs a hypothesis which is a (1=2 \Gamma fl)-approximator for ~ u under D: Thus for our purposes a weak learning algorithm is one which can always find a hypothesis that outperforms random guessing on a fixed sample. 2.2 ONLINE LEARNING AND p-NORM ALGORITHMS In the online model, learning takes place over a sequence of trials. Throughout the learning process the learner maintains a hypothesis h which maps X to f\Gamma1; 1g: Each trial proceeds as follows: upon receiving an example x 2 X the learning algorithm outputs its prediction - of the associated label y: The learning algorithm is then given the true label y 2 f\Gamma1; 1g and the algorithm can update its hypothesis h based on this new information before the next trial begins. The performance of an online learning algorithm on an example sequence is measured by the number of prediction mistakes which the algorithm makes. Grove, Littlestone and Schuurmans [16] and Gentile and Littlestone [15] have studied a family of online algorithms for learning linear threshold functions (see Figure 1). We refer to this algorithm, which is parameterized by a real value as the online p-norm algorithm. Like the well-known Perceptron algorithm, the online p-norm algorithm updates its hypothesis by making an additive change to a weight vector ~ z: However, as shown in steps 4-5 of Figure 1, the p-norm Input parameter: real number p - 2; initial weight vector ~ positive value a ? 0 1. set 2. while examples are available do 3. get unlabeled example ~ 4. for all 5. predict - 6. get label y t 2 f\Gamma1; +1g 7. for all 8. set 9. enddo Figure 1: The online p-norm algorithm. algorithm does not use the ~ z vector directly for prediction but rather predicts using a vector ~ w which is a transformed version of the ~ z vector, namely w that when w and hence the online 2-norm algorithm is the Perceptron algo- rithm. In [16] it is shown that as p ! 1 the online p-norm algorithm approaches a version of the Winnow algorithm. More precisely, the following theorem from [16] gives mistake bounds for the online p-norm algorithms: Theorem 1 Let be a sequence of labeled examples where ~ every example h~x; yi 2 S: (a) For any 2 - a ? 0; if the online p-norm algorithm is invoked with input parameters (p; ~ z then the mistake bound on the example sequence S is at most ~ (b) For any 2 - ; then the mistake bound on S is at most ~ z 0 (c) Let ~ suppose that a is as described in part (b), then the mistake bound given in (b) converges to ~ u;X log log 2.3 FROM ONLINE TO PAC LEARNING Various generic procedures have been proposed [1, 18, 22] for automatically converting on-line learning algorithms into PAC-model algorithms. In these procedures the sample complexity of the resulting PAC algorithm depends on the mistake bound of the original on-line learning algorithm. The strongest general result of this type (in terms of minimizing the sample complexity of the resulting PAC algorithm) is the "longest-survivor" conversion due to Kearns, Li, Pitt and Theorem 2 Let A be an on-line learning algorithm which is guaranteed to make at most M mistakes. Then there is a PAC-model learning algorithm A 0 which uses O logffi log M examples and outputs an ffl-accurate hypothesis with probability Theorems 1 and 2 yield sample complexity bounds on a generic PAC-model conversion of the online p-norm algo- rithm. We now describe a completely different PAC-model algorithm which has remarkably similar sample complexity bounds. 3 A PAC-MODEL p-NORM WEAK The p-norm weak learning algorithm is motivated by the following simple idea: Suppose that is a collection of labeled examples where y for each replacing each negative example by the equivalent positive example to obtain a new collection S 0 of examples. Let ~ be the average location of an example in S 0 ; i.e. ~ z is the "center of mass" of every example in S 0 must lie on the same side of the hyperplane ~ as the vector ~ u; it is clear that ~ z must also lie on this side of the hyper- plane. One might even hope that ~ z; or some related vector, points in approximately the same direction as the vector ~ u: Our p-norm weak learning algorithm, which we call WLA, is presented in Figure 2. As in the online p-norm algorithm, WLA transforms the vector ~ z to a vector ~ w using the mapping now show that this simple algorithm is in fact a weak learner: Theorem 3 WLA is a (1=2 \Gamma fl)-weak learning algorithm for ~ under D for 1 Littlestone [27] gives a conversion procedure which yields a PAC sample complexity bound of O(ffl Although this improves on the result of [22] by a log M factor, Littlestone's procedure requires the example space X to be finite, which is a stronger assumption than we make in this paper. Input parameters: real number p - 2; sequence labeled examples, distribution D 1. set ~ 1. for all 2. return hypothesis h(~x) j ~ Figure 2: The p-norm weak learning algorithm WLA. Proof: Let be a sequence of labeled examples where ~ x 2 X and x) for every let D be a distribution over S: We will show that the hypothesis h which WLA(p; S; D) returns is a To see that h maps X into [\Gamma1; 1]; note that for any ~ H-older's inequality implies Now we show that inequality (1) from Section 2.1 holds. we have that and thus2 wk q Thus it suffices to show that wk q We first note that x jA and hence the left-hand side of the desired inequality equals where in the second equality we used the fact that (p \Gamma p: Consequently the left-hand side can be further simplified to k~zk p thus our goal is to show that k~zk p - ffi ~ x jA where the last line follows from the H-older inequality, and the theorem is proved. We have shown that the simple WLA algorithm is a weak learning algorithm for our halfspace learning problem. In this section we use techniques from boosting and large margin classification to obtain a strong learning algorithm with small sample complexity. 4.1 BOOSTING TO ACHIEVE HIGH ACCURACY In a series of important papers Schapire [31] and Freund [10, 11] have given boosting algorithms which transform weak learning algorithms into strong ones. In this paper we use the Adaboost algorithm from [13] which is shown in Figure 3; our notation for the algorithm is similar to that of [34, 35]. The input to Adaboost is a sequence labeled examples, a weak learning algorithm WL, and two parameters Given a distribution outputs a hypothesis h Adaboost successively generates new distributions uses WL to obtain hypotheses h t ; and ultimately outputs as its final hypothesis a linear threshold function over the h t s. In [13] Freund and Schapire prove that if the algorithm WL is a (1=2 \Gamma fl)-weak learning algorithm (i.e. each call of WL in Adaboost generates a hypothesis h t such that ffl t - then the fraction of examples in S which are mis-classified by the final hypothesis h is at most -: Given this result, one straightforward way to obtain a strong learning algorithm for our halfspace learning problem is to draw a sufficiently large (as specified below) sample S from the example oracle EX(~u; D) and run Adaboost on S using WLA as the weak learning algorithm, fl as given in Theorem 3, and This choice of - ensures that Adaboost's final hypothesis makes no errors on S; moreover, since each hypothesis generated by WLA is of the form h t for some ~ v final hypothesis is of the Using the well-known fact that the VC dimension of the class of zero-bias Input parameters: sequence labeled examples, weak learning algorithm WL: S ! [\Gamma1; 1]; two real values 1. set log 1 2. for all 3. for do 4. let h t be the output of WL(D t ; S) 5. set ffl 7. for all normalizing factor (so that D t+1 will be a distribution) 9. enddo 10. output as final hypothesis h(x) j sign(f(x)); where Figure 3: The Adaboost algorithm. linear threshold functions over ! n is n; the main result of implies that with probability at least 1 \Gamma ffi the final hypothesis h is an ffl-accurate hypothesis for ~ u under D provided that jSj - c(ffl \Gamma1 (n log(ffl c ? 0: This analysis, though attractively simple, yields a rather crude bound on sample complexity which does not depend on the particulars of the learning problem (i.e. ~ u and X). In the rest of this section we use recent results on Adaboost's ability to generate a large-margin classifier and the generalization ability of large-margin classifiers to give a much tighter bound on sample complexity for this learning algorithm 4.2 BOOSTING TO ACHIEVE A LARGE MARGIN Suppose that is a classifier of the form We say that the margin of h on a labeled example hx; yi is yf(x); note that this quantity is nonnegative if and only if h correctly predicts the label y associated with x: The following theorem, which is an extension of Theorem 5 from [34], shows that Adaboost generates large- margin hypotheses. Theorem 4 Suppose that Adaboost is run on an example sequence using a weak learning algorithm WL: S ! [\Gamma1; 1]: Then for any value ' - 0 we have Y The theorem stated in [34] only covers the case when WL maps S to f\Gamma1; 1g: We need this more general version because the weak hypotheses of Theorem 3 map S to [\Gamma1; 1] rather than f\Gamma1; 1g: The proof of Theorem 4 is given in Appendix A. The results of Section 3 imply that if WLA is used as the learning algorithm in Adaboost, then the value ffl t will always be at most 1=2 \Gamma fl; and the upper bound of Theorem 4 becomes ((1\Gamma2fl) 1\Gamma' (1+2fl) 1+' easy lemma is proved in Appendix B: 1=4: If we set and apply this lemma with the upper bound of Theorem 4 becomes obtain the following: Corollary 6 If Adaboost is run on a sequence S of labeled examples drawn from EX(~u; D) using WLA as the learner, fl as defined in Theorem 3 and then the hypothesis h which Adaboost generates will have margin at least fl=2 on every example in S: Proof: The bound on - causes T to be greater than 2 log 1 and consequently the upper bound of Theorem 4 is less than 1=jSj: In the next subsection we use Corollary 6 and the theory of large margin classification to establish a bound on the generalization error of h in terms of the sample size m: 4.3 LARGE MARGINS AND GENERALIZATION Let F be a collection of real-valued functions on a set X: A finite set fx is said to be -shattered by F if there are real numbers r such that for all (b there is a function f b 2 F such that For - 0; the fat-shattering dimension of F at scale -; denoted fat F (-); is the size of the largest set which is - shattered by F ; if this is finite, and infinity otherwise. The fat-shattering dimension is useful for us because of the following theorem from [4]: Theorem 7 Let F be a collection of real-valued functions on X and let D be a distribution over X \Theta f\Gamma1; 1g: Let be a sequence of labeled examples drawn from D: With probability at least 1 \Gamma ffi over the choice of S; if a classifier h(x) j sign(f(x)) with f 2 F has margin at least - ? 0 on every example in S; then Pr d log 8em d 8m As noted in Section 4.1, the final hypothesis h which Adaboost outputs must be of the form with x for some ~ each invocation of WLA generates a hypothesis of the form x with k~v t k q - 1 implies that the vector ~ must satisfy k~vk q - 1 consider the class of functions ae ~ x 7! ~ oe If we can bound fat F (-); then given any sample size m; Theorem 7 immediately yields a corresponding bound on Pr x2D [h(~x) 6= sign(~u \Delta ~ x)] for our halfspace learning prob- lem. The following theorem proved in Appendix C gives the desired bound on fat F (-) : Theorem 8 Let X be a bounded region in ! n and let F be the class of functions on X defined in (2) above. Then fat F (- 2 log 4n Combining Theorem 3, Corollary 6, and Theorems 7 and it follows that if our algorithm uses a sample of size m; then with probability at least 1 \Gamma ffi the hypothesis h which is generated will satisfy Pr ~ x2D O ~ log n log 2 m+ log Thus we have established the following (where the ~ O-notation hides log Theorem 9 The algorithm obtained by applying Adaboost to WLA using the parameter settings described in Corollary 6 is a strong learning algorithm for ~ u on X with sample complexit O ~ The sample complexity of our boosting-based p-norm PAC learning algorithm is remarkably similar to that of the PAC- transformed online p-norm algorithms of Section 2.1. Up to log factors both sets of bounds depend linearly on ffl \Gamma1 and quadratically on k~uk q kXk p =ffi ~ Comparing the bounds in more detail, we see that the online variant described in part (a) of Theorem 1 has an extra factor of in its bound which is not present in the sample complexity of our algo- rithm. Variant (a) offers the advantage, though, that the user does not need to know the values of any quantities such as kXk p or k~uk q in advance in order to run the algorithm. Turning to part (b) of Theorem 1, we see that if the parameter a is set appropriately in the online algorithm then the online bound differs from our PAC algorithm bound only by an extra factor of z 0 (again ignoring log factors). Part (c) of Theorem 1 shows that as even when ~ z 0 is chosen to be We also note that when \Omega\Gamma557 n) Gentile and Littlestone [15] have given alternative expressions for the online p-norm bounds in terms of kXk1 and Using an entirely similar analysis the bounds of our algorithm can be analogously rephrased in this case as well. 5.1 Since the case of the online p-norm algorithm is precisely the Perceptron algorithm, the case of our algorithm can be viewed as a natural PAC-model analogue of the online Perceptron algorithm. We note that when the upper bound given in Lemma 12 of Appendix C can be strengthened to d \Delta kXk 2 (see Lemma 1.3 of [4] or Theorem 4.1 of [2] for a proof). This means that the fat-shattering dimension upper bound of Theorem 8 can be improved to- 2 which removes a log factor from the bound of Theorem 9; however this bound will still contain various log factors because of the log terms in Theorem 7. 5.2 ALGORITHM At the other extreme, we now define a natural of our algorithm. Consider the vectors ~ z and ~ w which are computed by the weak learning algorithm WLA. If we let r be the number of coordinates z i of ~ z such that jz then for any i we have lim wk q ae sign(z i )=r if jz Hence it is natural to consider a version of WLA, which we denote WLA 0 , in which the vector ~ w is defined by taking wise. All of our analysis continues to hold (with minor modifications described in Appendix D) and we obtain a strong learning algorithm: Theorem 9 holds for in place of WLA. There is a close relationship between this and the work of Jackson and Craven on learning sparse perceptrons [20]. Note that if only one coordinate of ~ z has jz then the WLA 0 hypothesis is kXk1 where ' is the signed variable from which is most strongly correlated under distribution D with the value of sign(~u \Delta ~ This is very similar to the weak learning algorithm used by Jackson and Craven in [20], which takes the single best-correlated literal as its hypothesis (break- ing ties arbitrarily). The proof that this "best-single-literal" algorithm used in [20] is a weak learning algorithm is due to Goldmann, H-astad and Razborov [17]. However, the proof in [17] assumes that the example space X is f0; 1g n and the target vector ~ u has all integer coefficients; thus, as noted by Jackson and Craven in [20], their algorithm for learning sparse perceptrons only applies to learning problems which are defined over discrete input domains. In contrast, our algorithm can be applied on continuous input domains - the only restrictions are that the example space X and the target vector ~ u satisfy We also observe that Theorem 9 establishes a tighter sample complexity bound for our strong learning algorithm than was given in [20]. To see this, let and suppose that the target vector ~ coefficients, so the algorithm from [20] can be applied. For this learning problem we have ffi ~ u;X =\Omega\Gamma20 and letting Theorem 9 implies that our learning algorithm has sample complexity roughly s 2 =ffl (ig- noring log factors). This is a substantial improvement over the roughly s 4 =ffl sample complexity bound given in [20]. More generally, the sample complexity bound given in [20] for learning "s-sparse k-perceptrons" is roughly ks 4 =ffl; the analysis of this paper can easily be extended to establish a sample complexity bound of roughly ks 2 =ffl for learning s- sparse k-perceptrons. 6 OPEN QUESTIONS Our results give evidence of the broad utility of boosting algorithms such as Adaboost. A natural question is how much further this utility extends: are there simple boosting-based PAC versions of other standard learning algorithms? We note in this context that Kearns and Mansour [23] have shown that various heuristic algorithms for top-down decision tree induction can be viewed as instantiations of boosting. Another goal is to construct more powerful boosting-based PAC algorithms for linear threshold functions. All of the algorithms discussed in this paper have an inverse quadratic dependence on the separation parameter ffi ~ linear-programming based algorithms for learning linear threshold functions (see, e.g., [6, 7, 9, 29, 30]) do not have such a dependence. Is there a natural boosting-based PAC algorithm for linear threshold functions with performance bounds similar to those of the linear-programming based algorithms? ACKNOWLEDGEMENTS We warmly thank Les Valiant for helpful comments and suggestions --R Machine Learning 2 The Probabilistic Method "Proc. 36th Symp. on Found. of Comp. Sci." "Advances in Kernel Methods - Support Vector Learning," The perceptron algorithm is fast for nonma- licious distributions "Proc. 37th Symp. on Found. of Comp. Sci." Learnability and the Vapnik-Chervonenkis Dimension "Proc. 38th Symp. on Found. of Comp. Sci." Boosting a weak learning algorithm by ma- jority "Fifth Ann. Work. on Comp. Learning Theory" "Proc. Ninth Ann. Conf. on Comp. Learning Theory" A decision-theoretic generalization of on-line learning and an application to boosting "Proc. Eleventh Ann. Conf. on Comp. Learning Theory" "Proc. 12th Ann. Conf. on Comp. Learning Theory" "Proc. 10th Ann. Conf. on Comp. Learning Theory" Majority gates vs. general weighted threshold gates Space efficient learning algorithms Probability inequalities for sums of bounded random variables "Advances in Neural Information Processing Systems 8," Combinations of weak classifiers "Proc. Fourth Int. Workshop on Machine Learning" "Proc. 28th Symp. on Theor. of Comp.," 21st ACM Symp. on Theor. of Comp.," "Proc. Eighth Ann. Conf. on Comp. Learning Theory" Learning quickly when irrelevant attributes abound: A new linear-threshold algorithm Mistake bounds and logarithmic linear-threshold learning algorithms "Proc. Fourth Ann. Conf. on Comp. Learning Theory" Halfspace learning "Comput. Learning Theory and Natural Learning Systems: Volume I: Constraints and Prospects," The strength of weak learnability "Proc. Twelfth Ann. Conf. on Comp. Learning Theory" "Proc. Twelfth Ann. Conf. on Comp. Learning Theory" Boosting the margin: a new explanation for the effectiveness of voting methods "Proc. Eleventh Ann. Conf. on Comp. Learning Theory" criteria and lower bounds for Perceptron-like learning rules Advanced Calculus --TR
linear threshold functions;probably approximately correct learning;boosting
599676
On the Learnability and Design of Output Codes for Multiclass Problems.
Output coding is a general framework for solving multiclass categorization problems. Previous research on output codes has focused on building multiclass machines given predefined output codes. In this paper we discuss for the first time the problem of designing output codes for multiclass problems. For the design problem of discrete codes, which have been used extensively in previous works, we present mostly negative results. We then introduce the notion of continuous codes and cast the design problem of continuous codes as a constrained optimization problem. We describe three optimization problems corresponding to three different norms of the code matrix. Interestingly, for the l2 norm our formalism results in a quadratic program whose dual does not depend on the length of the code. A special case of our formalism provides a multiclass scheme for building support vector machines which can be solved efficiently. We give a time and space efficient algorithm for solving the quadratic program. We describe preliminary experiments with synthetic data show that our algorithm is often two orders of magnitude faster than standard quadratic programming packages. We conclude with the generalization properties of the algorithm.
Introduction Many applied machine learning problems require assigning labels to instances where the labels are drawn from a finite set of labels. This problem is often referred to as multiclass categorization or classification. Examples for machine learning applications that include a multiclass categorization component include optical character recognition, text classifica- tion, phoneme classification for speech synthesis, medical analysis, and more. Some of the well known binary classification learning algorithms can be extended to handle multiclass problem (see for instance [5, 19, 20]). A general approach is to reduce a multiclass problem to a multiple binary classification problem. Dietterich and Bakiri [9] described a general approach based on error-correcting codes which they termed error-correcting output coding (ECOC), or in short output cod- ing. Output coding for multiclass problems is composed of two stages. In the training stage we need to construct multiple (supposedly) independent binary classifiers each of which is based on a different partition of the set of the labels into two disjoint sets. In the second stage, the classification part, the predictions of the binary classifiers are combined to extend a prediction on the original label of a test instance. Experimental work has shown that output coding can often greatly improve over standard reductions to binary problems [9, 10, 16, 1, 21, 8, 4, 2]. The performance of output coding was also analyzed in statistics and learning theoretic contexts [12, 15, 22, 2]. Most of the previous work on output coding has concentrated on the problem of solving multiclass problems using predefined output codes, independently of the specific application and the class of hypotheses used to construct the binary classifiers. Therefore, by predefining the output code we ignore the complexity of the induced binary problems. The output codes used in experiments were typically confined to a specific family of codes. Several family of codes have been suggested and tested so far, such as, comparing each class against the rest, comparing all pairs of classes [12, 2], random codes [9, 21, 2], exhaustive codes [9, 2], and linear error correcting codes [9]. A few heuristics attempting to modify the code so as to improve the multiclass prediction accuracy were suggested (e.g., [1]). However, they did not yield significant improvements and, furthermore, they lack any formal justification. In this paper we concentrate on the problem of designing a good code for a given multiclass problem. In Sec. 3 we study the problem of finding the first column of a discrete code matrix. Given a binary classifier, we show that finding a good first column can be done in polynomial time. In con- trast, when we restrict the hypotheses class from which we choose the binary classifiers, the problem of finding a good first column becomes difficult. This result underscores the difficulty of the code design problem. Furthermore, in Sec. 4 we discuss the general design problem and show that given a set of binary classifiers the problem of finding a good code matrix is NP-complete. Motivated by the intractability results we introduce in Sec. 5 the notion of continuous codes and cast the design problem of continuous codes as a constrained optimization problem. As in discrete codes, each column of the code matrix divides the set of labels into two subsets which are labeled positive (+) and negative ( ). The sign of each entry in the code matrix determines the subset association (+ or ) and the magnitude corresponds to the confidence in this association. Given this formalism, we seek an output code with small empirical loss whose matrix norm is small. We describe three optimization problems corresponding to three different norms of the code matrix: l 1 ; l 2 and l 1 . For l 1 and l 1 we show that the code design problem can be solved by linear programming (LP). Interestingly, for the l 2 norm our formalism results in a quadratic program (QP) whose dual does not depend on the length of the code. Similar to support vector machines, the dual program can be expressed in terms of inner-products between input instances, hence we can employ kernel-based binary classifiers. Our framework yields, as a special case, a direct and efficient method for constructing multiclass support vector machine. The number of variables in the dual quadratic problem is the product of the number of samples by the number of classes. This value becomes very large even for small datasets. For instance, an English letter recognition problem with 1;000 training examples would require 26;000 variables. In this case, the standard matrix representation of dual quadratic problem would require more than 5 Giga bytes of mem- ory. We therefore describe in Sec. 6.1 a memory efficient algorithm for solving the quadratic program for code design. Our algorithm is reminiscent of Platt's sequential minimal optimization (SMO) [17]. However, unlike SMO, our algorithm optimize on each round a reduced subset of the variables that corresponds to a single example. Informally, our algorithm reduces the optimization problem to a sequence of small problems, where the size of each reduced problem is equal to the number of classes of the original multiclass problem. Each reduced problem can again be solved using a standard QP technique. However, standard approaches would still require large amount of memory when the number of classes is large and a straightforward solution is also time consuming. We therefore further develop the algorithm and provide an analytic solution for the reduced problems and an efficient algorithm for calculating the solution. The run time of the algorithm is polynomial and the memory requirements are linear in the number of classes. We conclude with simulations results showing that our algorithm is at least two orders of magnitude faster than a standard QP technique, even for small number of classes. be a set of m training examples where each instance x i belongs to a domain X . We assume without loss of generality that each label y i is an integer from the set kg. A multiclass classifier is a function that maps an instance x into an element y of Y . In this work we focus on a frame-work that uses output codes to build multiclass classifiers from binary classifiers. A discrete output code M is a matrix of size k l over f1;+1g where each row of M correspond to a class y 2 Y . Each column of M defines a partition of Y into two disjoint sets. Binary learning algorithms are used to construct classifiers, one for each column t of M . That is, the set of examples induced by column t of M is This set is fed as training data to a learning algorithm that finds a hypothesis h f1;+1g. This reduction yields l different binary classifiers l . We denote the vector of predictions of these classifiers on an instance x as denote the rth row of M by M r . Given an example x we predict the label y for which the row M y is the "closest" to h(x). We will use a general notion for closeness and define it through an inner-product function l R R. The higher the value of K( h(x); is the more confident we are that r is the correct label of x according to the classifiers h. An example for a closeness function is K(u; v. It is easy to verify that this choice of K is equivalent to picking the row of M which attains the minimal Hamming distance to h(x). Given a classifier H(x) and an example (x; y), we say that H(x) misclassified the example if H(x) 6= y. Let 1 if the predicate holds and 0 otherwise. Our goal is therefore to find a classifier H(x) such that 1 small. We would like to note in passing that in this paper we mainly focus on the empirical loss minimization problem. As in more standard classification problems, the loss on a separate test set (generalization error) can also be theoretically bounded given appropriate assumptions using uniform-convergence theory [3, 13, 23]. We leave this for future research. When l is small there might be more then one row of which attains the maximal value according to the function K. To accommodate such cases we will relax our definition and define a classifier H(X) based on a code M to be the mapping fy j K( h(x); r )g. In this case we will pick one of the labels in H(x) uniformly at random, and use the expected error of H(x), =m (1) In the context of output codes, a multiclass mapping H(x) is thus determined by two parameters: the coding matrix M and the set of binary classifiers h(x). Assume that the binary classifiers are chosen from some hypothesis class H. The following natural learning problems arise: (a) Given a matrix M , find a set h which suffers small empirical loss. (b) Given a set of binary classifiers h, find a matrix M which has small empirical loss. (c) Find both a matrix M and a set h which have small empirical loss. Previous work has focused mostly on the first problem. In this paper we mainly concentrate on the code design problem (problem b), that is, finding a good matrix M . A summary of the notation is given in Appendix A. 3 Finding the first column of an output code Assume we are given a single binary classifier h 1 (x) and we want to find the first (or the single) column of the matrix M which minimizes the empirical loss S (M; h). For brevity, let us denote by the first column of M . We now describe an efficient algorithm that finds The algorithm's running time is polynomial in the size of the label set and the sample size m. First, note that in this case Second, note that the sample can be divided into 2k equivalence classes according to their labels and the classification of h 1 (x). For a b to be the fraction of the examples with label r and classification b (according to denote by a r=1 a b r , and let bgj be the number of elements in u which are equal to b. (For brevity, we will often use + and to denote the value of b.) Let We can assume without loss of generality that not all the elements in u are the same (otherwise, S (M; k , which is equivalent to random guessing). Hence, the size of H(x) is : Using Eqs. (2) and (4), we rewrite Eq. (3), =m =m r a r Using Eq. (5) we now can expand S (M; h), ur a r ur a r ur a r a r a r a r ur a r a r a a For a particular choice of w maximized (and S is minimized) by setting u at the which attain the highest values for r a r and set the rest w of the indices to 1. This can be done efficiently in k log k time using sorting. Therefore, the best choice of u is found by enumerating all the possible values choosing the value of w which achieves the maximal value for Eq. (6). Since it takes m operations to calculate a r and a r , the total number of operations needed to find the optimal choice for the first column is O(m log k). We have proven the following theorem. Theorem 1 Let be a set of training examples, where each label is an integer from the set kg. Let H be a binary hypothesis class. Given an hypothesis h 1 (x) 2 H, the first column of an output code which minimizes the empirical loss defined by Eq. (1) can be found in polynomial time. To conclude this section we use a reduction from SAT to demonstrate that if the learning algorithm (and its corresponding class of hypotheses from which h 1 can chosen from) is of a very restricted form then the resulting learning problem can be hard. Let formula over the variables x i 2 f1;+1g where we interpret to be the instance space. Let 1)g be a sample of size the labels are taken from 1g. Define the learning algorithm L as follows. The algorithm's input is a binary labeled sample of the form f(x . If then the algorithm returns an hypothesis which is consistent with the sample (the sample itself). Otherwise, the algorithm returns the constant hypothesis, h(x) 1 or h(x) 0, which agrees with the majority of the sample by choosing Note that the learning algorithm is non-trivial in the sense that the hypothesis it returns has an empirical loss of less than 1=2 on the binary labeled sample. We now show that a multiclass learning algorithm that minimizes the empirical loss S over both the first column u and the hypothesis h 1 (x) which was returned by the algorithm L , can be used to check whether the formula is sat- isfiable. We need to consider two cases. When True and for all i y i y using the definition from Eq. (3) we get =m . If the above conditions do not hold (h(x) is constant), let be the number of examples which the hypothesis classifies correctly. Then, using Eq. (3) again we obtain . Thus, the minimum of S is achieved if and only if the formula is satisfiable. There- fore, a learning algorithm for h 1 (x) and can also be used as an oracle for the satisfiability of . While the setting discussed in this section is somewhat superficial, these results underscore the difficulty of the prob- lem. We next show that the problem of finding a good output code given a relatively large set of classifiers h(x) is in- tractable. We would like to note in passing that efficient algorithm for finding a single column might be useful in other settings. For instance in building trees or directed acyclic graphs for multiclass problems (cf. [18]). We leave this for future research. 4 Finding a general discrete output code In this section we prove that given a set of l binary classifiers h(x), finding a code matrix which minimizes the empirical loss S (M; is NP-complete. Given a sample and a set of classifiers h, let us denote by ~ the evaluation of h() on the sample S, where h i is the predictions vector for the ith sample. We now show that even when the problem is NP-complete. (Clearly, the problem remains NPC for k > 2). Following the notation of previous sections, the output code matrix is composed of two rows 2 and the predicted class for instance x i is g. For the simplicity of the presentation of the proof, we assume that both the code M and the hypotheses' values h i are over the set f0; 1g (instead of f1;+1g). This assumption does not change the problem since there is a linear transform between the two sets. Theorem 2 The following decision problem is NP-complete. Input: A natural number q, a labeled sample ~ Question: Does there exist a matrix M 2 f0; 1g 2l such that the classifier H(x) based on an output code M makes at most q mistakes on ~ S. Proof: Our proof is based on a reduction technique introduced by H-offgen and Simon [14]. Since we can check in polynomial time whether the number of classification errors for a given a code matrix M exceeds the bound q, the problem is clearly in NP. We show a reduction to Vertex Cover in order to prove that the problem is NP-hard. Given an undirected graph (V; E), we will code the structure of the graph as follows. The sample ~ S will be composed of two subsets, ~ of size 2jEj and jV j respectively. We set Each edge encoded by two examples ( h; y) in ~ We set for the first vector to h elsewhere. We set the second vector to h elsewhere. We set the label y of each example in ~ to 1. Each example encodes a node v i 2 set the label y of each example in ~ S V to 2 (second class). We now show that there exists a vertex cover U V with at most q nodes if and only if there exists a coding matrix that induces at most q classification errors on the sample ~ S. be a vertex cover such that jU j q. We show that there exists a code which has at most q mistakes on ~ S. Let u 2 f0; 1g jV j be the characteristic function of U , that is, u Define the output code matrix to be denotes the component-wise logical not operator. Since U is a cover, for each h 2 ~ Therefore, for all the examples in ~ predicted label equals the true label and we suffer 0 errors on these exam- ples. For each example h 2 ~ that corresponds to a node Therefore, these examples are misclassified (Recall that the label of each example in ~ S V is 2). Analogously, for each example in ~ which corresponds to v 62 U we get and these examples are correctly classified. We thus have shown that the total number of mistakes according to M is be a code which achieves at most q mistakes on ~ S. We construct a subset U V as follows. We scan ~ S and add to U all vertices v i corresponding to misclassified examples from ~ . Similarly, for each misclassified example from ~ corresponding to an edge fv either v i or v j at random and add it to U . Since we have at most q misclassified examples in ~ S the size of U is at most q. We claim that the set U is a vertex cover of the graph G. Assume by contradiction that there is an edge fv for which neither v i nor v j belong to the set U . Therefore, by construction, the examples corresponding to the vertices v i and v j are classified correctly and we get, Summing the above equations yields that, In addition, the two examples corresponding to the edge are classified correctly, implying that which again by summing the above equations yields, Comparing Eqs. (7) and (8) we get a contradiction. 5 Continuous codes The intractability results of previous sections motivate a relaxation of output codes. In this section we describe a natural relaxation where both the classifiers' output and the code matrix are over the reals. As before, the classifier H(x) is constructed from a code matrix M and a set of binary classifiers h(x). The matrix M is of size k l over R where each row of M corresponds to a class y 2 Y . Analogously, each binary classifier h t (x) 2 H is a mapping h t of M defines a partition of Y into two disjoint sets. The sign of each element of the tth column is interpreted as the set (+1 or -1) to which the class r belongs and the magnitude jM r;t j is interpreted as the confidence in the associated partition. Sim- ilarly, we interpret the sign of h t (x) as the prediction of the set (+1 or -1) to which the label of the instance x belongs and the magnitude jh t (x)j as the confidence of this prediction. Given an instance x, the classifier H(x) predicts the label y which maximizes the confidence function K( )g. Since the code is over the reals, we can assume here without loss of generality that exactly one class attains the maximum value according to the function K. We will concentrate on the problem of finding a good continuous code given a set of binary classifiers h. The approach we will take is to cast the code design problem as constrained optimization problem. Borrowing the idea of soft margin [7] we replace the discrete 0-1 multiclass loss with the linear bound r This formulation is also motivated by the generalization analysis of Schapire et al. [2]. The analysis they give is based on the margin of examples where the margin is closely related to the definition of the loss as given by Eq. (9). Put another way, the correct label should have a confidence value which is larger by at least one than any of the confidences for the rest of the labels. Otherwise, we suffer loss which is linearly proportional to the difference between the confidence of the correct label and the maximum among the confidences of the other labels. The bound on the empirical loss is We say that a sample S is classified correctly using a set of binary classifier h if there exists a matrix M such that the above loss is equal to zero, Denote by Thus, a matrix M that satisfies Eq. (10) would also satisfy the following constraints, We view a code M as a collection of vectors and define the norm of M to be the norm of the concatenation of the vectors constituting M . Motivated by [24, 2] we seek a matrix M with a small norm which satisfies Eq. (12). Thus, when the entire sample S can be labeled correctly, the problem of finding a good matrix M can be stated as the following optimization problem, subject to : 8i; r K( h(x i ); Here p is an integer. Note that m of the constraints for are automatically satisfied. This is changed in the following derivation for the non-separable case. In the general case a matrix M which classifies all the examples correctly might not exist. We therefore introduce slack variables i 0 and modify Eq. (10) to be, r The corresponding optimization problem is, subject to : for some constant 0. This is an optimization problem with "soft" constraints. Analogously, we can define an optimization problem with "hard" constraints, subject to : The relation between the "hard" and "soft" constraints and their formal properties is beyond the scope of this paper. For further discussion on the relation between the problems see [24]. 5.1 Design of continuous codes using Linear Programming We now further develop Eq. (14) for the cases We deal first with the cases which result in linear programs. For the simplicity of presentation we will assume that K(u; For the case objective function of Eq. (14) become i;r jM i;r j+ We introduce a set of auxiliary variables to get a standard linear programming setting, subject to To obtain its dual program (see also App. B) we define one variable for each constraint of the primal problem. We use i;r for the first set of constraints, and t;r for the second set. The dual program is, i;r subject to : 8i; r t;r The case of similar. The objective function of Eq. We introduce a single new variable to obtain the primal problem, subject to Following the technique for we get that the dual program is, i;r subject to : 8i; r t;r t;r Both programs can be now solved using standard linear program packages. 5.2 Design of continuous codes using Quadric Programming We now discuss in detail Eq. (14) for the case 2. For convenience we use the square of the norm of the matrix (instead the norm itself). Therefore, the primal program becomes subject to We solve the optimization problem by finding a saddle point of the Lagrangian : r i;r i;r subject to :8i; r i;r 0 (16) The saddle point we are seeking is a minimum for the primal variables (M; ), and the maximum for the dual ones (). To find the minimum over the primal variables we require, @ r r Similarly, for M r we require, @ @ i;r0 | {z } Eq. (19) implies that when the optimum of the objective function is achieved, each row of the matrix M is a linear combination of h(x i ). We say that an example i is a support pattern for class r if the coefficient (- y i ;r i;r ) of h(x i ) in Eq. (19) is not zero. There are two settings for which an example i can be a support pattern for class r. The first case is when the label y i of an example is equal to r, then the ith example is a support pattern if i;r < 1. The second case is when the label y i of the example is different from r, then the ith pattern is a support pattern if i;r > 0. Loosely speaking, since for all i and r we have i;r 0 and r the variable i;r can be viewed as a distribution over the labels for each example. An example i affects the solution for M (Eq. (19)) if and only if i in not a point distribution concentrating on the correct label y i . Thus, only the questionable patterns contribute to the learning process. We develop the Lagrangian using only the dual variables. Substituting Eqs. (17) and (19) into Eq. (16) and using various algebraic manipulations, we obtain that the target function of the dual program is, r i;r (Details are omitted due to the lack of space.) Let 1 i be the vector with all components zero, except for the ith component which is equal to one, and let 1 be the vector whose components are all one. Using this notation we can rewrite the dual program in vector form as subject to : 8r where It is easy to verify that Q() is strictly convex in . Since the constraints are linear the above problem has a single optimal solution and therefore QP methods can be used to solve it. In Sec. 6 we describe a memory efficient algorithm for solving this special QP problem. To simplify the equations we denote by the difference between the correct point distribution and the distribution obtained by the optimization problem, Eq. (19) becomes, Since we look for the value of the variables which maximize the objective function Q (and not the optimum of Q itself), we can omit constants and write the dual problem given by Eq. (20) as, subject to : 8r i 1 y i and i where Finally, the classifier H(x) can be written in terms of the variable as, r h(x) h(x) #) r i;r r i;r h(x) As in Support Vector Machines, the dual program and the classification algorithm depend only on inner products of the form h(x i ) h(x). Therefore, we can perform the calculations in some high dimensional inner-product space Z using a transformation l ! Z . We thus replace the inner-product in Eq. (22) and in Eq. (23) with a general inner-product kernel K that satisfies Mercer conditions [24]. The general dual program is therefore, subject to : 8i and and the classification rule H(x) becomes, i;r K The general framework for designing output codes using the QP program described above, also provides, as a special case, a new algorithm for building multiclass Support Vectors Machines. Assume that the instance space is the vector space R n and define h(x) x (thus l = n), then the primal program in Eq. (15) becomes min subject to Note that for reduces to the primal program of SVM, if we take We would also like to note that this special case is reminiscent of the multiclass approach for SVM's suggested by Weston and Watkins [25]. Their approach compared the confidence y ) to the confidences of all other labels K(x; and had m(k 1) slack variables in the primal problem. In contrast, in our framework the confidence K(x; y ) is compared to max r 6=y K(x; r ) and has only m slack variables in the primal program. In Table 1 we summarize the properties of the programs discussed above. As shown in the table, the advantage of using l 2 in the objective function is that the number of variables in the dual problem in only a function of on k and m and does not depend on the number columns l in M . The number of columns in M only affects the evaluation of the inner-product kernel K. The formalism given by Eq. (14) can also be used to construct the code matrix incrementally (column by column). We now outline the incremental (inductive) approach. How- ever, we would like to note that this method only applies when K(v; u. In the first step of the incremental al- gorithm, we are given a single binary classifier h 1 (x) and we need to construct the first column of M . We rewrite Eq. (14) in a scalar form and obtain, subject to : 8i; r h 1 Here, 0 is a given constant and b fore. For the rest of the columns we assume inductively that have been provided and the first l columns of the matrix M have been found. In addition, we are provided with a new binary classifier h l+1 (x) for the next column. We need to find a new column of M (indexed l 1). We substitute the new classifier and the matrix in Eq. (13) and get, r The constraints appearing in Eq. (14) now become r r We now redefine b i;r to be [ h(x i ) . It is straightforward to verify that this definition of b i;r results in an equation of the same form of Eq. (27). We can thus apply the same algorithms designed for the "batch" case. In the case of l 1 and l 1 , this construction decomposes a single problem into l sub-problems with fewer variables and constraints. However, for l 2 the size of the program remains the same while we lose the ability to use kernels. We therefore concentrate on the batch case for which we need to find the entire matrix at once. 6 An efficient algorithm for the QP problem The quadratic program presented in Eq. (24) can be solved using standard QP techniques. As shown in Table 1 the dual program depends on mk variables and has km all together. Converting the dual program in Eq. (24) to a standard QP form requires storing and manipulating a matrix with (mk) 2 elements. Clearly, this would prohibit applications of non-trivial size. We now introduce a memory efficient algorithm for solving the quadratic optimization problem given by Eq. (24). Primal Variables m+ 2kl m+ kl m+ kl 0-Constraints Constraints Dual Variables km 0-Constraints Constraints Table 1: Summary of the sizes of the optimization problems for different norms. (See Appendix B for the definitions of the constraints in linear programming.) First, note that the constraints in Eq. (24) can be divided . The algorithm we describe works in rounds. On each round it picks a single set f i 1 y modifies so as to optimize the reduced optimization problem. The algorithm is reminiscent of Platt's SMO algorithm [17]. Note, however, that our algorithm optimizes one example on each round, and not two as in SMO. Let us fix an example index p and write the objective function only in terms of the variables p . For brevity, let . We isolate p in Q. where, For brevity, we will omit the index p and drop constants (that do not affect the solution). The reduced optimization has k variables and k subject to : 1 y and Although this program can be solved using a standard QP technique, it still requires large amount of memory when k is large, and a straightforward solution is also time con- suming. Furthermore, this problem constitutes the core and inner-loop of the algorithm. We therefore further develop the algorithm and describe a more efficient method for solving Eq. (32). We write Q( ) in Eq. (32) using a completion to quadratic form, A A Since A > 0 the program from Eq. (32) becomes, min subject to : D and where, A A In Sec. 6.1 we discuss an analytic solution to Eq. (33) and in Sec. 6.2 we describe a time efficient algorithm for computing the analytic solution. 6.1 An analytic solution While the algorithmic solution we describe in this section is simple to implement and efficient, its derivation is quite complex. Before describing the analytic solution to Eq. (33), we would like to give some intuition on our method. Let us fix some vector D and denote 1. First note that D is not a feasible point since the constraint D 1 1 is not satisfied. Hence for any feasible point some of the constraints D are not tight. Second, note that the differences between the bounds D r and the variables r sum to one. Let us induce a uniform distribution over the components of . Then, the variance of is Since the expectation is constrained to a given value, the optimal solution is the vector achieving the smallest vari- ance. That is, the components of of should attain similar values, as much as possible, under the inequality constraints D. In Fig. 1 we illustrate this motivation. We picked show plots for two different feasible values for . The x-axis is the index r of the point and the y-axis designates the values of the components of . The norm of on the plot on the right hand side plot is smaller than the norm of the plot on the left hand side. The right hand side plot is the optimal solution for . The sum of the lengths of the arrows in both plots is Since both sets of points are feasible, they satisfy the constraint D 1 1. Thus, the sum of the lengths of the "arrows" in both plots is one. We exploit this observation in the algorithm we describe in the sequel. We therefore seek a feasible vector whose most of its components are equal to some threshold . Given we define a vector whose its rth component equal to the minimum between and D r , hence the inequality constraints are satisfied. We define D r Figure 1: An illustration of two feasible points for the reduced optimization problem with The x-axis is the index of the point, and the y-axis denotes the values . The bottom plot has a smaller variance hence it achieves a better value for Q. We denote by Using F , the equality constraint from Eq. (33) becomes Let us assume without loss of generality that the components of the vector are given in a descending order, D 1 (this can be done in k log k time). Let D 1 and D To prove the main theorem of this section we need the following lemma. Lemma 3 F () is piecewise linear with a slope r in each range (D r+1 ; D r ) for Proof: Let us develop F (). D r F Figure 2: An illustration of the solution of the QP problem using the inverse of F () for 0:6). The optimal value is the solution for the equation F which is 0:5. Note that if > D r then > D u for all u r. Also, the equality holds for each in the range . Thus, for D r+1 < < D r the function F () has the form, This completes the proof. Corollary 4 There exists a unique 0 D 1 such that Proof: From Eq. (35) we conclude that F () is strictly increasing and continuous in the range D 1 . Therefore, F () has an inverse in that range, using the theorem that every strictly increasing and continuous function has an in- verse. Since F 1. Hence, the range of F for the interval (1;D 1 is the interval (1; D 1] which clearly contains Thus 0 needed. Uniqueness of 0 follows the fact that the function F is a one-to-one mapping onto (1; We now can prove the main theorem of this section. Theorem 5 Let 0 be the unique solution of F Then 0 is the optimum value of the optimization problem stated in Eq. (33). The theorem tells us that the optimum value of Eq. (33) is of the form defined by Eq. (34) and that there is exactly one value of for which the equality constraint F holds. A plot of F () and the solution for from Fig. 1 are shown in Fig. 2. Proof: Corollary 4 implies that a solution exists and is unique. Note also that from definition of 0 we have that the vector 0 is a feasible point of Eq. (33). We now prove that 0 is the optimum of Eq. (33) by showing that 6= . Assume, by contradiction, that there is a vector such that kk 2 k 0 k 2 . Let 6= 0, and define I g. Since both and 0 satisfy the equality constraint of Eq. (33), we have, Since is a feasible point we have D. Also, by the definition of the set I we have that I . Combining the two properties we get, r 0 for all r 2 I (37) We start with the simpler case of I . In this case, differs from 0 only on a subset of the coordinates I . However, for these coordinates the components of 0 are equal to 0 , thus we obtain a zero variance from the constant vector whose components are all 0 . Therefore, no other feasible vector can achieve a better variance. For- mally, since I , then the terms for r 2 I cancel each other, r=2I r=2I From the definition of 0 in Eq. (34) we get that 0 for all I , r=2I r=2I r=2I r=2I We use now the assumption that I and the equality to obtain, and we get a contradiction since 6= We now turn to prove the complementary case in which r2I r < 0, then there exists u 2 I such that u < 0. We use again Eq. (36) and conclude that there exists also 2 I such that v > 0. Let us assume without loss of generality that u analogously by switching the roles of u and v). Define 0 as follows, r otherwise The vector 0 satisfies the constraints of Eq. (33) since 0 and 0 are equal except for their u and v components we get, D. Initialize D. Sort the components of D, such that D i 1 D While Compute r . Eq. (40) For Return . Figure 3: The algorithm for finding the optimal solution of the reduced quadratic program (Eq. (33)). Substituting the values for 0 u and 0 v from the definition of 0 we obtain, Using the definition of and 0 for u and for The first term of the bottom equation is negative since u < 0 and v > 0. Also u 2 I , hence 0 > D u and the second term is also negative. We thus get, which is a contradiction. 6.2 An efficient algorithm for computing the analytic solution The optimization problem of Eq. (33) can be solved using standard QP methods, and interior point methods in particular [11]. For these methods the computation time is In this section we give an algorithm for solving that optimization problem in O(k log time, by solving the equation As before, we assume that the components of the vector are given in a descending order, D 1 D we denote D 1. The algorithm searches for the interval [D r+1 ; D r ) which contains 0 . We now use simple algebraic manipulations to derive the search scheme for 0 . For convenience, we define the potential function and obtain, Choose f i g - a feasible point for Eq. (24). Iterate. Choose an example p Eqs. (29) and (30) Compute Fig. 3 Ap Eq. (33) Output the final hypothesis: Eq. (25) Figure 4: A skeleton of the algorithm for finding a classifier based on an output code by solving the quadratic program defined in Eq. (24). Also note that, (D r )]g (D r+1 )]g Recall that the function F () is linear in each interval (D r ) F (D r+1 To solve the equation F D 1 1, we first find r such that (r) > 0 and (r which implies that Using Eq. (38) and the equation F (D 1 (D r Using the linearity of F () we obtain, (D r therefore r The complete algorithm is described in Fig. 3. Since it takes O(k log time to sort the vector D and another O(k) time for the loop search, the total run time is O(k log k). We are finally ready to give the algorithm for solving learning problem described by Eq. (24). Since the output code is constructed of the supporting patterns we term our algorithm SPOC for Support Pattern Output Coding. The SPOC algorithm is described in Fig. 4. We have also developed methods for choosing an example p to modify on each round and a stopping criterion for the entire optimization al- gorithm. Due to lack of space we omit the details which will appear in a full paper. We have performed preliminary experiments with synthetic data in order to check the actual performance of our algorithm. We tested the special case corresponding to multiclass SVM by setting x. The code matrices we test0 50 100 150 200 250 300 No. of training examples Log10(run time) QP Figure 5: Run time comparison of two algorithms for code design using quadratic programming: Matlab's standard QP package and the proposed algorithm (denoted SPOC). Note that we used a logarithmic scale for the run-time (y) axis. are of columns. We varied the size of the training set size from The examples were generated using the uniform distribution 1]. The domain [ partitioned into four quarters of equal Each quarter was associated with a different label. For each sample size we tested, we ran the algorithm three times, each run used a different randomly generated training set. We compared the standard quadratic optimization routine available from Matlab with our algorithm which was also implemented in Mat- lab. The average running time results are shown in Fig. 5. Note that we used a log-scale for the y (run-time) axis. The results show that the efficient algorithm can be two orders of magnitude faster than the standard QP package. 7 Conclusions and future research In this paper we investigated the problem of designing output codes for solving multiclass problems. We first discussed discrete codes and showed that while the problem is intractable in general we can find the first column of a code matrix in polynomial time. The question whether the algorithm can be generalized to l 2 columns with running time of O(2 l ) or less remains open. Another closely related question is whether we can find efficiently the next column given previous columns. Also left open for future research is further usage of the algorithm for finding the first column as a subroutine in constructing codes based on trees or directed acyclic graphs [18], and as a tool for incremental (column by col- umn) construction of output codes. Motivated by the intractability results for discrete codes we introduced the notion of continuous output codes. We described three optimization problems for finding good continuous codes for a given a set of binary classifiers. We have discussed in detail an efficient algorithm for one of the three problems which is based on quadratic programming. As a special case, our framework also provides a new efficient algorithm for multiclass Support Vector Machines. The importance of this efficient algorithm might prove to be crucial in large classification problems with many classes such as Kanji character recognition. We also devised efficient implementation of the algorithm. The implementation details of the algorithm, its convergence, generalization properties, and more experimental results were omitted due to the lack of space and will be presented elsewhere. Finally, an important question which we have tackled barely in this paper is the problem of interleaving the code design problem with the learning of binary classifiers. A viable direction in this domain is combining our algorithm for continuous codes with the support vector machine algorithm. Acknowledgement We would like to thank Rob Schapire for numerous helpful discussions, to Vladimir Vapnik for his encouragement and support of this line of research, and to Nir Friedman and Ran Bachrach for useful comments and suggestions. --R Cloud classification using error-correcting output codes Reducing multi-class to binary: A unifying approach for margin classifiers The sample complexity of pattern classification with neural networks: the size of the weights is more important than the size of the network. Linear Programming. Solving multiclass learning problems via error-correcting output codes Machine learning bias Practical Methods of Optimization. Classification by pair-wise coupling Decision theoretic generalizations of the PAC model for neural net and other learning applications. Robust trainability of single neurons. The error coding method and PiCT. Fast training of Support Vector Machines using sequential minimal optimization. Large margin dags for multiclass classification. Learning internal representations by error propagation. Using output codes to boost multiclass learning problems. Improved boosting algorithms using confidence-rated predictions Estimation of Dependences Based on Empirical Data. Statistical Learning Theory. Support vector machines for multi-class pattern recognition --TR --CTR Eibe Frank , Stefan Kramer, Ensembles of nested dichotomies for multi-class problems, Proceedings of the twenty-first international conference on Machine learning, p.39, July 04-08, 2004, Banff, Alberta, Canada Olivier Lzoray , Hubert Cardot, Comparing Combination Rules of Pairwise Neural Networks Classifiers, Neural Processing Letters, v.27 n.1, p.43-56, February 2008 Pawalai Kraipeerapun , Chun Che Fung , Kok Wai Wong, Multiclass classification using neural networks and interval neutrosophic sets, Proceedings of the 5th WSEAS International Conference on Computational Intelligence, Man-Machine Systems and Cybernetics, p.123-128, November 20-22, 2006, Venice, Italy Rong Jin , Jian Zhang, Multi-Class Learning by Smoothed Boosting, Machine Learning, v.67 n.3, p.207-227, June 2007 Libin Shen , Aravind K. Joshi, Ranking and Reranking with Perceptron, Machine Learning, v.60 n.1-3, p.73-96, September 2005 Ryan Rifkin , Aldebaro Klautau, In Defense of One-Vs-All Classification, The Journal of Machine Learning Research, 5, p.101-141, 12/1/2004 Ana Carolina Lorena , Andr C. P. L. F. de Carvalho, Protein cellular localization prediction with Support Vector Machines and Decision Trees, Computers in Biology and Medicine, v.37 n.2, p.115-125, February, 2007 S. B. Kotsiantis , I. D. Zaharakis , P. E. Pintelas, Machine learning: a review of classification and combining techniques, Artificial Intelligence Review, v.26 n.3, p.159-190, November 2006
SVM;output coding;multiclass categorization
599682
Metric-Based Methods for Adaptive Model Selection and Regularization.
We present a general approach to model selection and regularization that exploits unlabeled data to adaptively control hypothesis complexity in supervised learning tasks. The idea is to impose a metric structure on hypotheses by determining the discrepancy between their predictions across the distribution of unlabeled data. We show how this metric can be used to detect untrustworthy training error estimates, and devise novel model selection strategies that exhibit theoretical guarantees against over-fitting (while still avoiding under-fitting). We then extend the approach to derive a general training criterion for supervised learningyielding an adaptive regularization method that uses unlabeled data to automatically set regularization parameters. This new criterion adjusts its regularization level to the specific set of training data received, and performs well on a variety of regression and conditional density estimation tasks. The only proviso for these methods is that sufficient unlabeled training data be available.
Introduction In supervised learning, one takes a sequence of training pairs hx and attempts to infer a hypothesis function prediction error err(h(x); y) on future test examples. This basic paradigm covers many of the tasks studied in machine learning research, including: re- gression, where Y is typically IR and we measure prediction error by squared dierence or some similar loss; classication, where Y is typically a small discrete set and we measure prediction error with the misclassication loss err(^y; where we assume, for example, that Y is a classication label from f0; 1g Y is a probabilistic prediction in [0; 1], and we measure prediction error using the log loss err(^y; (also known as the cross-entropy error [Bis95]). Regardless of the specics of these scenarios, one always faces the classical over-tting versus under-tting dilemma in supervised learning: If the hypothesis is chosen from a class that is too complex for the data, there is a good chance it will exhibit large test error even though its training error is small. This occurs because complex classes generally contain several hypotheses that behave similarly on the training data and yet behave quite dierently in other parts of the domain|thus diminishing the ability to distinguish good hypotheses from bad. (Note that signicantly different hypotheses cannot be simultaneously accurate.) Therefore, one must restrict the set of hypotheses to be able to reliably dierentiate between accurate and inaccurate predictors. On the other hand, selecting hypotheses from an overly restricted class can prevent one from being able to express a good approximation to the ideal predictor, thereby causing important structure in the training data to be ignored. Since both under-tting and over-tting result in large test error, they must be avoided simultaneously. This tradeo between over-tting and under-tting is a fundamental dilemma in machine learning and statistics. In this paper, we are primarily interested in investigating automated methods for calibrating hypothesis complexity to given training data. Most of the techniques that have been developed for this process fall into one of three basic categories: model se- lection, regularization, and model combination. In model selection one rst takes a base hypothesis class, H, decomposes it into a discrete collection of subclasses H 0 H 1 organized in a nested chain, or lattice) and then, given training data, attempts to identify the optimal subclass from which to choose the nal hypothesis. There have been a variety of methods proposed for choosing the optimal subclass, but most techniques fall into one of two basic categories: complexity penalization (e.g., the minimum description length principle [Ris86] and various statistical selection criteria [FG94]); and hold-out testing (e.g., cross-validation and bootstrapping [Efr79]). Regularization is similar to model selection except that one does not impose a discrete decomposition on the base hypothesis class. Instead a penalty criterion is imposed on the individual hypotheses, which either penalizes their parametric form (e.g., as in ridge regression or weight decay in neural net-work training [CM98, Rip96, Bis95]) or penalizes their global smoothness properties (e.g., minimizing curvature [PG90]). Model combination methods do not select a single hypothesis but rather take a weighted combination of base hypotheses to form a composite predic- tor. Composing base functions in this way can have the eect of smoothing out erratic hypotheses (e.g., as in Bayesian model averaging [Mac92] and bagging [Bre96]), or increasing the representation power of the base hypothesis class through linear combinations (e.g., as in boosting [FS97] and neural network ensemble methods [KV95]). All of these methods have shown impressive improvements over naive learning algorithms in every area of supervised learning research. However, one di-culty with these techniques is that they usually require expertise to apply properly, and often involve free parameters that must be set by an informed practitioner. In this paper we introduce alternative methods for model selection and regularization that attempt to improve on the robustness of standard ap- proaches. Our idea is to use unlabeled data to automatically penalize hypotheses that behave erratically o the labeled training set. In Section 3 we rst investigate how unlabeled data can be used to perform model selection in nested sequences of hypothesis spaces. The strategies we develop are shown to experimentally outperform standard model selection methods, and are proved to be robust in theory. Then in Section 4 we consider regularization and show how our proposed model selection strategies can be extended to a generalized training objective for supervised learning. Here the idea is to use unlabeled data to automatically tune the degree of regularization for a given task without having to set free parameters by hand. We show that the resulting regularization technique adapts its behavior to a given training set and can outperform standard xed regularizers for a given problem. Note, however, that we do not address model combination methods in this paper [KV95], instead leaving this to future work. The work reported here extends the earlier conference papers [Sch97, SS00]. Metric structure of supervised learning In this paper we will consider the metric structure on a space of hypothesis functions that arises from a simple statistical model of the supervised learning problem: Assume that the examples hx; yi are generated by a stationary joint distribution P XY on X Y . In learning a hypothesis function we are primarily interested in modeling the conditional distribution P YjX . However, here we will investigate the utility of using extra information about the marginal domain distribution P X to choose a good hypothesis. Note that information about P X can be obtained from a collection of unlabeled training examples x are often in abundant supply in many applications|for example, text processing and computer perception). The signicance of having information about the domain distribution P X is that it denes a natural (pseudo) metric on the space of hypotheses. That is, for any two hypothesis functions f and g we can obtain a measure of the distance between them by computing the expected disagreement in their predictions Z (1) where err(^y; y) is the natural measure of prediction error for the problem at hand (e.g., regression or classication) and ' is an associated normalization function that recovers the standard metric axioms. Specically, we will be interested in obtaining the metric properties: nonnegativity d(f; g) 0, symmetry and the triangle inequality d(f; g) d(f; d(h; g). It turns out that most typical prediction error functions admit a metric of this type. For example, in regression we measure the distance between two prediction functions by Z where the normalization function establishes the metric proper- ties. In classication, we measure the distance between two classiers by Z where no normalization is required to achieve a metric. (In conditional density estimation, one can measure the \distance" between two conditional probability models by their Kullback-Leibler divergence, which technically is not a metric but nevertheless supplies a useful measure [CT91].) In each of these cases, the resulting distances can be e-ciently calculated by making a single pass down a list of unlabeled examples. Importantly, these denitions can be generalized to include the target conditional distribution in an analogous manner: Z Z (2) That is, we can interpret the true error of a hypothesis function h with respect to a target conditional P YjX as a distance between h and P YjX . The signicance of this denition is that it is consistent with the previous denition (1) and we can therefore embed the entire supervised learning problem in a common metric space structure. To illustrate, in regression the denition (2) yields the root mean squared error of a hypothesis Z Z and in classication it gives the true misclassication probability Z Z (In conditional probability modeling it gives the expected log loss|or KL-divergence to P YjX |which again, yields a useful measure, although it is not a metric.) Together, denitions (1) and (2) show how we can impose a global metric space view of the supervised learning problem (Figure 1): Given labeled training examples hx the goal is to nd the hypothesis h in a space H that is closest to a target conditional P YjX under the distance measure (2). If we are also given a large set of auxiliary unlabeled exam- Figure 1 ples x 0 r , then we can also accurately estimate the distances between alternative hypotheses f and g within H; eectively giving us (1) r r That is, for su-ciently large r, the distances dened in (3) will be very close to the distances dened in (1). However, the distances between hypotheses and the target conditional P YjX (2) can only be weakly estimated using the (presumably much smaller) set of labeled training data d which need not be close to (2). The challenge then is to approximate the closest hypothesis to the target conditional as accurately as possible using the available information (3) and (4) in place of the true distances (1) and (2). Below we will use this metric space perspective to devise novel model selection and regularization strategies that exploit inter-hypothesis distances measured on an auxiliary set of unlabeled examples. Our approach is applicable to any supervised learning problem that admits a reasonable metric structure. In particular, all of our strategies will be expressed in terms of a generic distance measure which does not depend on other aspects of the problem. (However, for the sake of concreteness, we will focus on regression as a source of demonstration problems initially, and return to classication and conditional density estimation examples near the end of the paper.) 3 Model selection We rst consider the process of using model selection to choose the appropriate level of hypothesis complexity to t to data. This, conceptually, is the simplest approach to automatic complexity control for supervised learning: the idea is to stratify the hypothesis class H into a sequence (or lattice) of nested subclasses H 0 H 1 training data, somehow choose a class that has the proper complexity for the given data. To understand how one might make this choice, note that for a given training sample we can, in principle, obtain the corresponding sequence of empirically optimal functions h d The problem is to select one of these functions based on the observed training errors d however, that these errors are monotonically decreasing (assuming we can fully optimize in each class) and therefore choosing the function with smallest training error inevitably leads to over-tting. So the trick is to invoke some other criterion beyond Figure 2 mere empirical error minimization to make the nal selection. As mentioned, two basic model selection strategies currently predomi- nate: complexity penalization and hold-out testing. However, neither of these approaches attends to the metric distances between hypotheses, nor do they oer an obvious way to exploit auxiliary unlabeled data. But by adopting the metric space view of Section 2 we obtain an useful new perspective on model selection: In our setting, the chain H 0 H 1 H can be interpreted as a sequence of hypothesis spaces wherein we can measure the distance between candidate hypotheses (using unlabeled data). Unfortunately, we still cannot directly measure the distances from hypotheses to the target conditional P YjX (just as before) and therefore must estimate them based on a small labeled training sample. However, we can now exploit the fact that we have the distances between functions in the sequence, and hence attempt to use this additional information to make a better choice (Figure 2). 3.1 The rst intuition we explore is that inter-hypothesis distances can help us detect over-tting in a very simple manner: Consider two hypotheses h k and h k+1 that both have a small estimated distance to P YjX and yet have a large true distance between them. In this situation, it should be clear that we should be concerned about selecting the second hypothesis, because if the true distance between h k and h k+1 is indeed large then both functions cannot be simultaneously close to P YjX , by simple geometry. This implies that at least one of the distance estimates to P YjX must be inaccurate, and we know intuitively to trust the earlier estimate more than the latter (since h k+1 is chosen from a larger class). In fact, if both d really were accurate estimates they would have to satisfy the triangle inequality with the known distance d(h k ; h k+1 ); that is d Since these empirical distances eventually become signicant underestimates in general (because the h i are explicitly chosen to minimize the empirical distance on the labeled training set) the triangle inequality provides a useful test to detect when these estimates become inaccurate. In fact, this basic test forms the basis of a simple model selection strategy, TRI, that works surprisingly well in many situations (Figure 3). Figure 3 3.2 Example: Polynomial regression To demonstrate this method (and all subsequent methods we develop in this paper) we rst consider the problem of polynomial curve tting. This is a supervised learning problem where and the goal is to minimize the squared prediction error, err(^y; Specically, we consider polynomial hypotheses under the natural stratication into polynomials of degree 0; etc. The motivation for studying this task is that it is a classical well-studied problem, that still attracts a lot of interest [CMV97, GRV96, Vap96]. Moreover, polynomials create a di-cult model selection problem which has a strong tendency to produce catastrophic over-tting eects (Figure 4). Another benet is that polynomials are an interesting and nontrivial class for which there are e-cient techniques for computing best t hypotheses. Figure 4 To apply the metric based approach to this task, we dene the metric d in terms of the squared prediction error err(^y; with a square root normalization discussed in Section 2. To evaluate the e-cacy of TRI in this problem we compared its performance to a number of standard model selection strategies, including: structural risk minimization, SRM [CMV97, Vap96], RIC [FG94], SMS [Shi81], GCV [CW79], BIC [Sch78], AIC [Aka74], CP [Mal73], and FPE [Aka70]. We also compared it to 10-fold cross validation, CVT (a standard hold-out method [Efr79, WK91, Koh95]). We conducted a simple series of experiments by xing a domain distribution P X on xing various target functions f (The specic target functions we used in our experiments are shown in Figure 5.) To generate training samples we rst drew a sequence of values, computed the target function values f(x 1 ); :::; f(x t ), and added independent Gaussian noise to each, to obtain the labeled training sequence For a given training sample we then computed the series Figure 5 of best t polynomials h etc. Given this sequence, each model selection strategy will choose some hypothesis h k on the basis of the observed empirical errors. To implement TRI we gave it access to auxiliary unlabeled examples x 0 r in order to compute the true distances between polynomials in the sequence. Our main emphasis in these experiments was to minimize the true distance between the nal hypothesis and the target conditional P YjX . That is, we are primarily concerned with choosing a hypothesis that obtains a small prediction error on future test examples, independent of its complexity level. 1 To determine the eectiveness of the various selection strategies, we therefore measured the ratio of the true error (distance) of the polynomial they selected to the best true error among polynomials in the sequence h etc. (This means that the optimum achievable ratio is 1.) The rationale for doing this is that we wish to measure the model selection strategy's ability to approximate the best hypothesis in the given sequence|not nd a better function from outside the sequence. 2 Table 1 shows the results obtained for approximating a step function corrupted by Gaussian noise. (The strategy ADJ in the tables is explained in Section 3.3 below.) We obtained these results by repeatedly generating training samples of a xed size and recording the approximation ratio achieved by each strategy. These tables record the dis- Table 1 tribution of ratios produced by each strategy for training sample sizes of respectively, using unlabeled examples to measure inter-hypothesis distances|repeated over 1000 trials. The initial results appear to be quite positive. TRI achieves median approximation ratios of 1.06 Prediction error is not the only criteria one could imagine optimizing in model selec- tion. For example, one could be interested in nding a simple model of the underlying phenomenon that gives some insight into its fundamental nature, rather than simply producing a function that predicts well on future test examples [HC96]. However, we will focus on the traditional machine learning goal of minimizing prediction error. One could consider more elaborate strategies that choose hypotheses from outside the sequence; e.g., by averaging several hypotheses together [KV95, OS96, Bre96]. However, as mentioned, we will not pursue this idea in this paper. and 1.08 for training sample sizes 20 and 30 respectively. This compares favorably to the median approximation ratios 1.39 and 1.54 achieved by S- RM, and 1.17 achieved by CVT in both cases. (The remaining complexity penalization strategies, GCV, FPE, etc., all performed signicantly worse on these trials.) However, the most notable dierence was TRI's robustness against over-tting. In fact, although the penalization strategy SRM performed reasonably well much of the time, it was prone to making periodic but catastrophic over-tting errors. Even the normally well-behaved cross-validation strategy CVT made signicant over-tting errors from time to time. This is evidenced by the fact that in 1000 trials with a training sample of size (Table 1) TRI produced a maximum approximation ratio of 2.18, whereas CVT produced a worst case approximation ratio of 643, and the penalization strategies SRM and GCV both produced worst case ratios of percentiles were TRI 1.45, CVT 6.11, SRM 419, GCV In fact, TRI's robustness against over-tting is not a surprise: One can prove that TRI cannot produce an approximation ratio greater than 3 if we make two simple assumptions: (i) that TRI makes it to the best hypothesis hm in the sequence, and (ii) that the empirical error of hm is an underesti- mate; that is, d (Note that this second assumption is likely to hold because we are choosing hypotheses by explicitly minimizing d Proposition 1 Let hm be the optimal hypothesis in the sequence h (that is, be the hypothesis selected by TRI. If (i) m ' and (ii) d Proof Consider a hypothesis h n which follows hm in the sequence, and assume We show that h n must fail the triangle test (5) with hm and therefore TRI will not select h n . First, notice that the initial assumption about h n 's error along with the triangle inequality imply that 3d(h 3 Although one might suspect that the large failures could be due to measuring relative instead of absolute error, it turns out that all of these large relative errors also correspond to large absolute errors|which we verify in Section 4.1 below. now recall that d (since the training errors are monotonically decreasing), and also, by assumption, d Therefore we have d(h contradicts (5). Thus TRI will not consider h n . Finally, since h ' cannot precede hm (by assumption (i)), h ' must satisfy (Note that in Proposition 1, as well as Propositions 2 and 3 below, we implicitly assume that we have the true inter-hypothesis distances d(h which in principle must be measured on unlimited amounts of unlabeled data. We discuss relaxing this assumption in Section 3.4 below.) Continuing with the experimental investigation, we nd that the basic avor of the results remains unchanged at dierent noise levels and for different domain distributions P X . In fact, much stronger results are obtained for wider tailed domain distributions like Gaussian (Table 2) and \di-cult" target functions like sin(1=x) (Table 3). Here the complexity penalization Table 2 Table methods (SRM, GCV, etc.) can be forced into a regime of constant catas- trophe, CVT noticeably degrades, and yet TRI retains similar performance levels shown in Table 1. Of course, these results might be due to considering a pathological target function from the perspective of polynomial curve tting. It is therefore important to consider other more natural targets that might be better suited to polynomial approximation. In fact, by repeating the previous experiments with a more benign target function dierent results. Table 4 shows that procedure TRI does not fare as well in this case|obtaining median approximation ratios of 3.11 and 3.51 for training sample sizes 20 and respectively (compared to 1.33 and 1.03 for SRM, and 1.37 and 1.16 for CVT). A closer inspection of TRI's behavior reveals Table 4 that the reason for this performance drop is that TRI systematically gets stuck at low even-degree polynomials (cf. Table 6). In fact, there is a simple geometric explanation for this: the even-degree polynomials (after degree all give reasonable ts to sin 2 (2x) whereas the odd-degree ts have a tail in the wrong direction. This creates a signicant distance between successive polynomials and causes the triangle inequality test to fail between the even and odd degree ts, even though the larger even-degree polynomials give a good approximation. Therefore, although the metric-based TRI strategy is robust against over-tting, it can be prone to systematic under-tting in seemingly benign cases. Similar results were obtained for tting a fth degree target polynomial corrupted by the same level of Gaussian noise (Table 5). This problem demonstrates that the rst assumption used in Proposition 1 above can be violated in natural situations (see Table 6). Consideration of Table 5 Table this di-culty leads us to develop a reformulated procedure. 3.3 Strategy 2: Adjusted distance estimates The nal idea we explore for model selection is to observe that we are actually dealing with two metrics here: the true metric d dened by the joint distribution P XY and an empirical metric ^ d determined by the labeled training sequence Note that the previous model selection strategy TRI ignored the fact that we could measure the empirical distance between hypotheses d on the labeled training data, as well as measure their \true" distance d(h k ; h ' ) on the unlabeled data. However, the fact that we can measure both inter-hypothesis distances actually gives us an observable d and d in the local vicinity. We now exploit this observation to attempt to derive an improved model selection procedure. Given the two metrics d and ^ d, consider the triangle formed by two hypotheses h k and h ' and the target conditional P YjX (Figure 6). Notice that there are six distances involved|three real and three estimated, of which the true distances to P YjX are the only two we care about, and yet these are the only two that we do not have. However, we can now exploit the observed Figure 6 relationship between d and ^ d to adjust the empirical training error estimate d In fact, one could rst consider the simplest possible adjustment based on the naive assumption that the observed relationship of the metrics d and d between h k and h ' also holds between h ' and P YjX . Note that if this were actually the case, we would obtain a better estimate of d(h simply by re-scaling the training distance d according to the observed ratio (Since we expect ^ d to be an underestimate in general, we expect this ratio to be larger than 1.) In fact, by adopting this as a simple heuristic we obtain another model selection procedure, ADJ, which is also surprisingly eective (Figure 7). This simple procedure overcomes some of the under-tting problems associated with TRI and yet retains much of TRI's robustness against over-tting. Figure 7 Although at rst glance this procedure might seem to be ad hoc, it turns out that one can prove an over-tting bound for ADJ that is analogous to that established for TRI. In particular, if we assume that (i) ADJ makes it to the best hypothesis hm in the sequence, and (ii) the adjusted error estimate d d is an underestimate, then ADJ cannot over-t by a factor much greater than 3. Proposition 2 Let hm be the optimal hypothesis in the sequence h and let h ' be the hypothesis selected by ADJ. If (i) m ' and (ii) d d d d Proof By the denition of ADJ we have that d d since ADJ selects h ' in favor of hm . We show that this implies a bound on test error d(h in terms of the optimum available test error First, by the triangle inequality we have d(h well as d d d Note that by the denition of ADJ (and since m ') this yields d d d d d d So from (9) and (8) and the assumption that d d obtain d d d d d d Simple algebraic manipulation then shows that d d d d d d d d d d In this respect, not only does ADJ exhibit robustness against over-tting, it also has a (weak) theoretical guarantee against under-tting. That is, if we make the assumptions that: (i) the empirical distance estimates are underestimates, and (ii) the adjusted distance estimates strictly increase the empirical distance estimates; then if the true error of a successor hypothesis hm improves the true error of all of its predecessors h ' by a signicant factor, hm will be selected in lieu of its predecessors. Proposition 3 Consider a hypotheses hm , and assume that (i) d m. Then if d for all 0 ' < m (that is, d(h su-ciently small) it follows that d d d d therefore ADJ will not choose any predecessor in lieu of hm . Proof By the triangle inequality we have d and d d Recall that by the denition of b b d we have d d d d for some 0 ' < m (specically, the ' leading to the largest d d Therefore by applying (11) to this particular ' we obtain d d d d The second step above follows from the assumption (i) that d and the fact that d(h Now, by applying (10) to both occurrences of d(h d d d d d d d since assumption (i) d d assumption (ii) Therefore, although ADJ might not have originally appeared to be well motivated, it possesses worst case bounds against over-tting and under- tting that cannot be established for conventional methods. However, these bounds remain somewhat weak: Table 6 shows that both ADJ and TRI systematically under-t in our experiments. That is, even though assumption (ii) of Proposition 1 is almost always satised (as expected), assumption (ii) of Proposition 2 is only true one quarter of the time. Therefore, Propositions 1 and 2 can only provide a loose characterization of the quality of these methods. However, both metric-based procedures remain robust against over-tting. To demonstrate that ADJ is indeed eective, we repeated the previous experiments with ADJ as a new competitor. Our results show that ADJ robustly outperformed the standard complexity penalization and hold-out methods in all cases considered|spanning a wide variety of target functions, noise levels, and domain distributions P X . Tables 1{5 show the previous data along with the performance characteristics of ADJ. In particular, Tables 4, 5 and 6 show that ADJ avoids the extreme under-tting problems that hamper TRI; it appears to responsively select high order approximations when this is supported by the data. Moreover, Tables 1{3 show that ADJ is still extremely robust against over-tting, even in situations where the standard approaches make catastrophic errors. Overall, this is the best model selection strategy we have observed for these polynomial regression tasks, even though it possesses a weaker guarantee against over-tting than TRI. Note that both model selection procedures we propose add little computational overhead to traditional methods, since computing inter-hypothesis distances involves making only a single pass down the reference list of unlabeled examples. This is an advantage over standard hold-out techniques like CVT which repeatedly call the hypothesis generating mechanism to generate pseudo-hypotheses|an extremely expensive operation in many applications. Finally, we note that ADJ possesses a subtle limitation: the multiplicative re-scaling it employs cannot penalize hypotheses that have zero training error. (Therefore, we had to limit the degree of the polynomials to t 2 in the above experiments to avoid null training errors.) However, despite this shortcoming, the ADJ procedure turns out to perform very well in practice and most often outperforms the more straightforward TRI strategy. 3.4 Robustness to unlabeled data Before moving on to regularization, we brie y investigate the robustness of these model selection techniques to limited amounts of auxiliary unlabeled data. In principle, one can always argue that the preceding empirical results are not useful because the metric-based strategies TRI and ADJ might require signicant amounts of unlabeled data to perform well in practice. (However, the 200 unlabeled examples used in the previous experiments does not seem that onerous.) In fact, the previous theoretical results (Propositions assumed innite unlabeled data. To explore the issue of robustness to limited amounts of unlabeled data, we repeated our previous experiments but gave TRI and ADJ only a small auxiliary sample of unlabeled data to estimate inter-hypothesis distances. In this experiment we found that these strategies were actually quite robust to using approximate distances. Table 7 shows that small numbers of unlabeled examples were still su-cient for TRI and ADJ to perform nearly as well as before. Moreover, Table 7 shows that these techniques only seem to signicantly degrade once we consider fewer unlabeled than labeled training examples. This robustness was observed Table 7 across the range of problems considered. In fact, it is a straightforward exercise to theoretically analyze the robustness of these procedures TRI and ADJ to approximation errors in the estimated inter-hypothesis distances. In a model selection sequence h there are only K(K 1)=2 pairwise distances that need to be estimated from unlabeled data. This means that a straightforward \union bound" can be combined with standard uniform convergence results [AB99] to obtain an O r error bar on these estimates (at the 1 - condence level). These error bars could easily be used to suitably adjust Propositions 1{3 to account for the estimation errors. However, we do not pursue this analysis here since it is straightforward but unrevealing. Although the empirical results in this section are anecdotal, the paper [SUF97] pursues a more systematic investigation of the robustness of these procedures and reaches similar conclusions (also based on articial data). Rather than present a detailed investigation of these model selection strategies in more serious case studies, we rst consider a further improvement to the basic method. Regularization One of the di-culties with model selection is that its generalization behavior depends on the specic decomposition of the base hypothesis class one con- siders. That is, dierent decompositions of H can lead to dierent outcomes. To avoid this issue, we extend the previous ideas to a more general training criterion that uses unlabeled data to decide how to penalize individual hypotheses in the global space H. The main contribution of this section is a simple, generic training objective that can be applied to a wide range of supervised learning problems. Continuing from above, we assume that we have access to a sizable collection of unlabeled data which we now use to globally penalize complex hypotheses. Specically, we formulate an alternative training criterion that measures the behavior of individual hypotheses on both the labeled and unlabeled data. The intuition behind our criterion is simple|instead of minimizing empirical training error alone, we in addition seek hypotheses that behave similarly both on and o the labeled training data. This objective arises from the observation that a hypothesis which ts the training data well but behaves erratically o the labeled training set is not likely to generalize to unseen examples. To detect erratic behavior we measure the distance a hypothesis exhibits to a xed \origin" function (chosen arbitrarily) on both data sets. If a hypothesis is behaving erratically o the labeled training set then it is likely that these distances will disagree. This eect is demonstrated in Figure 8 for two large degree polynomials that t the labeled training data well, but dier dramatically in their true error and their dierences between on and o training set distance to a simple origin function. (Note that we will Figure 8 use trivial origin functions throughout this section, such as the zero function or the constant function y at the mean of the y labels.) To formulate a concrete training objective we rst propose the following tentative measures: empirical training error plus an additive penalty d and empirical error times a multiplicative penalty d d In each case we compare the behavior of a candidate hypothesis h to the xed origin . Thus, in both cases we seek to minimize empirical training error d (or times) a penalty that measures the discrepancy between the distance to the origin on the labeled training data and the distance to the origin on unlabeled data. The regularization eect of these criteria is illustrated in Figure 8. Somewhat surprisingly, we have found that the multiplicative objective (13) generally performs much better than (12), as it more harshly penalizes discrepancies between on and o training set behavior. Therefore, this is the form we adopt below. Although these training criteria might appear to be ad hoc, they are not entirely unprincipled. One useful property they have is that if the origin function happens to be equal to the target conditional P YjX , then minimizing (12) or (13) becomes equivalent to minimizing the true prediction error However, despite the utility of this technique, it turns out that these initial training objectives have the inherent drawback that they subtly bias the nal hypotheses towards the origin function . That is, both (12) and (13) allow minima that have \articially" large origin distances on the labeled data d simultaneously small distances on unlabeled data For example, this is illustrated in Figure 8 for a hypothesis function g that minimizes (13) but is clearly attracted to the origin at the right end of the domain (o of the labeled training data). Of course, such a bias towards can be desirable if happens to be near the target conditional P YjX . In this sense, could serve as a useful prior on hypotheses. However, there is no reason to expect to be anywhere near P YjX in practice, especially when considering the trivial constant functions used in this paper. Nevertheless, there is an intuitive way to counter this di-culty: to avoid the bias towards , we introduce symmetric forms of the previous criteria that also penalize hypotheses which are unnaturally close to the origin the labeled data. That is, one could consider a symmetrized form of the additive penalty (12) d as well as a symmetrized form of the multiplicative penalty (13) d d d These penalties work in both directions: hypotheses that are much further from the origin on the training data than are penalized, but so are hypotheses that are signicantly closer to the origin on the training data than o. The rationale behind this symmetric criterion is that both types of erratic behavior indicate that the observed training error is likely to be an unrepresentative re ection of the hypothesis's true error. The value of this intuition is demonstrated in Figure 9, where the hypothesis f that minimizes the symmetric criterion (15) is not drawn towards the origin inappropriately, and thereby achieves a smaller true prediction error than the hypothesis g that minimizes (13). Figure 9 These symmetric training criteria can also be given a technical justi- cation: First, if the origin function happens to be equal to the target conditional minimizing either (14) or (15) comes very close to minimizing the true prediction error d(h; P YjX ). To see this for the multiplicative criterion (15), let h be the hypothesis that achieves the minimum and note that if d the criterion becomes equivalent to d the criterion becomes equivalent to d(h; P YjX )r 2 for In the latter case, since h minimizes (15) we must have d(h; P YjX ) < for the Bayes optimal hypothesis h . But since h is not directly optimized on the training set (it remains xed), we will usually have which means that d(h; P YjX ) will tend to be close to d(h ; P YjX ). Thus, minimizing (15) will result in near optimal generalization performance in this scenario. (Note that this property would not hold for naively smoothed versions of this objective.) In the more general case where the origin does not match the target, the symmetric criteria will also still provably penalize hypotheses that have small training error and large test error. To see this for (15), note that for any hypothesis h d d by the triangle inequality. Since and P YjX are not optimized on the training set we can expect d sizes. Thus, (16) shows that if d (greater than k d(; P YjX ), k 3), then h's training error must be penalized by a signicant ratio (at least k 1). By contrast, an alternative hypothesis g that achieves comparable training error and yet exhibits balanced behavior on and o the labeled training set (that is, such that d will be strongly preferred; in fact, such a g cannot over-t by the same amount as h without violating (16). Importantly, the Bayes optimal hypothesis h will also tend to have d it too does not depend on the training set. Thus, h will typically achieve a small value of the objective, which will force any hypothesis that has a large over-tting error (relative to d(; P YjX )) to exhibit an objective value greater than the minimum. Note that the sensitivity of the lower bound (16) clearly depends on the distance between the origin and the target. If the origin is too far from the target then the lower bound is weakened and the criterion (15) becomes less sensitive to over-tting. However, our experiments show that the objective is not unduly sensitive to the choice of , so long as is not too far from the data. In fact, even simple constant functions generally su-ce. 4 The outcome is a new regularization procedure that uses the training objective (15) to penalize hypotheses based on the given training data and on the unlabeled data. The resulting procedure, in eect, uses the unlabeled data to automatically set the level of regularization for a given problem. Our goal is to apply the new training objective to various hypothesis classes and see if it regularizes eectively across dierent data sets. We demonstrate this for several classes below. However, the regularization behavior is even sub- tler: since the penalization factor in (15) also depends on the specic labeled training set under consideration, the resulting procedure regularizes in a data dependent way. That is, the procedure adapts the penalization to the particular set of observed data. This raises the possibility of outperforming any regularization scheme that keeps a xed penalization level across dierent training samples drawn from the same problem. In fact, we demonstrate below that such an improvement can be achieved in realistic hypothesis classes on real data sets. 4.1 Example: Polynomial regression The rst supervised learning task we consider is the polynomial regression problem considered in Section 3.2. The regularizer introduced above (15) turns out to perform very well in such problems. In this case, our training 4 One could easily imagine trying more complex origin functions such as low dimensional polynomials or smooth interpolant functions. We did not explore these ideas in this paper, primarily because we wished to emphasize the robustness of the method to even very simple choices of origin. However, one extension that we did investigate was to use a set of origin functions penalize according to the maximum ratio|but this did not yield any signicant improvements. objective can be expressed as choosing a hypothesis to minimize is the set of labeled training data, fhx j ig r j=1 is a set of unlabeled examples, and is a xed origin (which we usually just set to be the constant function at the mean of the y labels). Note again that this training objective seeks hypotheses that t the labeled training data well while simultaneously behaving similarly on the labeled and unlabeled data. To test the basic eectiveness of our approach, we repeated the experiments of Section 3.2. The rst class of methods we compared against were the same model selection methods considered before: 10-fold cross validation CVT, structural risk minimization SRM [CMV97], RIC [FG94]; SMS [Shi81], GCV [CW79], BIC [Sch78], AIC [Aka74], CP [Mal73], FPE [Aka70], and the metric based model selection strategy, ADJ, introduced in Section 3.3. How- ever, since none of the statistical methods, RIC, SMS, GCV, BIC, AIC, CP, FPE, performed competitively in our experiments, we report results only for GCV which performed the best among them. For comparison, we also report results for the optimal model selector OPT* which makes an oracle choice of the best available hypothesis in any given model selection sequence. In these experiments, the model selection methods considered polynomials of degree 0 to t 2. 5 The second class of methods we compared against were regularization methods, which consider polynomials of maximum degree (t 2) but penalize individual polynomials based on the size of their coe-cients or their smoothness properties. The specic methods we considered were: a standard form of \ridge" penalization (or weight decay) which places a penalty k a 2 on polynomial coe-cients a k [CM98], and Bayesian maximum a posteriori inference with zero-mean Gaussian priors on polynomial coe-cients a k with diagonal covariance matrix I [Mac92]. 6 Both of these methods require a regularization parameter to be set by hand. We refer to these methods as REG and MAP respectively. 5 Note that we restricted the degree to be less than t 1 to prevent the maximum degree polynomials from achieving zero training error, which as discussed in Section 3, destroys the regularization eect of the multiplicative penalty. 6 We did not test the more elaborate approach to Bayesian learning of polynomials described in [You77]. To test the ability of our technique to automatically set the regularization level we tried a range of (fourteen) regularization parameters for the xed regularization methods REG and MAP. For comparison purposes, we also report the results of the oracle regularizers, REG* and MAP*, which select the best value for each training set. Our experiments were conducted by repeating the experimental conditions of Section 3.2. Specically, Table 8 repeats Table 1 (tting a step function), Table 9 repeats Table 3 (tting sin(1=x)), Table repeats Table 4 (tting sin 2 (2x)), and Table 11 repeats Table 5 (tting a fth degree polynomial). The regularization criterion based Table 8 Table Table Table on minimizing (15) is listed as ADA in our gures (for \adaptive" regular- ization). 7 We also tested ADA using dierent origin functions y, y, 2 max y, 4 y, 8 max y to examine its robustness to , and also tested the one-sided version of ADA (13) to verify the benets of the symmetrized criterion (15) over (13). The results once again are quite positive. The rst observation is that the model selection methods generally did not fare as well as the regularization techniques on these problems. Model selection seems prone to making catastrophic over-tting errors in these polynomial regression problems, whereas regularization appears to retain robust control. As noted, even the frequently trusted 10-fold cross validation procedure CVT did not fare well in our experiments. The only model selection strategy to perform reasonably well (besides the oracle model selector OPT*) was the metric-based method ADJ, which also exploits unlabeled data. The new adaptive regularization scheme ADA performed the best among all procedures in these experiments. Tables 8{11 show that it outperforms the xed regularization strategies (REG and MAP) for all xed choices of regularization parameter , even though the optimal choice varies across problems (MAP was inferior to REG in these experiments, and therefore we do not report detailed results). This demonstrates that ADA is able to eectively tune its penalization behavior to the problem at hand. Moreover, since it outperforms even the best choice of for each data set, ADA also demonstrates the ability to adapt its penalization behavior to the specic 7 We used a standard optimization routine (Matlab 5.3 \fminunc") to determine co- e-cients that minimize (14) and (15). Although the nondierentiability of (15) creates di-culty for the optimizer, it does not prevent reasonable results from being achieved. Another potential problem could arise if h gets close to the origin . However, since we chose simple origins that were never near P YjX , h was not drawn near in our experiments and thus the resultant numerical instability did not arise. training set, not just the given problem. In fact, ADA is competitive with the oracle regularizers REG* and MAP* in these experiments, and even outperformed the oracle model selection strategy OPT* on two problems. It is clear that ADA is fairly robust to the choice of , since moving to a distant constant origin (even up to eight times the max y value) did not completely damage its performance. The results also show that the one-sided version of ADA based on (13) is inferior to the symmetrized version in these experiments, conrming our prior expectations. 4.2 Example: Radial basis function regression To test our approach on a more realistic task, we considered the problem of regularizing radial basis function (RBF) networks for regression. RBF networks are a natural generalization of interpolation and spline tting tech- niques. Given a set of prototype centers c 1 ; :::; c k , an RBF representation of a prediction function h is given by where is the Euclidean distance between x and center c i , and g is a response function with width parameter . In this experiment we use a standard local (Gaussian) basis function Fitting with RBF networks is straightforward. The simplest approach is to place a prototype center on each training example and then determine the weight vector w that allows the network to t the training y labels. The best weight vector can be obtained by solving for w in6 6 6 4 kx1 x1k g g (the solution is guaranteed to exist and be unique for distinct training points and most natural basis functions g, including the Gaussian basis used here [Bis95]). Although exactly tting data with RBF networks is natural, it has the problem that it generally over-ts the training data in the process of replicating the y labels. Many approaches therefore exist for regularizing RBF networks. However, these techniques are often hard to apply because they involve setting various free parameters or controlling complex methods for choosing prototype centers, etc. [CM98, Bis95]. The simplest regularization approaches are to add a ridge penalty to the weight vector, and minimize where h is given as in (17) [CM98]. An alternative approach is to add a non-parametric penalty on curvature [PG90], but the resulting procedure is similar. To apply these methods in practice one has to make an intelligent choice of the width parameter and the regularization parameter . Un- fortunately, these choices interact and it is often hard to set them by hand without extensive visualization and experimentation with the data set. In this section we investigate how eectively the ADA regularizer is able to automatically select the width parameter and regularization parameter in an RBF network on real regression problems. Here the basic idea is to use unlabeled data to make these choices automatically and adaptively. We compare ADA (15) to a large number of ridge regularization procedures, each corresponding to the penalty (18) with dierent xed choices of and (thirty ve in total). To apply ADA in this case we simply ran a standard optimizer over the parameter space (; ) while explicitly solving for the w vector that minimizes (18) for each choice of and (which involves solving a linear system [CM98, Bis95]). Thus, given , and w we could calculate and supply the resulting value to the optimizer as the objective to be minimized (cf. Footnote 7). To conduct an experiment we investigated a number of regression problems from the StatLib and UCI machine learning repositories. 8 In our ex- periments, a data set was randomly split into a training (1/10), unlabeled (7/10), and test set (2/10), and then each of the methods was run on this split. We repeated the random splits 100 times to obtain our results. Tables 12{15 show that ADA regularization is able to choose width and regularization parameters that achieve eective generalization performance across Table 12 Table Table Table a range of data sets. Here ADA performs better than any xed regularizer on every problem (except BODYFAT), and even beats the oracle regularizer REG* on all but one problem. This shows that the adaptive criterion is not 8 The URLs are lib.stat.cmu.edu and www.ics.uci.edu/mlearn/MLRepository.html. only eective at choosing good regularization parameters for a given prob- lem, it can choose them adaptively based on the given training data to yield improvements over xed regularizers. 5 Classication Finally, we note that the regularization approach developed in this paper can also be easily applied to classication and conditional density estimation problems. In conditional density estimation, one can use KL divergence as a proxy distance measure and still achieve interesting results (however we do not report these experiments here). In classication, the label set Y is usually a small discrete set and we measure prediction error by the misclassication loss, err(^y; distances are measured by the disagreement probability d(f; g(x)). Using this metric, our generic regularization objective (15) can be directly applied to classication problems. In fact, we have applied (15) to the problem of decision tree pruning in classication, obtaining the results shown in Table 16. Unfortunately, the results achieved in this experiment are not strong, and it appears that the techniques proposed in this paper may not work as decisively for classication problems as they do for regression and conditional density estimation problems. Table We believe that the weakness of the proposed methods for classication might have an intuitive explanation however: Since classication functions are essentially histogram-like (i.e., piecewise constant), they limit the ability of unlabeled data to detect erratic behavior o the labeled training sample. This is because histograms, being at across large regions, tend to behave similarly in large neighborhoods around training points|to the extent that distances on labeled and unlabeled data points are often very similar, even for complex histograms. Coping with this apparent limitation in our approach remains grounds for future research. 6 Conclusion We have introduced a new approach to the classical complexity-control problem that is based on exploiting the intrinsic geometry of the function learning task. These new techniques seem to outperform standard approaches in a wide range of regression problems. The primary source of this advantage is that the proposed metric-based strategies are able to detect dangerous situations and avoid making catastrophic over-tting errors, while still being responsive enough to adopt reasonably complex models when this is supported by the data. They accomplish this by attending to the real distances between hypotheses. (Standard complexity-penalization strategies completely ignore this information. Hold-out methods implicitly take some of this information into account, but do so indirectly and less eectively than the metric-based strategies introduced here.) Although there is no \free lunch" in general [Sch94] and we cannot claim to obtain a universal improvement for every complexity-control problem [Sch93], we claim that one should be able to exploit additional information about the task (here, knowledge of P X ) to obtain signicant improvements across a wide range of problem types and conditions. Our empirical results for regression support this view. A substantial body of literature has investigated unlabeled data in the context of supervised learning, although not in the same way we have considered in this paper. Most work in this area adopts the perspective of parametric probability modeling and uses unlabeled data as part of a maximum likelihood (EM) or discriminative training procedure [MU97, CC96, RV95, GS91, O'N78]. Another common idea is to supply articial labels to unlabeled examples and use this data directly in a supervised training procedure [BM98, Tow96]. Unlabeled examples can also be used to construct a \cover" of the hypothesis space and improve some worst case bounds on generalization error [LP96]. However, none of this previous research explicitly uses unlabeled data for automated complexity control. Perhaps the closest work in spirit to ours is [KV95] which uses unlabeled examples to calculate optimal combination weights in an ensemble of regressors. The emphasis in [KV95] is on model combination rather than model selection and regulariza- tion, but nevertheless there appears to be a close relationship between their ideas and ours. An important direction for future research is to develop theoretical support for our strategies|in particular, a stronger theoretical justication of the regularization methods proposed in Section 4 and an improved analysis of the model selection methods proposed in Section 3. It remains open as to whether the proposed methods TRI, ADJ, and ADA are in fact the best possible ways to exploit the hypothesis distances provided by P X . We plan to continue investigating alternative strategies which could potentially be more eective in this regard. For example, it remains future work to extend the multiplicative ADJ and ADA methods to cope with zero training errors. Finally, it would be interesting to adapt the approach to model combination methods, extending the ideas of [KV95] to other combination strategies, including boosting [FS97] and bagging [Bre96]. Acknowledgements Research supported by NSERC, MITACS, CITO and BUL. Thanks to Yoshua Bengio, Adam Grove, Rob Holte, John Laerty, Joel Martin, John Platt, Lyle Ungar, Jason Weston and anonymous referees for very helpful comments at various stages of this research. --R Neural Network Learning: Theoretical Foundations. Statistical predictor information. A new look at the statistical model identi Neural Networks for Pattern Recognition. Combining labeled and unlabeled data with co-training Bagging predictors. The relative value of labeled and unlabeled samples in pattern recognition with an unknown mixing pa- rameter Learning from Data: Concepts Comparison of VC- method with classical methods for model selection Elements of Information Theory. Smoothing noisy data with spline func- tions Computers and the theory of statistics: Thinking the unthinkable. The risk in ation criterion for multiple regression. A decision-theoretic generalization of on-line learning and an application to boosting Applications of model selection techniques to polynomial approximation. A comparison of scienti A study of cross-validation and bootstrap for accuracy estimation and model selection Neural network ensembles Bayesian interpolation. Some comments on C p A mixture of experts classi Generating accurate and diverse members of a neural-network ensemble Regularization algorithms for learning that are equivalent to multilayer networks. Pattern Recognition and Neural Networks. Stochastic complexity and modeling. Learning from a mixture of labeled and unlabeled examples with parametric side information. Estimating the dimension of a model. A new metric-based approach to model selec- tion An optimal selection of regression variables. An adaptive regularization criterion for supervised learning. Characterizing the generalization performance of model selection strategies. Using unlabeled data for supervised learning. The Nature of Statistical Learning Theory. Computer Systems that Learn. A Bayesian approach to prediction using polynomials. --TR --CTR Yoshua Bengio , Nicolas Chapados, Extensions to metric based model selection, The Journal of Machine Learning Research, 3, 3/1/2003 Antonio Bahamonde , Gustavo F. Bayn , Jorge Dez , Jos Ramn Quevedo , Oscar Luaces , Juan Jos del Coz , Jaime Alonso , Flix Goyache, Feature subset selection for learning preferences: a case study, Proceedings of the twenty-first international conference on Machine learning, p.7, July 04-08, 2004, Banff, Alberta, Canada
unlabeled examples;model selection;regularization
599683
Model Selection and Error Estimation.
We study model selection strategies based on penalized empirical loss minimization. We point out a tight relationship between error estimation and data-based complexity penalization: any good error estimate may be converted into a data-based penalty function and the performance of the estimate is governed by the quality of the error estimate. We consider several penalty functions, involving error estimates on independent test data, empirical VC dimension, empirical VC entropy, and margin-based quantities. We also consider the maximal difference between the error on the first half of the training data and the second half, and the expected maximal discrepancy, a closely related capacity estimate that can be calculated by Monte Carlo integration. Maximal discrepancy penalty functions are appealing for pattern classification problems, since their computation is equivalent to empirical risk minimization over the training data with some labels flipped.
Introduction We consider the following prediction problem. Based on a random observation one has to estimate Y 2 Y. A prediction rule is a measurable is a bounded loss function. The data consist of a sequence of independent, identically distributed samples with the same distribution as (X; Y ) and D n is independent of (X; Y ). The goal is to choose a prediction rule f n from some restricted class F such that the loss L(f is as close as possible to the best possible loss, the inmum is taken over all prediction rules Empirical risk minimization evaluates the performance of each prediction rule f 2 F in terms of its empirical loss b L n provides an estimate whose loss is close to the optimal loss L if the class F is (i) su-ciently large so that the loss of the best function in F is close to L and (ii) is su-ciently small so that nding the best candidate in F based on the data is still possible. These two requirements are clearly in con ict. The trade-o is best understood by writing The rst term is often called estimation error, while the second is the approximation error. Often F is large enough to minimize L() for all possible distributions of (X; Y ), so that F is too large for empirical risk minimiza- tion. In this case it is common to x in advance a sequence of smaller model whose union is equal to F . Given the data D n , one wishes to select a good model from one of these classes. This is the problem of model selection. Denote by b f k a function in F k having minimal empirical risk. One hopes to select a model class FK such that the excess error EL( is close to min The idea of structural risk minimization (also known as complexity regular- ization) is to add a complexity penalty to each of the b f k )'s to compensate for the overtting eect. This penalty is usually closely related to a distribution-free upper bound for sup f2F k so that the penalty eliminates the eect of overtting. Thus, structural risk minimization nds the best trade-o between the approximation error and a distribution-free upper bound on the estimation error. Unfortunately, distribution-free upper bounds may be too conservative for specic distributions. This criticism has led to the idea of using data-dependent penalties. In the next section, we show that any approximate upper bound on error (including a data-dependent bound) can be used to dene a (possibly data- dependent) complexity penalty C n (k) and a model selection algorithm for which the excess error is close to min Section 3 gives several applications of the performance bounds of Section 2: Section 3.1 considers the estimates provided by an independent test sample. These have the disadvantage that they cost data. Section 3.2, considers a distribution-free estimate based on the VC dimension and a data-dependent estimate based on shatter coe-cients. Unfortunately, these are di-cult to compute. Section 3.3 brie y considers margin-based error estimates, which can be viewed as easily computed estimates of quantities analogous to shatter coe-cients. Section 3.4 looks at an estimate provided by maximizing the discrepancy between the error on the rst half of the sample and that on the second half. For classication, this estimate can be conveniently computed, simply by minimizing empirical risk with half of the labels ipped. Section 3.5 looks at a more complex estimate: the expected maximum discrepancy. This estimate can be calculated by Monte Carlo integration, and can lead to better performance bounds. In Section 4 we review some concentration inequalities that are central to our proofs. Finally, in Section 5 we oer an experimental comparison of some of the proposed methods. For clarity, we include in Table 1 notation that we use throughout the paper. For work on complexity regularization, see Akaike [1], Barron [2],[3] Bar- ron, Birge, and Massart [4], Barron and Cover [5], Birge and Massart [8],[9], Buescher and Kumar [11],[12], Devroye, Gyor, and Lugosi, [14], Gallant [16], Geman and Hwang [17], Kearns, Mansour, Ng, and Ron [20], Krzy_zak and Linder [23], Lugosi and Nobel [25] Lugosi and Zeger, [27], [26], Mallows [28], Meir [33], Modha and Masry [34], Rissanen [35], Schwarz [37], Shawe- Taylor, Bartlett, Williamson, and Anthony [38], Shen and Wong [39], Vapnik f prediction rule, sets of prediction rules (model classes) F union of model classes F k f k element of F k with minimal loss element of F k minimizing empirical loss prediction rule from F minimizing ~ loss loss, minimal loss of functions in F k , L b L n empirical loss R n;k estimate (high condence upper bound) of loss L( b ~ penalized loss estimate, ~ L loss of optimal prediction rule Table 1: Notation. [42], Vapnik and Chervonenkis [46], Yang and Barron [50], [51]. Data-dependent penalties are studied by Bartlett [6], Freund [15], Kolt- chinskii [21], Koltchinskii and Panchenko [22], Lozano [24], Lugosi and Nobel [25], Massart [30] and Shawe-Taylor, Bartlett, Williamson, and Anthony [38]. Penalization by error estimates For each class F k , let b f k denote the prediction rule that is selected from F k based on the data. Our goal is to select, among these rules, one which has approximately minimal loss. The key assumption for our analysis is that the true loss of b f k can be estimated for all k. Assumption 1 For every n, there are positive numbers c and m such that for each k an estimate R n;k on L( b is available which satises ce 2m 2 (1) for all . Notice that c and m might depend on the sample size n. Now dene the data-based complexity penalty by r log k The last term is required because of technical reasons that will become apparent shortly. It is typically small. The dierence R n;k simply an estimate of the 'right' amount of penalization L( b Finally, dene the prediction rule: ~ where ~ r log k The following theorem summarizes the main performance bound for f n . Theorem 1 Assume that the error estimates R n;k satisfy (1) for some positive constants c and m. Then for all > 0, 2ce 2m 2 Moreover, if for all k, b minimizes the empirical loss in the model class F k , then r log(ce) The second part of Theorem 1 shows that the prediction rule minimizing the penalized empirical loss achieves an almost optimal trade-o between the approximation error and the expected complexity, provided that the estimate R n;k on which the complexity is based is an approximate upper bound on the loss. In particular, if we knew in advance which of the classes F k contained the optimal prediction rule, we could use the error estimates R n;k to obtain an upper bound on EL( , and this upper bound would not improve on the bound of Theorem 1 by more than O If the range of the loss function ' is an innite set, the inmum of the empirical loss might not be achieved. In this case, we could dene b f k as a suitably good approximation to the inmum. However, for convenience, we assume throughout that the minimum always exists. It su-ces for this, and for various proofs, to assume that for all n and is closed. Proof. For brevity, introduce the notation Then for any > 0, sup (by the union bound) r log j (by denition) ce 2m (by Assumption 1) ce (since To prove the second inequality, for each k, we decompose L(f n ) L k as ~ ~ The rst term may be bounded, by standard integration of the tail inequality shown above (see, e.g., [14, page 208]), as E ~ log(ce)=(2m). Choosing f k such that L(f k , the second term may be bounded directly by ~ (by the denition of ~ minimizes the empirical loss on F k ) where the last step follows from the fact that E Summing the obtained bounds for both terms yields that for each k, log(ce)=(2m); which implies the second statement of the theorem. Sometimes bounds tighter than Assumption 1 are available, as in Assumption below. Such bounds may be exploited to decrease the term log k=m in the denition of the complexity penalty. Assumption 2 For every n, there are positive numbers c and m such that for each k an estimate R n;k of L( b is available which satises ce m (2) for all . Dene the modied penalty by and dene the prediction rule where Then by a trivial modication of the proof of Theorem 1 we obtain the following result. Theorem 2 Assume that the error estimates R n;k satisfy Assumption 2 for some positive constants c and m. Then for all > 0, Moreover, if for all k, b minimizes the empirical loss in the model class F k , then log(2ec) So far we have only concentrated on the expected loss of the penalized estimate. However, with an easy modication of the proof we obtain exponential tail inequalities. We work out one such inequality in the scenario of Theorem 1. Theorem 3 Assume that the error estimates R n;k satisfy (1) for some positive constants c and m, and that for all k, b minimizes the empirical loss in the model class F k . Then for all > 0, r log k Proof. Note that r log k ~ ~ r log k sup ~ r log k (by the rst inequality of Theorem 1) r log k (by the union bound and the denition of ~ r log k minimizes the empirical loss on F k ) e 2n log k=n (by Hoeding's inequality) This concludes the proof. In the examples shown below we concentrate on the expected loss of penalized empirical error minimizers. Tail probability estimates may be obtained in all cases by a simple application of the theorem above. Applications 3.1 Independent test sample Assume that m independent sample pairs are available. We can simply remove m samples from the training data. Of course, this is not very attractive, but m may be small relative to n. In this case we can estimate L( b We apply Hoeding's inequality to show that Assumption 1 is satised with apply Theorem 1 to give the following result. Corollary 1 Assume that the model selection algorithm of Section 2 is performed with the hold-out error estimate (3). Then min r log k In other words, the estimate achieves a nearly optimal balance between the approximation error, and the quantity which may be regarded as the amount of overtting. With this inequality we recover the main result of Lugosi and Nobel [25], but now with a much simpler estimate. In fact, the bound of the corollary may substantially improve the main result of [25]. The square roots in the bound of Corollary 1 can be removed by increasing the penalty term by a small constant factor and using Bernstein's inequality in place of Hoeding's as follows: Choose the modied estimate R n;k =1 "m where < 1 is a positive constant. Then Bernstein's inequality (see, e.g., [14]) yields Thus, (2) is satised with m replaced by 3m(1 )=8. Therefore, dening we obtain the performance bound 3.2 Estimated complexity In the remaining examples we consider error estimates R n;k which avoid splitting the data. For simplicity, we concentrate in this section on the case of classication and the 0-1 loss, dened by '(0; arguments may be carried out for the general case as well. Recall the basic Vapnik-Chervonenkis inequality [45], [43], sup n) is the empirical shatter coe-cient of F k , that is, the number of dierent ways the n points can be classied by elements of F k . It is easy to show that this inequality implies that the estimate r log ES k (X 2n Assumption 1 with We need to estimate the quantity log ES k (X 2n). The simplest way is to use the fact that ES k (X 2n) is the vc dimension of F k . Substituting this into Theorem min "r log 4 r rn This is the type of distribution-free result we mentioned in the introduction. A more interesting result involves estimating ES k (X 2n) by S k (X n). Theorem 4 Assume that the model selection algorithm of Section 2 is used with r min "r 12E log S k (X n r log k The key ingredient of the proof is a concentration inequality from [10] for the random vc entropy, log 2 S k (X n). Proof. We need to check the validity of Assumption 1. It is shown in [10] that n) satises the conditions of Theorem 9 below. First note that ES k (X 2n log ES k (X 2n log by the last inequality of Theorem 9. Therefore, r 3E log S k (X n) sup r log ES k (X 2n where we used the Vapnik-Chervonenkis inequality (4). It follows that r r 3E log S k (X n "r 12 log S k (X n r 3E log S k (X n "r 12 log S k (X n r 3E log S k (X n The last term may be bounded using Theorem 9 as follows: "r r 3E log S k (X n) log expB @ 9 expB @ 9 log 2C A exp Summarizing, we have that Therefore, Assumption 1 is satised with Applying Theorem 1 nishes the proof. 3.3 Eective VC dimension and margin In practice it may be di-cult to compute the value of the random shatter coe-cients S k (X n). An alternative way to assign complexities may be easily obtained by observing that S k (X n is the empirical vc dimension of class F k , that is, the vc dimension restricted to the points Now it is immediate that the estimate r log 4 Assumption 1 in the same way as the estimate of Theorem 4. (In fact, with a more careful analysis it is possible to get rid of the log n factor at the price of an increased constant.) Unfortunately, computing D k in general is still very di-cult. A lot of eort has been devoted to obtain upper bounds for D k which are simple to compute. These bounds are handy in our framework, since any upper bound may immediately be converted into a complexity penalty. In particular, the margins-based upper bounds on misclassication probability for neural networks [6], support vector machines [38, 7, 44, 13], and convex combinations of classiers [36, 29] immediately give complexity penalties and, through Theorem 1, performance bounds. We recall here some facts which are at the basis of the theory of support vector machines, see Bartlett and Shawe-Taylor [7], Cristianini and Shawe-Taylor [13], Vapnik [44] and the references therein. A model class F is called a class of (generalized) linear classiers if there exists a function such that F is the class of linear classiers in R p , that is, the class of all prediction rules of the form where w 2 R p is a weight vector satisfying Much of the theory of support vector machines builds on the fact that the \eective" vc dimension of those generalized linear classiers for which the minimal distance of the correctly classied data points to the separating hyperplane is larger than a certain \margin" may be bounded, independently of the linear dimension p, by a function of the margin. If for some constant then we say that the linear classier correctly classies X i with margin . We recall the following result: Lemma 1 (Bartlett and Shawe-Taylor [7]). Let f n be an arbitrary (possibly data dependent) linear classier of the form where w n 2 R p is a weight vector satisfying kw > 0 be positive random variables and let K n be a positive integer valued random variable such that k (X i )k R for all correctly classies all but K of the n data points X i with margin , then for all - > 0, sn -: Assume now that b f minimizes the empirical loss in a class F of generalized linear classiers, such that it correctly classies at least n K data points with margin , an application of the lemma shows that if we take sn then we obtain f) sn r2m log- sn (using the inequality This inequality shows that if all model classes F k are classes of generalized linear classiers and for all classes the error estimate R n;k is dened as above, then condition (1) is satised and Theorem 1 may be used. As a result, we obtain the following performance bound: Theorem 5 sn kk r log k k , and R k are the random variables K; corresponding to the class F k . The importance of this result lies in the fact that it gives a computationally feasible way of assigning data-dependent penalties to linear classiers. On the other hand, the estimates R n;k may be much inferior to the estimates studied in the previous section. 3.4 Penalization by maximal discrepancy In this section we propose an alternative way of computing the penalties with improved performance guarantees. The new penalties may be still di-cult to compute e-ciently, but there is a better chance to obtain good approximate quantities as they are dened as solutions of an optimization problem. Assume, for simplicity, that n is even, divide the data into two equal halves, and dene, for each predictor f , the empirical loss on the two parts by and L (2) Using the notation of Section 2, dene the error estimate R n;k by L (2) and the loss function is the 0-1 loss (i.e., '(0; and '(0; then the maximum discrepancy, L (2) may be computed using the following simple trick: rst ip the labels of the rst half of the data, thus obtaining the modied data set with (X 0 Next nd f k 2 F k which minimizes the empirical loss based on D 0 L (2) Clearly, the function f k maximizes the discrepancy. Therefore, the same algorithm that is used to compute the empirical loss minimizer b may be used to nd f k and compute the penalty based on maximum discrepancy. This is appealing: although empirical loss minimization is often computationally di-cult, the same approximate optimization algorithm can be used for both nding prediction rules and estimating appropriate penalties. In particular, if the algorithm only approximately minimizes empirical loss over the class F k because it minimizes over some proper subset of F k , the theorem is still applicable. et al. [47] considered a similar quantity for the case of pattern classication. Motivated by bounds (similar to (5)) on EL(f n ) b dened an eective VC dimension, which is obtained by choosing a value of the VC dimension that gives the best t of the bound to experimental estimates of EL(f n ) b They showed that for linear classiers in a xed dimension with a variety of probability distributions, the t was good. This suggests a model selection strategy that estimates EL(f n ) using these bounds. The following theorem justies a more direct approach (using discrepancy on the training data directly, rather than using discrepancy over a range of sample sizes to estimate eective VC dimension), and shows that an independent test sample is not necessary. A similar estimate was considered in [49], although the error bound presented in [49, Theorem 3.4] can only be nontrivial when the maximum discrepancy is negative. Theorem 6 If the penalties are dened using the maximum-discrepancy error estimates (6), and min L (2) r log k Proof. Once again, we check Assumption 1 and apply Theorem 1. Introduce the ghost sample (X 0 n ), which is independent of the data and has the same distribution. Denote the empirical loss based on this sample by ). The proof is based on the simple observation that for each k, Thus, for each k, L (2) sup L (2) sup L (2) sup L (2) Now, the dierence between the supremum and the maximum satises the conditions of McDiarmid's inequality (see Theorem 8 below) with c so this probability is no more than exp( 2 2 n=9). Thus, Assumption 1 is satised with and the proof is nished. 3.5 A randomized complexity estimator In this section we introduce an alternative way of estimating the quantity which may serve as an eective estimate of the complexity of a model class F . The maximum discrepancy estimate of the previous section does this by splitting the data into two halves. Here we oer an alternative which allows us to derive improved performance bounds: we consider the expectation, over a random split of the data into two sets, of the maximal discrepancy. Koltchinskii [21] considers a very similar estimate and proves a bound analogous to Theorem 7 below. We improve this bound further in Theorem ??. be a sequence of i.i.d. random variables such that Pf 1and the i 's are independent of the data D n . Introduce the quantity sup D n We use M n;k to measure the amount of overtting in class F k . Note that M n;k is not known, but it may be computed with arbitrary precision by Monte-Carlo simulation. In the case of pattern classication, each computation in the integration involves minimizing empirical loss on a sample with randomly ipped labels. We oer two dierent ways of using these estimates for model selection. The rst is based on Theorem 1 and the second, with a slight modication, on Theorem 2. We start with the simpler version: Theorem 7 Let dene the error estimates R M n;k , and choose f n by minimizing the penalized error estimates ~ r log k then r log k Proof. Introduce a ghost sample as in the proof of Theorem 6, and recall that by a symmetrization trick of Gine and Zinn [18], sup sup D n sup sup sup The rest of the proof of Assumption 1 follows easily from concentration in- equalities: for each k, sup sup sup (by where at the last step we used McDiarmid's inequality. (It is easy to verify that the dierence between the supremum and M n;k satises the condition of Theorem 8 with c Assumption 1 holds with Theorem 1 implies the result. Concentration inequalities Concentration-of-measure results are central to our analysis. These inequalities guarantee that certain functions of independent random variables are close to their mean. Here we recall the three inequalities we used in our proofs. Theorem 8 (McDiarmid [31]). Let X independent random variables taking values in a set A, and assume that f : A n ! R satises sup c i and McDiarmid's inequality is convenient when f() has variance ( In other situations when the variance of f is much smaller, the following inequality might be more appropriate. Theorem 9 (Boucheron, Lugosi, and Massart [10]) Suppose that are independent random variables taking values in a set A, and R is such that there exists a function R such that for all x Then for any t > 0, and Moreover, log 5 Experimental comparison of empirical penalization criteria 5.1 The learning problem In this section we report experimental comparison of some of the proposed model selection rules in the setup proposed by Kearns, Mansour, Ng, and Ron [20]. In this toy problem, the X i 's are drawn from the uniform distribution on the interval [0; 1]. The class F k is dened as the class of all functions such that for each f 2 F k there exists a partition of [0; 1] such that f is constant over all these intervals. It is straightforward to check that the vc-dimension of F k is k+1. Following [20], we assume that the \target function" f belongs to F k for some unknown k and the label Y i of each example X i is obtained by ipping the value of denotes the noise level. Then clearly, for any function g: What makes this simple learning problem especially convenient for experimental study is the fact that the computation of the minima of the empirical loss min f2F k can be performed in time O(n log n) using a dynamic programming algorithm described in [20]. Lozano [24] also reports an experimental comparison of model selection methods for the same problem. In this paper we studied several penalized model selection techniques: a holdout (or cross-validation) method based on independent test sample, penalization based on the empirical vc entropy, a maximum discrepancy estimator, and a randomized complexity estimator. For the investigated learning problem it is easy to see that the empirical vc entropy log 2 S k (X n) of class F k is almost surely a constant and equal to and therefore penalization based on the empirical vc entropy is essentially equivalent to the Guaranteed Risk Minimization (grm) procedure proposed by Vapnik [44]. Thus, we do not investigate empirically this method. Note that Lozano [24] compares the grm procedure with a method based on Rademacher penalties, very similar to our randomized complexity estimator and nds that Rademacher penalties systematically outperform the grm procedure. In [20], grm is compared to the Minimum Description Length principle and the independent test sample technique which is regarded as a simplied cross-validation technique. The main message of [20] is that penalization techniques that only take into account the empirical loss and some structural properties of the models cannot compete with cross-validation for all sample sizes. On the contrary, our conclusion (based on experiments) is that data-based penalties perform favorably compared to penalties based on independent test data. In the gures shown below we report experiments for three methods: (1) the Holdout method (holdout) bases its selection on independent samples as described in Section 3.1; (2) the Maximum Discrepancy (md) method selects a model according to the method of Section 3.4 and (3) Rademacher penalization (rp) performs the randomized complexity method proposed in Section 3.5. When using Maximum Discrepancy (Section 3.4) in experiments, the penalties were:2 L (2) We found that multiplying the penalty dened in Section 3.4 by 1=2 provides superior performance. When using Randomized Complexity Estimators (Sec- tion 3.5), the penalties were: sup D n Note that in all experiments, the log k or log k terms were omitted from penalties. For reasons of comparison, the performance of \oracle selection" is also shown on the pictures. This method selects a model by minimizing the true loss L( b among the empirical loss minimizers b f k of all classes F k , The training error minimization algorithm described in [20] was implemented using the templates for priority queues and doubly linked lists provided by the leda library [32]. 5.2 Results The results are illustrated by the gures below. As a general conclusion, we may observe that the generalization error (i.e., true loss) obtained by methods mdp and rp are favorable compared to holdout. Even for sample sizes between 500 and 1000, the data-dependent penalization techniques perform as well as holdout. The data dependent penalization techniques exhibit less variance than holdout. The main message of the paper is that good error estimation procedures provide good model selection methods. On the other hand, except for the holdout method, the data-dependent penalization methods do not try to estimate directly L( b )). The gures show that this is accurate when noise level is high and becomes rather inaccurate when noise level decreases. This is a strong incentive to explore further data-dependent penalization techniques that take into account the fact that not all parts of F k are equally eligible for minimizing the empirical loss. Acknowledgements Thanks to Vincent Mirelli and Alex Smola for fruitful conversations, and thanks to the anonymous reviewers for useful suggestions. --R A new look at the statistical model identi Logically smooth density estimation. Complexity regularization with application to arti Minimum complexity density estimation. The sample complexity of pattern classi Generalization performance of support vector machines and other pattern classi A sharp concentration inequality with applications in random combinatorics and learning. Learning by canonical smooth estima- tion Learning by canonical smooth estima- tion An Introduction to Support Vector Machines. bounding learning algorithms. Nonlinear Statistical Models. Nonparametric maximum likelihood estimation by the method of sieves. An experimental and theoretical comparison of model selection methods. Rademacher penalties and structural risk minimization. Rademacher processes and bounding the risk of function learning. Radial basis function networks and complexity regularization in function learning. Model selection using Rademacher penalization. Adaptive model selection using empirical com- plexities Nonparametric estimation via empirical risk minimization. Concept learning using complexity regulariza- tion Some comments on c p Improved generalization through explicit optimization of margins. Some applications of concentration inequalities to statis- tics On the method of bounded di A Platform for Combinatorial and Geometric Computing. Performance bounds for nonlinear time series prediction. Minimum complexity regression estimation with weakly dependent observations. A universal prior for integers and estimation by minimum description length. Boosting the margin Estimating the dimension of a model. Structural risk minimization over data-dependent hierarchies Convergence rate of sieve estimates. On the best constants in the Khintchine inequality. Concentration of measure and isoperimetric inequalities in product spaces. Estimation of Dependencies Based on Empirical Data. The Nature of Statistical Learning Theory. Statistical Learning Theory. On the uniform convergence of relative frequencies of events to their probabilities. Theory of Pattern Recognition. Measuring the VC-dimension of a learning machine Weak convergence and empirical processes An asymptotic property of model selection criteria. --TR --CTR Davide Anguita , Sandro Ridella , Fabio Rivieccio , Rodolfo Zunino, Quantum optimization for training support vector machines, Neural Networks, v.16 n.5-6, p.763-770, June Clayton D. Scott , Robert D. Nowak, Learning Minimum Volume Sets, The Journal of Machine Learning Research, 7, p.665-704, 12/1/2006 Leila Mohammadi , Sara van de Geer, Asymptotics in Empirical Risk Minimization, The Journal of Machine Learning Research, 6, p.2027-2047, 12/1/2005 Peter L. Bartlett , Shahar Mendelson, Rademacher and gaussian complexities: risk bounds and structural results, The Journal of Machine Learning Research, 3, 3/1/2003 Andrs Antos , Balzs Kgl , Tams Linder , Gbor Lugosi, Data-dependent margin-based generalization bounds for classification, The Journal of Machine Learning Research, 3, p.73-98, 3/1/2003 Joel Ratsaby, Complexity of hyperconcepts, Theoretical Computer Science, v.363 n.1, p.2-10, 25 October 2006 Ron Meir , Tong Zhang, Generalization error bounds for Bayesian mixture algorithms, The Journal of Machine Learning Research, 4, 12/1/2003 Joel Ratsaby, On learning multicategory classification with sample queries, Information and Computation, v.185 n.2, p.298-327, September 15, Magalie Fromont, Model selection by bootstrap penalization for classification, Machine Learning, v.66 n.2-3, p.165-207, March 2007 Shie Mannor , Ron Meir , Tong Zhang, Greedy algorithms for classificationconsistency, convergence rates, and adaptivity, The Journal of Machine Learning Research, 4, p.713-741, 12/1/2003 Ron Meir , Gunnar Rtsch, An introduction to boosting and leveraging, Advanced lectures on machine learning, Springer-Verlag New York, Inc., New York, NY,
model selection;empirical penalties;concentration inequalities;penalization
599687
Sparse Regression Ensembles in Infinite and Finite Hypothesis Spaces.
We examine methods for constructing regression ensembles based on a linear program (LP). The ensemble regression function consists of linear combinations of base hypotheses generated by some boosting-type base learning algorithm. Unlike the classification case, for regression the set of possible hypotheses producible by the base learning algorithm may be infinite. We explicitly tackle the issue of how to define and solve ensemble regression when the hypothesis space is infinite. Our approach is based on a semi-infinite linear program that has an infinite number of constraints and a finite number of variables. We show that the regression problem is well posed for infinite hypothesis spaces in both the primal and dual spaces. Most importantly, we prove there exists an optimal solution to the infinite hypothesis space problem consisting of a finite number of hypothesis. We propose two algorithms for solving the infinite and finite hypothesis problems. One uses a column generation simplex-type algorithm and the other adopts an exponential barrier approach. Furthermore, we give sufficient conditions for the base learning algorithm and the hypothesis set to be used for infinite regression ensembles. Computational results show that these methods are extremely promising.
Introduction The past years have seen strong interest in boosting and other ensemble learning algorithms due to their success in practical classication applications (e.g. Drucker et al., 1993; LeCun et al., 1995; Maclin & Opitz, 1997; Schwenk & Bengio, 1997; Bauer & Kohavi, 1999; Dietterich, 1999). The basic idea of boosting (and ensemble learning in general) is to iteratively generate a sequence fh t g T t=1 of functions (hypotheses) that are usually combined as c 2001 Kluwer Academic Publishers. Printed in the Netherlands. regression.tex; 15/01/2001; 20:26; p.1 Yoshua Bengio and Dale Schuurmans (none:kluwer) v.1.3 G. Ratsch, A. Demiriz and K.P. Bennett are the hypothesis coe-cients used. The hypotheses h t are elements of a hypothesis class where P is the index set of hypotheses producible by a base learning algorithm L. Typically one assumes that the set of hypotheses H is - nite, but we will also consider extensions to innite hypothesis sets. For classication, the ensemble generates the label by sign(f (x)), which is the weighted majority of the votes. For regression, the predicted value is f (x). Recent research in this eld has focused on the better understanding of these methods and on extensions that are concerned with robustness issues (Mason et al., 1998; Bennett et al., 2000; Ratsch et al., 2000b, 2001). It has been shown that most classication ensemble methods can be viewed as minimizing some function of the classication margin. Typically this is performed algorithmically using a gradient descent approach in function space. Recently, it has been shown that the soft margin maximization techniques utilized in support vector machines can be readily adapted to produce ensembles for classication (Ben- nett et al., 2000; Ratsch et al., 2000b). These algorithms optimize the soft margin and error measures originally proposed for support vector machines. For certain choices of error and margin norms, the problem can be formulated as a linear program (LP). At rst glance, the LP may seem intractable since the number of variables in the linear program is proportional to the size of the hypothesis space which can be exponentially large. But in fact, two practical algorithms exist for optimizing soft margin ensembles. The rst uses column generation in a simplex algorithm (Bennett et al., 2000). The second uses barrier functions in an interior-point method (Ratsch et al., 2000). The advantage of these linear programming approaches is that they produce sparse ensembles using fast nite algorithms. The purpose of this work is to tackle regression ensembles using the analogous support vector linear programming methodology for regression. To date, relatively few papers have addressed ensembles for regression Zemel & Pitassi, 2001). One major di-culty is rigorously dening the regression problem in an innite hypothesis space. For classication assuming each hypothesis has a nite set of possible outputs, the hypothesis space is always nite since there are only a nite number of ways to label any nite training set. For regression, even relatively simple hypothesis spaces, such as linear functions constructed using weighted least squares, consist of an uncountable innite set of hypothe- ses. It is not a priori clear how to even express a regression problem in an innite hypothesis space. Clearly we can only practically consider Sparse Regression Ensembles 3 ensemble functions that are a linear combination of some nite subset of the set of possible hypotheses. In this work, we study directly the issue of innite hypothesis spaces. We begin in Section 2 with a review of boosting type algorithms for classication and regression and examine the relationship between ensemble methods and linear programming. In Section 3, we review a linear program approach to sparse regression and show how it is easily extendible to ensemble regression for the nite hypothesis case. In Section 3.2 we investigate the dual of this linear program for ensemble regression. In Section 3.3, we propose a semi-innite linear program formulation for \boosting" of innite hypothesis sets, rst in the dual and then in the primal space. The dual problem is called semi-innite because it has an innite number of constraints and a nite number of variables. An important sparseness property of the semi-innite regression problem is that it has a solution consisting of a nite number of hypotheses. In Section 4, we propose two dierent algorithms for e-ciently computing optimal ensembles. The exact implementation of these algorithms is dependent on the choice of base learning algorithms. In Section 4.3 we investigate three possible base learning algorithms that result in both innite and nite hypothesis sets. Computational results are presented in Section 5. The notational conventions used in this paper can be found in Table I. Table I. Notational conventions n; N counter and number of patterns counter and number of hypotheses if nite t; T counter and number of iterations index-set for hypotheses space, dimensionality of X training data: input, targets, both y a training pattern and the label set of base hypotheses and an element of H set of linear combinations of H and element of F hypothesis weight vector d weighting on the training set w a weight vector for linear models I() the indicator function: " the tube size the tube parameter (determines ") C the regularization (complexity) parameter weighted classication error k kp the 'p-norm, product and scalar product in feature space 4 G. Ratsch, A. Demiriz and K.P. Bennett 2. Boosting-type Algorithms We brie y review and discuss existing boosting-type algorithms. In Section 2.1 we start with the classication case and describe AdaBoost closely related, Arc-GV (Breiman, 1997). Then we discuss properties of the solutions generated by boosting and show connections to a linear program (LP) for maximizing the margins. In Section 2.2 we brie y review some recent regression approaches that are mainly motivated from a gradient-descent understanding of Boosting. 2.1. Classification Boosting and LP For the classication case, it is generally assumed the hypotheses class dened by a base learning algorithm L. In each iteration the base learner is used to select the next hypothesis using certain criteria. The ensemble generates the label which is the weighted majority of the votes by sign(f (x)). Note that the hypothesis class is always nite because there at most 2 N distinct labelings of the training data. Consider the AdaBoost algorithm. For more details see e.g. (Freund 1997). The main idea of AdaBoost is to introduce weights d n on the training patterns Z := )g. They are used to control the importance of each single pattern for learning a new hypothesis (i.e., while repeatedly running the base algorithm). Training patterns that are di-cult to learn (which are misclassied repeatedly) become more important by increasing their weight. It has been shown that AdaBoost minimizes an error function (Breiman, 1997; Frean & Downs, 1998; Friedman et al., 1998; Ratsch et al., 2001) that can be expressed in terms of margins, namely it iteratively solves the problem min with 0 The optimization strategy of AdaBoost has also been called \gradient descent" in function space (Mason et al., 1999; Friedman et al., 1998), as one eectively optimizes along restricted gradient directions in the space of linearly combined functions f . This can also be understood as a coordinate descent method (e.g. Luenberger, 1984) to minimize G() over all possible weightings of hypotheses from H (Ratsch et al., 2000). One hypothesis is added at a time and its weight is never changed unless the same hypothesis is added again. Sparse Regression Ensembles 5 It is widely believed (Breiman, 1997; Freund & Schapire, 1996; Schapire et al., 1997; Ratsch et al., 2001, 2001) that AdaBoost approximately maximizes the smallest margin, % on the training set. This problem can be solved exactly by the following linear programming problem over the complete hypothesis set H (cf. Grove and Schuurmans (1998), assuming a nite number of basis with y n f (1) Breiman (1997) proposed a modication of AdaBoost { Arc-GV { making it possible to show the asymptotic convergence of %( t 1) to a global solution % lp of (1). In Grove and Schuurmans (1998) the LP (1) was solved using an iterative linear programming based approach that retrospectively can be considered as a column generation algorithm. Unfortunately, neither approach performed well in practice. margin versions of this linear program based on ideas from support vector machines perform very well both in practice and theoretically in terms of generalization bounds (Ratsch et al., 2000b; Bennett et al., 2000). For example, a soft margin version could be with y n f In Bennett et al. (2000) the column generation algorithm for classication was proposed to e-ciently solve these LPs. This algorithm and those closely related in Ratsch et al. (2001), Kivinen and Warmuth (1999) dier from the gradient-boosting idea used to motivate boosting-type algorithms (Mason et al., 1999; Friedman et al., 1998). At each iteration, all generated hypothesis weights are optimized with respect to a maximum margin error function. The gradient approach xes hypothesis weights as the hypotheses are generated. The purpose of this paper is to examine the extensions of these approaches to the regression case. 6 G. Ratsch, A. Demiriz and K.P. Bennett 2.2. Previous Regression Approaches Several regression boosting methods have been proposed. We provide a brief description of three of them. Note that the rst two described here and also those of (Fisher, 1997; G. Ridgeway, 1999) reduce the problem to a series of classication tasks, thus eliminating any consideration of innite hypothesis spaces. The last approach (Friedman, 1999) has been applied to innite hypothesis spaces, but does not dene what it means to boost in an innite hypothesis space. 2.2.1. AdaBoost-R: The rst boosting-type algorithm for regression { AdaBoost.R { was proposed in Freund and Schapire (1994). It is based on a reduction to the classication case. The algorithm aims to nd a regression function problem with this algorithm is that it uses a piece-wise linear function on [0; 1] whose number of branch-points increases exponentially with the number of iterations. Therefore, the algorithm is computationally intractable. 2.2.2. AdaBoost-R: Another reduction for nding f : x 7! [0; 1] to the classication case was proposed in Bertoni et al. (1997). Here, a pattern that is predicted with error less than some > 0 is counted as correctly classied and as misclassied otherwise. The combined regression function is given by Again, a probability weighting d on the training patterns is used. Under the assumption that the weighted \classication error" in each iteration is smaller than 1 > 0), the number of training patterns for which jf(x n ) y converges quickly to zero. From our experience it turned out that (i) the choice of is rather di-cult and (ii) the selection of the next hypothesis by the base learner is a demanding problem, as the weighted error usually converges quickly to 1 2 and the algorithm has to stop. 2.2.3. Gradient Boosting for Regression (Friedman, 1999): Based on the understanding of boosting as a gradient descent method, other regression algorithms have been proposed { e.g. in the very interesting paper of Friedman (Friedman, 1999). Here, the derivative @G of a cost function G (e.g. squared loss: with respect to the output f(x n ) of the regression function. Then the Sparse Regression Ensembles 7 projected gradient direction (a basis function h 2 H) that is most in the direction of the true gradient is found by @G This idea has been worked out for squared loss, linear absolute loss, and Huber's loss. However, the gradient direction found in (2) is optimal for the squared loss only. For the linear absolute loss, this has been specialized to the Tree-Boost algorithm (Friedman, 1999). Here, the task of nding the next hypothesis is posed as a classication problem, where the sign of the gradient determines the class membership. In this algorithm, the aim is to maximize the correlation between the gradient and the output of the base hypothesis. This approach is similar to the algorithm proposed in Section 4.3.3. This approach works well in practice. It does not explicitly deal with the innite hypothesis case. Like all gradient descent algorithms it oers convergence only in the limit { even for nite hypothesis spaces. Since regularization is not used, it can potentially overt so development of good stopping criteria is essential. In the next section, we will develop an alternative approach based on linear programming. The advantages of the LP approach include extensibility to the innite hypothesis case, sparse solution, guarantee of the existence of sparse nite solutions, and practical fast nite algorithms. 3. Linear Programs for Regression In this section, we develop nite and semi-innite LP formulations for the sparse ensemble regression. We begin with the primal LP for the nite case, then investigate the dual nite LP. Then we extend this to the dual and primal innite hypothesis cases. 3.1. Finite Sparse Linear Regression R be some i.i.d. (training) data. The regression problem is often stated as nding a function f 2 that minimizes the regularized risk functional (Vapnik, 1995; R[f ]; (3) 8 G. Ratsch, A. Demiriz and K.P. Bennett where l() is a loss function, P[] a regularization operator, and C the regularization parameter, determining the trade-o between loss and complexity (i.e., size of the function class). In this paper we consider the well-known "-insensitive loss (Vapnik, 1995; Scholkopf et al., 1999) as loss function: This does not penalize errors below some " 0, chosen a priori. It has been shown to have several nice properties { as we will see later (cf. Smola, 1998). However, in principle the analysis and algorithms also work for other loss functions (cf. Ratsch, 2001). In this paper we consider F to be the space of linear combinations of base hypotheses of another space H { the so-called base hypothesis space { including a bias, i.e. f Here we assume H has a nite number of hypotheses (J of them). This will be generalized to innite hypothesis classes in Sections 3.3 and 3.4. Throughout the paper we assume that H is closed under complementation Hence, one may enforce eectively changing F . Let us consider the ' 1 -norm of the hypothesis coe-cients as a regularization Using (4), minimizing (3) can be stated as a linear program, which we call the LP-Regression problem: min with y n f as in (5) and " 0 is a xed constant. The regularization operator jjjj 1 is frequently used in sparse favoring approaches, e.g. basis pursuit (Chen et al., 1995) and parsimonious least norm approximation (Bradley et al., 1998). Roughly speaking, a reason for the induced sparseness is the fact that vectors far from the coordinate axes are \larger" with respect to the ' 1 -norm than with respect to p-norms with p > 1. For example, consider the vectors (1; and (1= 2). For the two norm, Sparse Regression Ensembles 9 but for the ' 1 -norm, 2. Note that using the ' 1 -norm as regularizer the optimal solution is always a vertex solution (or can be expressed as such) and tends to be very sparse. It can easily be shown (cf. Corollary 4) that independent of the size of a (nite) hypothesis space H, the optimal number of hypotheses in the ensemble is not greater than the number of samples. The optimization algorithms proposed in Section 4 exploit this property. A nice property of (6) is that its solution is robust with respect to small changes of the training data: Proposition 1 (Smola et al. (1999)). Using Linear Programming Regression with the "-insensitive loss function (4), local movements of target values of points inside and outside (i.e. not on the edge of) the "-tube do not in uence the regression. The parameter " in (6) is usually di-cult to control (Muller et al., 1997; Scholkopf et al., 2000), as one usually does not know beforehand how accurately one is able to t the curve. This problem is partially resolved in the following optimization problem (Smola et al., 1999) for min with y n f The dierence between (6) and (7) lies in the fact that " has become a positively constrained variable of the optimization problem itself. The core aspect of (7) can be captured in the proposition stated below. Proposition 2 (Smola et al. (1999)). Assume " > 0. The following statements hold: (i) is an upper bound on the fraction of errors (i.e. points outside the " tube). (ii) is a lower bound on the fraction of points not inside (i.e. outside or on the edge of) the " tube. (iii) Suppose the data were generated i.i.d. from a distribution P (x; ically, equals both the fraction of points not inside the tube and the fraction of errors. G. Ratsch, A. Demiriz and K.P. Bennett Summarizing, the optimization problem (7) has two parameters: (i) the regularization parameter C, which controls the size of the hypothesis set and therefore the complexity of the regression function, and (ii) the tube-parameter , which directly controls the fraction of patterns outside the "-tube and indirectly controls the size of the "-tube. 3.2. Dual Finite LP Formulation In this section we state the dual optimization problem of (7) by introducing Lagrangian multipliers d n for the rst constraint which computes the error if the target is underestimated, and d n which the error measures if the target is overestimated. See any linear programming text book for specics on how to construct a dual LP problem. The dual problem of (7) is d;d with where the constraint comes from the reparameterization of " with . Here, we have 2N xed constraints and J := jHj constraints, one for each hypothesis h 2 H. At optimality for each point, the quantity p n denes an error residual. By complementarity, we know that if the "-error is zero (that is if If the point is underesti- if the point is overestimated, f Thus the point is within the -tube, p n > 0 when the point falls below the -tube, and p n < 0 if the point falls above the -tube. The magnitude of p n re ects the sensitivity of the objective to changes in . The larger the change in error, the larger p n . The quantity in the constraints re ects how well the hypothesis addressed the residual errors. If positive and large in size then the hypothesis will be likely to improve the ensemble. But it must be su-ciently large to oset the penalty for increasing kk 1 . 3.3. Generalization to Infinite Hypotheses Consider now the case where there is an innite set of possible hypotheses H. Say we select any nite subset H 1 of H, then the primal and dual regression LPs on H 1 are well dened. Now say we increase the Sparse Regression Ensembles 11 subset size and dene H 2 H 1 of H. What is the relationship between the optimal ensembles created on the two subsets? A solution of the smaller H 1 LP is always primal feasible for the larger H 2 LP. If the H 1 solution is dual feasible for the larger H 2 LP, then the solution is also optimal for the problem H 2 . So dual feasibility is the key issue. Dene the base learning algorithm L for a xed p as If dual feasibility is violated; h p is a good hypothesis that should be added to the ensemble, and the solution may not be optimal. By thinking of h as a function of as in (9), we can extend the dual problem (8) to the innite hypotheses case. The set of dual feasible values of p is equivalent to the following compact polyhedron: The dual SILP-regression problem is d;d with This is an example of semi-innite linear program (SILP), a class of problems that has been extensively studied in mathematical program- ming. The problem is called semi-innite because it has an innite number of constraints and a nite number of variables. The set P is known as the index set. If the set of hypotheses producible by the base learner is nite, e.g. if fh nite, then the problem is exactly equivalent to LP-Regression problem (8). We will establish several facts about this semi-innite programming problem using the results for general linear semi-innite programs summarized in the excellent review paper (Hettich & Kortanek, 1993). To simplify the presentation, we simplied the results in Hettich and Kortanek (1993) to the case of SILP with an additional set of nite linear constraints. The results presented can be easily derived from (Hettich through a change in notation and by increasing G. Ratsch, A. Demiriz and K.P. Bennett the index set to include the additional nite set of traditional linear constraints. To be consistent with our derivation of the SILP-regression problem, we will refer to the problem with innitely many constraints as the dual problem and the problem with innitely many variables as the primal problem. Care should be taken, since this is the reverse of the convention used in the mathematical programming literature. We dene the generic dual SILP as are compact sets, a() is a function from B to R N , and b() is a function from R N to R. We will make the additional assumption that the problem is always feasible and that the feasible region is compact. Clearly the maximum value is always obtained since we are maximizing a continuous function over a compact set. Ideally, we would like the solution of a linear program to correspond to the optimal solution of the semi-innite problem. We now dene a necessary condition for the existence of a nite linear program whose optimal solution also solves the semi-innite program. We will denote the generic dual SILP restricted to a nite subset B as (D(PN )). This is a linear program since it has a nite number of constraints. The rst theorem gives necessary conditions for the optimal solution of a generic dual SILP to be equivalent to the solution of a nite linear program (Theorem 4.2 in Hettich & Kortanek, 1993): Theorem 3 (Necessary condition for nite solution). Assume the following Slater condition holds: For every set of N z such that ha(p n N , and Q^z < r. Then there exists 1. 2. There exist multipliers n 0, , such that This result immediately applies to the dual SILP regression problem since the strictly interior point 1) satises the Slater condition. Corollary 4 (Finite solution of regression ensemble). For Prob- lem D) (11) with < 1, there exists that D(PN )). Sparse Regression Ensembles 13 The signicance of this result is that there exists an optimial ensemble that consists of at most N hypotheses where N is the number of data points and that this is true even if the set of possible hypotheses is innite. 3.4. Primal Regression SILP Next we look at the corresponding primal problem for the semi-innite case. We would like our semi-innite dual problem to be equivalent to a meaningful primal problem that simplies to the original primal for the nite hypothesis case. be the set of nonnegative Borel measures on B. The subset R denotes the set of nonnegative generalized nite sequences. The primal problem of the generic SILP (12) is In nite linear programming, the optimal objective values of the primal and dual problems are always equal. This is not always true for the semi-innite case. Weak duality always holds, that is, (P (D). We must ensure that there is no duality gap, i.e., that (P (D). From Hettich and Kortanek (1993) (Theorem 6.5) we have the following Theorem 5 (Su-cient conditions for no duality gap). Let the convex cone a(p) a(p) be closed, then (P primal minimum is attained. For the regression problem, is the set of base hypotheses (evaluated at the training points) obtainable by our learning algorithm, and constant. Thus the theorem can be simplied as follows. Corollary 6 (Su-cient conditions for base learner). Let the convex cone 14 G. Ratsch, A. Demiriz and K.P. Bennett be closed, then D) and primal minimum is attained. This corollary imposes conditions on the set of possible base hy- potheses. Some examples of sets of base hypothesis that would satisfy this condition are: The set of possible hypotheses is nite, e.g. fh Pg is nite. The function h continuous with respect to p. These two conditions are su-cient to cover all the base hypotheses considered in this paper, but other conditions are possible. 4. LP Ensemble Optimization Algorithms In this section we propose two algorithms for optimizing nite and innite regression linear programs. The rst uses column generation to execute a simplex-type algorithm. The second adopts an exponential barrier strategy that has connections to boosting algorithms for classication (Ratsch et al., 2000). 4.1. Column Generation Approach The basic idea of Column Generation (CG) is to construct the optimal ensemble for a restricted subset of the hypothesis space. LP (8) is solved for a nite subset of hypotheses. It is called the restricted master problem. Then the base learner is called to generate a hypothesis . Assuming the base learner nds the best hypothesis satisfying condition (9), if the current ensemble is optimal as all constraints are fullled. If not, the hypothesis is added to the problem. This corresponds to generating a column in the primal LP or SILP or a row of the dual LP or SILP. The CG-Regression algorithm (cf. Algorithm 1) assumes that the base learner L(X; p) is nite for any p 2 P. Algorithm 1 is a special case of the set of SILP algorithms known as exchange methods. These methods are known to converge. Clearly if the set of hypotheses is nite, then the method will converge in a nite number of iterations since no constraints are ever dropped. But one can also prove that it converges for SILP (cf. Theorem 7.2 in Hettich Theorem 7 (Convergence of Algorithm 1). Algorithm 1 stops after a nite number of steps with a solution to the dual regression Sparse Regression Ensembles 15 Algorithm 1 The CG-Regression algorithm. argument:Sample Regularization constant C, Tube parameter 2 (0; 1) returns: Linear combination from H. function CG-Reg(X; repeat Let [d; d ] be the solution of (8) using t 1 hypotheses until Let [; b] be the dual solution to [d; d ], i.e. a solution to (7) return SILP or the sequence of intermediate solutions (d; d ) has at least one accumulation point and each of these solves the dual regression SILP. This theorem holds for a more general set of exchange methods than Algorithm 1. For example, it is possible to add or drop multiple constraints at each iteration, and the convergence result is unchanged. In practice, we found the column generation algorithm stops at an optimal solution in a small number of iterations for both LP and SILP regression problems. 4.2. A Barrier Algorithm In the following we propose an algorithm (see also Ratsch et al., 2000) that uses the barrier optimization technique (Bertsekas, 1995; Frisch, 1994). For details on the connection between Boosting-type algorithms and barrier methods see Ratsch et al. (2000, 2001). A similar algorithm has been proposed in Duy and Helmbold (2000), which has been developed independently. In this sequel, we will give a very brief introduction to barrier optimization. The goal of barrier optimization is to nd an optimal solution of the problem min 2S f(), where f is a convex function over a non-empty convex set of feasible solutions. This problem can be solved using a so called barrier function (e.g. Bertsekas, 1995; Cominetti & Dussault, 1994; Mosheyev & Zibulevsky, 1999; Censor Zenios, 1997), the exponential barrier being a particularly useful G. Ratsch, A. Demiriz and K.P. Bennett choice for our purposes, exp being a penalty parameter. By nding a sequence of (uncon- strained) minimizers f t g t to (18), using any sequence f t g t with these minimizers can be shown to converge to a global solution of the original problem, i.e. it holds: min min The barrier minimization objective for the problem (7) using the exponential barrier can be written as: exp for simplicity we have omitted the constraints 0. The rst line in (20) is the objective of (7), the second line corresponds to the constraints n ; The last line implements the constraints - n n . Note that by setting r E 0, we can nd the minimizing slack variables ; of (20) for given , and b. Thus, the problem of minimizing (20) is greatly simplied, as there are 2N variables less to optimize. In this section, we propose an algorithm (cf. Algorithm 2) that { similar to the column generation approach of the last section { solves a sequence of optimization problems, the so called restricted master problems. In each iteration t of the algorithm, one selects a hypothesis and then solves (or approximately solves) an unconstrained optimization problem in t These variables are the t hypothesis coe-cients of the previous iterations, the bias b and the tube size ". The solution of the restricted master problem with respect to the master problem 1 is clearly suboptimal and one cannot easily apply (19). However, it is known how fast one can decrease if the intermediate 1 The (full) master problem has J Sparse Regression Ensembles 17 Algorithm 2 The Barrier-Regression algorithm argument:Sample Number of iterations T, Regularization constant C Tube parameter 2 (0; 1) constants: start > 0 returns: Linear combination from H. function BarReg(X; do endfor if endfor return solutions are suboptimal (cf. Proposition 1 in Cominetti & Dussault, 1994; Ratsch et al., 2000): Roughly speaking one has to ensure that to achieve the desired convergence in the sense of (19), where the gradient is taken with respect to all variables. The base learner needs to nd a hypothesis with a large edge as such hypotheses correspond to violated constraints in the dual problem. Whereas in the classication case the maximum edge is minimized, we have in regression just that all edges have to be below 1. Therefore, we dene the corrected edge with respect to the constraint which is positive, if the constraint is violated. We now consider the case where the base learner nds a hypothesis, which is only -optimal with respect to the corrected edge. By this we mean that it nds a hypothesis that is not much worse than the best hypothesis in H, i.e. for some constant - 2 (0; 1]. Note that the correction in the edge comes from the regularization term kk 1 . Then we get: G. Ratsch, A. Demiriz and K.P. Bennett Lemma 8. While running Algorithm 2 using a base learner satisfying (21), the barrier parameter is decreased only if -krE k 1 , where the gradient is taken with respect to all variables "; b; Proof. The gradient of E with respect to " and b is always zeros as they are unbounded variables in the minimization in line \+". The gradient of E with respect to j is ")=). We have two cases: The hypothesis is already in the restricted master problem: If line \+") we get j 0 or if r j Note that the case r j happen. Thus, the gradient projected on the feasible set ( 0) is always zero. The hypothesis has not already been included: If r j the last constraint in (8) is violated for j and the hypothesis h j needs to be included in the hypothesis set. Thus, one can exploit the property (21) of the base learner to upper-bound the gradient of the master problem at the current solution. If the learner returns a hypothesis by (21) there does not exist another hypothesis with an edge larger than by a factor of . Assume there exists a violated constraint. Then by line \", is decreased if -krE k 1 Using this Lemma one gets the desired convergence property of Algorithm 2: Theorem 9. Assume H is nite and the base learner L satises condition (21). Then for T !1 the output of the algorithm converges to a global solution of (7). Proof. Let E be given by (20). By Proposition 1 of (Cominetti & Dus- sault, 1994) (see Ratsch et al., 2000), one knows that any accumulation point of a sequence f t g t satisfying kr E t global solution of (7). By Lemma 8 we have that is decreased only if > -krE k 1 . If is not decreased, the gradient will be reduced in a nite number of iterations such that -krE k 1 < . Thus ! 0 and Sparse Regression Ensembles 19 Similar conditions can be used to prove the convergence of Algorithm 1 in the case of non-optimal base learners in the sense of (21). Barrier methods have also been applied to semi-innite programming problems. In Kaliski et al. (1999) a similar barrier algorithm using the log-barrier has been used (cf. also Mosheyev & Zibulevsky, 1999). It is future work to rigorously prove that Algorithm 2 also converges to the optimal solution when the hypothesis space is innite. The algorithms proposed here are incomplete without descriptions of the base hypothesis space and the base learner algorithm. In the next section, we consider choices of the hypothesis space and base learner, and how they eect the algorithms. 4.3. Choice of Hypothesis Space and Base Learner Recall that both algorithms require the hypothesis h p that solves or approximately solves So the question is how do we solve this for dierent types of base learners. If the set of base learners is compact, then this maximum must exist. 4.3.1. Kernel functions Suppose we wish to construct ensembles of functions that themselves are linear combinations of other functions (e.g. of kernel functions) using coe-cient , i.e. functions of the form k n () k(x n ; The set fh g is an innite hypothesis set and is unbounded, if is unbounded. So, one has to restrict { here we consider bounding the ' 1 - norm of by some constant, e.g. H := fh g. Then the problem (22) has a closed form solution: Let j be the maximum absolute sum of the kernel values weighted by p: with is a solution to (22), where P N . This means, if we boost linear combinations of kernel functions bounded by the ' 1 -norm of , then we will G. Ratsch, A. Demiriz and K.P. Bennett be adding in exactly one kernel basis function k(x j ; ) per iteration. The resulting problem will be exactly the same as if we were optimizing a SVM regression LP (e.g. Smola et al., 1999) in the rst place. The only dierence is that we have now dened an algorithm for optimizing the function by adding one kernel basis at a time. So while we posed this problem as a semi-innite learning problem it is exactly equivalent to the nite SVM case where the set of hypotheses being boosted is the individual kernel functions k(x If the were bounded using dierent norms then this would no longer be true. We would be adding functions that were the sum of many kernel functions (for using the ' 2 -norm, see Ratsch et al., 2000a). Likewise, if we performed an active kernel strategy, where the set of kernels is parameterized over some set then the algorithm would change. We consider this problem in the next section. 4.3.2. Active Kernel Functions Now consider the case where we chose a set of (kernel) functions parameterized by some vector . By the same argument above, if we impose the bound k need only consider one such basis function at a time. But in this case since the kernel is parameterized over a set of continuous values , we will have an innite set of hypothesis. Say for example we wish to pick the a RBF kernel with parameters (the center) and 2 (the variance), i.e. we chose the hypothesis function exp with parameters that maximize the correlation between weight p and the output (the so-called edge), i.e. With reasonable assumptions, this is a bounded function that is in p. Thus all of the above results for the semi-innite case hold. There are several ways to e-ciently nd ^ . The straight-forward way is to employ some standard nonlinear optimization technique to maximize (24). However, for RBF kernels with xed variance 2 there is a fast and easy to implement EM-like strategy. By setting and Z is a normalization factor such that 1. By this update, we are computing the weighted center of the data, where the weights Sparse Regression Ensembles 21 depend on p. Note, for given vector q, one can compute (M-step) the optimal center . However, q depends on and one has to iteratively recompute q (E-step). The iteration can be stopped, if does not change anymore. As the objective function has local minima, one may start at a random position, e.g. at a random training point. 4.3.3. SVM Classication Functions Here we consider the case of using a linear combination of classica- tion functions whose output is 1 to form a regression function. An example of such an algorithm is the Tree-Boost algorithm of Friedman 1999). For absolute error functions, Tree-Boost constructs a classication tree where the class of each point is taken to be the sign of the residual of each point, i.e. points that are overestimated are assigned to class -1 and points that are underestimated are assigned to class 1. A decision tree is constructed, then based on a projected gradient descent technique with an exact line-search, each point falling in a leaf node is assigned the mean value of the dependent variables of the training data falling at that node. This corresponds to a dierent t for each node of the decision tree. So at each iteration, the virtual number of hypotheses added in some sense corresponds to the number of leaf nodes of the decision tree. Here we will take a more simplied view and consider one node decision trees where the decision trees are linear combinations of the data. Specically our decision function at each node is f(x; b). Thus at each iteration of the algorithm we want to w;b Note that there are only nitely many ways to label N points so this is a nite set of hypotheses. There are innitely many possible (w; b) but any that produce the same objective value are equivalent to the boosting algorithm. The question is how to practically optimize such a problem. Clearly an upper bound on the best possible value of the above equation is obtained by any (w; b) solution satisfying So in some sense, we can consider the sign(p n ) to be the desired class of x n . Now it frequently may not be possible to construct such a f . Each x n that is misclassied will be penalized by exactly jp n j. Thus we can think of jp n j as the misclassication cost of x n . Given these classes, and misclassication weights, we can use any weight sensitive classication algorithm to construct a hypothesis. 22 G. Ratsch, A. Demiriz and K.P. Bennett In this study we used the following problem converted into LP form to construct f : with sign(p n )(hw; x becomes a parameter of the problem. Some interesting facts about this formulation. The choice of - controls the capacity of the base learners to t the data. For a xed choice of -, classication functions using a relatively xed number of w d nonzero. So the user can determine based on experimentation on the training data, how - eects the complexity of the base hypothesis. Then the user may x - according to the desired complexity of the base hypothesis. Alternatively, a weighted variation of -SVMs (Scholkopf et al., 2000) could be used to dynamically chose -. Like in TreeBoost, we would like to allow each side of the linear decision to have a dierent weight. We describe the changes required to Algorithm 1 to allow this. At each iteration, LP (26) is solved to nd a candidate hypothesis instead of adding a single column to the restricted master LP (12), two columns are added. The rst column is and the second column is h 0). The algorithms stop if both of these hypotheses do not meet the criteria given in the algorithm. The algorithm should terminate if 2. We call this variant of the algorithm CG-LP. This change has no eect on the convergence properties. 5. Experiments In this section we present some preliminary results indicating the feasibility of our approaches. We will start in Section 5.1 with showing some basic properties of the CG and barrier algorithms for regression. We show that both algorithms are able to produce excellent ts on a noiseless and several noisy toy problems. As base learners we use the three proposed in Section 4.3. We will denote by CG-k, CG-ak and CG-LP, the CG algorithms using RBF kernels, active RBF kernels and classication functions as base learners, respectively. Likewise for Bar-k, Bar-ak and Bar-LP using the barrier algorithm. Not all of these possible combinations have been implemented. Sparse Regression Ensembles 23 To show the competitiveness of our algorithms we performed a benchmark comparison in Section 5.2 on time-series prediction problems that have been extensively studied in the past. Moreover, we give an interesting application to a problem derived from computer-aided drug-design in Section 5.3. There, we in particular show that the approach using classication functions as base learner is very well suited for datasets where the dimensionality of the problem is high, but the number of samples is very small. 5.1. An Experiment on toy data To illustrate (i) that the proposed regression algorithm converges to the optimal (i.e. zero error) solution and (ii) is capable of nding a good t to noisy data (signal:noise=2:1) we applied it to a toy example { the frequently used sinc function in the range [ 2; 2]. For our demonstration (cf. Fig. 1) we used two base hypothesis spaces: (i) RBF kernels in the way described in Section 4.3.1, i.e. with classication functions as described in Section 4.3.3. In the rst case we used the CG and the Barrier approch { leading to the algorithms CG-k and Bar-k. The latter case is included for demonstration purposes only, the CG-LP is designed for high-dimensional data sets and does not perform well in low dimensions due to the severely restricted nature of the base hypothesis set. To keep the results comparable between dierent data sets we use a normalized measure of error { the Q 2 -error (also called normalized mean squared error), which is dened as: is meaningless since simply predicting the mean target value will result in a Q 2 -value of one. Let us rst consider the case of RBF-kernels. In the noise-free case (left panel of Fig. 1) we observe { as expected from Proposition 2 { that the (automatically determined) tube size " is very small (0.0014), while it is kept large (0.12) for the high noise case (right panel). Using the right tube size, one gets an almost perfect t (Q the noise-free case and an excellent t in the noisy case (Q { without re-tuning the parameters. The CG-LP produced a piecewise-constant function based on only two classication functions. The same solution of produced in both the noisy and noise-free cases. Interestingly in the noisy G. Ratsch, A. Demiriz and K.P. Bennett Figure 1. Toy example: The left panel shows the t of the sinc function without noise using RBF-kernels (solid) and classication functions (dashed). The solid t is almost perfect (Q while the dashed function is too simple (Q The right panel shows a t using RBF-kernels (Q on noisy data (sig- 100). The tube size is automatically adapted by the algorithm (right)), such that a half of the patterns lie inside the tube case it produces almost an identical function. Because the hypothesis space only consists of linear classication functions constructed by LP (26), the set of base hypothesis is extremely restricted. Thus high bias, but low variance behavior can be expected. We will see later than on high dimensional datasets the CG-LP can perform quite well. Let us now compare the convergence speed of CG- and Barrier- Regression in the controlled setting of this toy example. For this we run both algorithms and record the objective values of the restricted master problem. In each iteration of the barrier algorithm one has to nd the minimizing or almost minimizing parameters (; "; b) of the barrier function E for the restricted master problem. In our implementation we use an iterative gradient descent method, where the number of gradient steps is a parameter of the algorithm. The result is shown in Fig. 2. One observes that both algorithms converge rather fast to the optimal objective value (dotted line). The CG algorithm converges faster than the barrier algorithm, as in the barrier parameter usually decreases not quick enough to compete with the very e-cient Simplex method. However, if the number of gradient descent steps is large enough (e.g. 20), the barrier algorithm produces comparable results in the same number of iterations. Note that if one does only one gradient descent step per iteration, this approach is similar to the algorithm proposed in Collins et al. (2000) that uses parallel coordinate descent steps (similar to Jacobi iterations). Sparse Regression Ensembles 25 Objective value Iteration replacements Objective value Iteration Figure 2. Convergence on the toy example: The convergence of the objective function CG-Regression (solid) and Barrier-Regression to the optimal value (dotted) over the number of iterations. Left for no noise and right for large normal noise 1). For Barrier-Regression we did 1 (dash-dotted) and 20 (dashed) gradient descent steps in each iteration, respectively. We used 5.2. Time Series Benchmarks In this section we would like to compare our new methods to SVMs and RBF networks. For this we chose two well-known data sets that have been frequently used as benchmarks on time-series prediction: (i) the Mackey-Glass chaotic time series (Mackey & Glass, 1977) and (ii) data set D from the Santa Fe competition (Weigend & N.A. Gershenfeld (Eds.), 1994). We x the following experimental setup for our comparison. We use seven dierent models for our comparison: three models that have been used in Muller et al. (1999) (RBF nets and SVM- Regression (SVR) with linear and Huber loss) and four new models: CG-k, CG-ak, Bar-k and Bar-ak. All models are trained using a simple cross validation technique. We choose the model with the minimum prediction error measured on a randomly chosen validation set (originally taken from Muller et al., 1999). The data including our experimental results can be obtained from http://ida.first.gmd.de/~raetsch/data/ts. 5.2.1. Mackey Glass Equation Our rst application is a high-dimensional chaotic system generated by the Mackey-Glass delay dierential equation dt 26 G. Ratsch, A. Demiriz and K.P. Bennett with delay t originally introduced as a model of blood cell regulation (Mackey & Glass, 1977) and became quite common as an articial forecasting benchmark. After integrating (28), we added noise to the time series. We obtained training (1000 patterns) and validation (the following 194 patterns) sets using an embedding dimension 6. The test set (1000 patterns) is noiseless to measure the true prediction error. We conducted experiments for dierent signal to noise ratios 2 (SNR) using uniform noise. In Table II we state the results given in the original paper (Muller et al., 1999) for SVMs using "-insensitive loss and Huber's robust loss (quadratic/linear) and RBF networks. Moreover, we give the results for the CG and the barrier algorithm using RBF kernels and active RBF-kernels. 3 We also applied the CG algorithm using classication functions (CG-LP), but the algorithm performed very poorly (Q 2 0:16), because it could not generate complex enough functions. From Table II we observe that all four algorithms perform on average as good as the best of the other algorithms (in 11 cases better and in 13 cases worse). The 100 step prediction at low noise levels is rather poor compared to SVMs, but it is great on the higher noise levels. Note that the CG and the barrier algorithm do not perform significantly dierent (CG is in 5 cases better and in 7 cases worse). This shows that the simple barrier implementation given in Algorithm 2 achieves a high enough accuracy to compete with a sophisticated simplex implementation used in the CG-algorithms. 5.2.2. Data Set D from the Santa Fe Competition Data set D from the Santa Fe competition is articial data generated from a nine-dimensional periodically driven dissipative dynamical system with an asymmetrical four-well potential and a slight drift on the parameters (Weigend & N.A. Gershenfeld (Eds.), 1994). The system has the property of operating in one well for some time and then switching to another well with a dierent dynamical behavior. Therefore, we rst segment the time series into regimes of approximately stationary dynamics. This is accomplished by applying the Annealed Competition of Experts (ACE) method described in Pawelzik et al. (1996), Muller et al. (1995) (no assumption about the number of stationary subsystems was made). Moreover, in order to reduce the eect of the continuous We dene the SNR in this experiment as the ratio between the variance of the noise and the variance of the data. 3 On the entries set as italic, the model selection failed completely. In this case we selected the model manually by chosing the model on the 10th percentile of the test errors over all tested models. Sparse Regression Ensembles 27 drift, only the last 2000 data points of the training set are used for segmentation. After applying the ACE algorithm, the data points are individually assigned to classes of dierent dynamical modes. We then select the particular class of data that includes the data points at the end of Data Set D as the training set. 4 This allows us to train our models on quasi-stationary data and we avoid having to predict the average over all dynamical modes hidden in the full training set (see also Pawelzik et al. (1996) for further discus- sion). However, at the same time we are left with a rather small training set requiring careful regularization, since there are only 327 patterns in the extracted training set. As in the previous section we use a validation set (50 patterns of the extracted quasi-stationary data) to determine the model parameters of SVMs, RBF networks and CG-Regression. The embedding parameters used, are the same for all the methods compared in Table III. Table III shows the errors (Q 2 -value) for the 25 step iterated predic- tion. 5 In the previous result of (Muller et al., 1999) the Support vector machine with "-ins. loss is 30% better than the one achieved by Pawelzik et al. (Pawelzik et al., 1996). This is the current record on this dataset. Given that it is quite hard to beat this record, our methods perform 4 Hereby we assume that the class of data that generated the last points in the training set is the one that is also responsible for the rst couple of steps of the iterated continuation that we aim to predict. 5 Iterated prediction means that based on the past predictions (and not on the original data) the new prediction is computed. Table II. 1S denotes the 1-step prediction error (Q 2 ) on the test set. 100S is the 100-step iterated autonomous prediction. \SNR" is the ratio between the variance of the respective noise and the underlying time series. SNR 6.2% 12.4% 18.6% test error 1S 100S 1S 100S 1S 100S SVM "-ins. 0.0007 0.0158 0.0028 0.0988 0.0057 0.4065 28 G. Ratsch, A. Demiriz and K.P. Bennett quite well. CG-ak improves the result in Pawelzik et al. (1996) by 28%, while CG-k is 26% better. 6 This is very close to the previous result. The model-selection is a crucial issue for this benchmark competition. The model, which is selected on the basis of the best prediction on the 50 validation patterns, turns out to be rather suboptimal. Thus, more sophisticated model selection methods are needed here to obtain more reliable results. Table III. Comparison (under competition condi- tions) of 25 step iterated predictions (Q 2 -value) on Data set D. A prior segmentation of the data according to (Muller et al., 1995; Pawelzik et al., 1996) was done as preprocessing. CG SVM Neural Net CG-k CG-ak "-ins. Huber RBF PKM 5.3. Experiments on Drug data This data set is taken from computer-aided drug design. The goal is to predict bio-reactivity of molecules based on molecular structure through the creation of Quantitative Structure-Activity Relationship models. Once a predictive model has been constructed, large databases can be screened cost eectively for desirable chemical prop- erties. Then this small subset of molecules can then be tested further using traditional laboratory techniques. The target of this dataset LC- CKA is the logarithm of the concentration of each compound that is required to produce 50 percent inhibition of site \A" of the Cholecys- tokinin (CCK) molecule. These CCK and CCK-like molecules serve important roles as neuro-transmitters and/or neuro-modulators. 66 compounds were taken from the Merck CCK inhibitor data set. The dataset originally consisted of 323 descriptors taken from a combination of \traditional" 2D, 3D, and topological properties and electron density derived TAE (Transferable Atomic Equivalent) molecular descriptors derived using wavelets (Brenema et al., 2000). All data was scaled to be between 0 and 1. The data can be obtained from http://www.rpi.edu/ ~bennek. It is well known that appropriate feature selection on this dataset and others is essential for good performance of QSAR models due to the 6 We have not performed experiments with the barrier algorithm on this data, since the performance is expected to be similar. Sparse Regression Ensembles 29 small amount of available data with known bio-reactivity and the large number of potential descriptors, see for example (Embrechts et al., 1998). In an unrelated study (Bennett et al., 2001) feature selection was done by constructing a ' 1 -norm linear support vector regression machine (like in equation (6) but where the features are the input dimensions) to produce a sparse weighting of the descriptors. Only the descriptors with positive weights were retained. We take the reduced set of 39 descriptors as given. We refer to the full data set as LCCKA and the reduced dataset as LCCKA-R. The typical performance measured used to evaluate QSAR data is the average sum squared error between the predicted and true target values divided by the true target variance. This is Q 2 as dened in (27). A Q 2 of less than 0:3 is considered very good. To measure the perfor- mance, 6-fold cross validation was performed. We report the out-of- sample averaged over the 6 folds. In this preliminary study, model-selection using parameter selection techniques was not performed. As models we consider CG-LP (CG with classication functions) and CG- k (CG with non-active kernels) described in Sections 4.3.3 and 4.3.1. For CG-k, we used only three dierent values for the regularization constant C, the tube-parameter and the parameter of the base learner (kernel-width) and - (complexity parameter in (26)), respectively. Thus, we examined 27 dierent parameter combinations. For CG-LP, we used parameter values found to work well on a reduced dataset in Bennett et al. (2001) and then chose C and - such that the number of hypotheses and attributes per hypothesis were similar on the training data. Research is in progress to repeat these studies using a more appropriate model selection technique { leave-one-out cross validation. Model selection is critical for performance of these methods, thus e-cient model selection techniques is an important open question that needs to be addressed. First we tried CG-k on the full data set LCCKA, but it failed to achieve good performance (Q while the simple approach CG- LP performed quite well with 0:33. This is because CG-LP is able to select the discriminative features based on subsets of the attributes, while the kernel-approaches get confused by the uninformative features. For the reduced set LCCKA-R, where the features are already pre- selected, the kernel approach improves signicantly (Q is not signicantly dierent than CG-LP methods produced sparse ensembles. On the full dataset, using parameters CG-LP used on average ensembles containing 22 hypotheses consisting of, on average, 10:1 of the possible 323 attributes, while CG-k with RBF-kernel used 45 hypotheses. On the reduced G. Ratsch, A. Demiriz and K.P. Bennett dataset, using parameters used on average ensembles containing 23:5 hypotheses consisting of, on average, 10:7 attributes, while the CG-k approach used on average 30:3 hypotheses 0:1). The slight dierence between CG-LP and CG-k might be explained again by the presence of uninformative features. Summarizing, the CG-LP approach seems to be a very robust method to learn simple regression functions in high-dimensional spaces with automatic feature selection. 6. Conclusion In this work we examined an LP for constructing regression ensembles based on the ' 1 -norm regularized -insensitive loss function used for support vector machines rst proposed for ensembles of nite hypothesis sets in Smola et al. (1999). We used the dual formulation of the nite regression LP: (i) to rigorously dene a proper extension to the innite hypothesis case and (ii) to derive two e-cient algorithms for solving them. It is shown theoretically and empirically that even if the hypothesis space is innite, only a small nite set of the hypotheses is needed to express the optimal solution (cf. Corollary 4). This sparseness is possible due to the use of the ' 1 -norm of the hypothesis coe-cient vector, which acts as a sparsity-regularizer. We proposed two dierent algorithms for e-ciently computing optimal nite ensembles. Here, the base-learner acts as an oracle to nd the constraints in the dual semi-innite problem that are violated. For the rst algorithm (the CG algorithm for regression), which is based on a simplex method, we proved the convergence for the innite case (cf. Theorem 7). The second algorithm { the Barrier algorithm for Regression { is based on an exponential barrier method that has connections to the original AdaBoost method for classication (cf. Ratsch et al., 2000). This algorithm converges for nite hypothesis classes (cf. Theorem 9). Using recent results in the mathematical programming literature (e.g. Mosheyev & Zibulevsky, 1999; Kaliski et al., 1999) we claim that it is possible to generalize it to the innite case. Computationally both algorithms nd a provably optimal solution in a small number of iterations. We examined three types of base learning algorithms. One, based on boosting kernel functions chosen from a nite dictionary of ker- nels, is an example of a nite hypothesis set. We also consider active kernel methods where the kernel basis are selected from an innite dictionary of kernels. Finally, we consider the case using the nite set of linear classication functions constructed using an LP. This is a Sparse Regression Ensembles 31 very limited hypothesis space that is specically designed to work on underdetermined high-dimensional problems such as the drug design data discussed in this paper. Our preliminary simulations on toy and real world data showed that the proposed algorithms behave very well in both nite and innite cases. In a benchmark comparison on time-series prediction problems our algorithms perform as well as the current state of the art regression methods such as support vector machines for regression. In the case of \Data set D" of the Santa Fe competition we obtained results that are as good as the current record (by SVM) on this dataset. The LP classication-based approach worked extremely well on the high-dimensional drug design datasets, since the algorithm inherently performs feature selection essential for success on such datasets. The primary contribution of this paper has been a theoretical and conceptual study of LP-based ensemble regression algorithms in nite and innite hypothesis spaces. For future work we plan a more rigorous investigation of the computational aspects of our approach. One open question is how to best perform selection of the LP model parame- ters. Another open question involves the best algorithmic approaches for solving the semi-innite linear program. While they work well in practice, the column generation and barrier interior-point methods described here are not the current state of the art for semi-innite linear programming. A primal-dual interior point algorithm may perform even better both theoretically and empirically especially on very large datasets. Lastly, the ability to handle innite hypothesis sets opens up the possibility of many other possible types of base learning algorithms. Acknowledgments G. Ratsch would like to thank Sebastian Mika, Klaus-R. Muller, Bob Williamson and Manfred Warmuth for valuable discussions. This work was partially funded by DFG under contracts JA 379/91, JA 379/71 and MU 987/1-1 and by the National Science Foundation under Grant No. 970923 and No. 9979860. --R An empirical comparison of voting classi A boosting algorithm for regression. Nonlinear Programming. Parsimonious least norm approximation. Prediction games and arcing algorithms. Wavelet representations of molecular electronic properties: Applications in adme Parallel Optimization: Theory Atomic decomposition by basis pursuit. Adaboost and logistic regression uni A stable exponential penalty algorithm with superlinear convergence. An experimental comparison of three methods for constructing ensembles of decision trees: Bagging computationally intelligent data mining for the automated design and discovery of novel pharmaceuticals. A simple cost function for boost- ing Game theory A decision-theoretic generalization of on-line learning and an application to boosting Experiments with a new boosting algorithm. Additive logistic regression: a statistical view of boosting. Greedy function approximation. The logarithmic potential method of convex pro- gramming Logarithmic barrier decomposition methods for semi-in nite programming Submitted to Elsevier Science. Boosting as entropy projection. Linear and Nonlinear Programming (second edition). Oscillation and chaos in physiological control systems. An empirical evaluation of bagging and boosting. Improved generalization through explicit optimization of margins. Functional gradient techniques for combining hypotheses. Advances in Kernel Methods Boosting the margin: a new explanation for the e New support vector algorithms. AdaBoosting neural networks. In Gerstner Learning with Kernels. The nature of statistical learning theory. Time Series Pre- diction: Forecasting the Future and Understanding the Past A gradient-based boosting algorithm for regression problems --TR --CTR Gilles Blanchard , Gbor Lugosi , Nicolas Vayatis, On the rate of convergence of regularized boosting classifiers, The Journal of Machine Learning Research, 4, 12/1/2003 Pierre Geurts , Louis Wehenkel , Florence d'Alch-Buc, Gradient boosting for kernelized output spaces, Proceedings of the 24th international conference on Machine learning, p.289-296, June 20-24, 2007, Corvalis, Oregon Jinbo Bi , Tong Zhang , Kristin P. Bennett, Column-generation boosting methods for mixture of kernels, Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining, August 22-25, 2004, Seattle, WA, USA Kristin P. Bennett , Michinari Momma , Mark J. Embrechts, MARK: a boosting algorithm for heterogeneous kernel models, Proceedings of the eighth ACM SIGKDD international conference on Knowledge discovery and data mining, July 23-26, 2002, Edmonton, Alberta, Canada P. M. Granitto , P. F. Verdes , H. A. Ceccatto, Neural network ensembles: evaluation of aggregation algorithms, Artificial Intelligence, v.163 n.2, p.139-162, April 2005 Peter Bhlmann , Bin Yu, Sparse Boosting, The Journal of Machine Learning Research, 7, p.1001-1024, 12/1/2006 Gunnar Rtsch , Manfred K. Warmuth, Efficient Margin Maximizing with Boosting, The Journal of Machine Learning Research, 6, p.2131-2152, 12/1/2005 Sren Sonnenburg , Gunnar Rtsch , Christin Schfer , Bernhard Schlkopf, Large Scale Multiple Kernel Learning, The Journal of Machine Learning Research, 7, p.1531-1565, 12/1/2006 Robust Loss Functions for Boosting, Neural Computation, v.19 n.8, p.2183-2244, August 2007 Sebastian Mika , Gunnar Rtsch , Jason Weston , Bernhard Schlkopf , Alex Smola , Klaus-Robert Mller, Constructing Descriptive and Discriminative Nonlinear Features: Rayleigh Coefficients in Kernel Feature Spaces, IEEE Transactions on Pattern Analysis and Machine Intelligence, v.25 n.5, p.623-633, May Gunnar Rtsch , Sebastian Mika , Bernhard Schlkopf , Klaus-Robert Mller, Constructing Boosting Algorithms from SVMs: An Application to One-Class Classification, IEEE Transactions on Pattern Analysis and Machine Intelligence, v.24 n.9, p.1184-1199, September 2002 Ron Meir , Gunnar Rtsch, An introduction to boosting and leveraging, Advanced lectures on machine learning, Springer-Verlag New York, Inc., New York, NY,
boosting;semi-infinite programming;ensemble learning;regression;sparseness
599689
Logistic Regression, AdaBoost and Bregman Distances.
We give a unified account of boosting and logistic regression in which each learning problem is cast in terms of optimization of Bregman distances. The striking similarity of the two problems in this framework allows us to design and analyze algorithms for both simultaneously, and to easily adapt algorithms designed for one problem to the other. For both problems, we give new algorithms and explain their potential advantages over existing methods. These algorithms are iterative and can be divided into two types based on whether the parameters are updated sequentially (one at a time) or in parallel (all at once). We also describe a parameterized family of algorithms that includes both a sequential- and a parallel-update algorithm as special cases, thus showing how the sequential and parallel approaches can themselves be unified. For all of the algorithms, we give convergence proofs using a general formalization of the auxiliary-function proof technique. As one of our sequential-update algorithms is equivalent to AdaBoost, this provides the first general proof of convergence for AdaBoost. We show that all of our algorithms generalize easily to the multiclass case, and we contrast the new algorithms with the iterative scaling algorithm. We conclude with a few experimental results with synthetic data that highlight the behavior of the old and newly proposed algorithms in different settings.
INTRODUCTION We give a unified account of boosting and logistic regression in which we show that both learning problems can be cast in terms of optimization of Bregman distances. In our frame- work, the two problems become extremely similar, the only real difference being in the choice of Bregman distance: un-normalized relative entropy for boosting, and binary relative entropy for logistic regression. The fact that the two problems are so similar in our frame-work allows us to design and analyze algorithms for both si- multaneously. We are now able to borrow methods from the maximum-entropy literature for logistic regression and apply them to the exponential loss used by AdaBoost, especially convergence-proof techniques. Conversely, we can now easily adapt boosting methods to the problem of minimizing the logistic loss used in logistic regression. The result is a family of new algorithms for both problems together with convergence proofs for the new algorithms as well as AdaBoost. For both AdaBoost and logistic regression, we attempt to choose the parameters or weights associated with a given family of functions called features or weak hypotheses. AdaBoost works by sequentially updating these parameters one by one, whereas methods for logistic regression,most notably iterative scaling [9, 10], are iterative but update all parameters in parallel on each iteration. Our first new algorithm is a method for optimizing the exponential loss using parallel updates. It seems plausible that a parallel-update method will often converge faster than a sequential-update method, provided that the number of features is not so large as to make parallel updates infeasible. Some preliminary experiments suggest that this is the case. Our second algorithm is a parallel-update method for the logistic loss. Although parallel-update algorithms are well known for this function, the updates that we derive are new, and preliminary experiments indicate that these new updates may also be much faster. Because of the unified treatment we give to the exponential and logistic loss functions, we are able to present and prove the convergence of the algorithms for these two losses simultaneously. The same is true for the other algorithms presented in this paper as well. We next describe and analyze sequential-update algorithms for the two loss functions. For exponential loss, this algorithm is equivalent to the AdaBoost algorithm of Freund and Schapire [13]. By viewing the algorithm in our frame- work, we are able to prove that AdaBoost correctly converges to the minimum of the exponential loss function. This is a new result: Although Kivinen and Warmuth [16] and Mason et al. [19] have given convergence proofs for AdaBoost, their proofs depend on assumptions about the given minimization problem which may not hold in all cases. Our proof holds in general without assumptions. Our unified view leads instantly to a sequential-update algorithm for logistic regression that is only a minor modification of AdaBoost and which is very similar to one proposed by Duffy and Helmbold [12]. Like AdaBoost, this algorithm can be used in conjunction with any classification algorithm, usually called the weak learning algorithm, that can accept a distribution over examples and return a weak hypothesis with low error rate with respect to the distribution. How- ever, this new algorithm provably minimizes the logistic loss rather than the arguably less natural exponential loss used by AdaBoost. Another potentially important advantage of this new algorithm is that the weights that it places on examples are bounded in [0; 1]. This suggests that it may be possible to use the new algorithm in a setting in which the boosting algorithm selects examples to present to the weak learning algorithm by filtering a stream of examples (such as a very large dataset). As pointed out by Watanabe [22] and Domingo and Watanabe [11], this is not possible with AdaBoost since its weights may become extremely large. They provide a modification of AdaBoost for this purpose in which the weights are truncated at 1. The new algorithm may be a viable and cleaner alternative. We next describe a parameterized family of iterative algorithms that includes both parallel- and sequential-update algorithms and that also interpolates smoothly between the two extremes. The convergence proof that we give holds for this entire family of algorithms. Although most of this paper considers only the binary case in which there are just two possible labels associated with each example, it turns out that the multiclass case requires no additional work. That is, all of the algorithms and convergence proofs that we give for the binary case turn out to be directly applicable to the multiclass case without modification. For comparison,we also describe the generalized iterative scaling algorithm of Darroch and Ratcliff [9]. In rederiving this procedure in our setting, we are able to relax one of the main assumptions usually required by this algorithm. The paper is organized as follows: Section 2 describes the boosting and logistic regression models as they are usually formulated. Section 3 gives background on optimization using Bregman distances, and Section 4 then describes how boosting and logistic regression can be cast within this framework. Section 5 gives our parallel-update algorithms and proofs of their convergence, while Section 6 gives the sequential-update algorithms and convergence proofs. The parameterized family of iterative algorithms is described in Section 7. The extension to multiclass problems is given in Section 8. In Section 9, we contrast our methods with iterative scaling. In Section 10, we give some preliminary experiments. Previous work. Variants of our sequential-update algorithms fit into the general family of "arcing" algorithms presented by Breiman [4, 3], as well as Mason et al.'s ``AnyBoost'' family of algorithms [19]. The information-geometric view that we take also shows that the algorithms we study, including AdaBoost, fit into a family of algorithms described in 1967 by Bregman [2] for satisfying a set of constraints. Our work is based directly on the general setting of Laf- ferty, Della Pietra and Della Pietra [18] in which one attempts to solve optimization problems based on general Bregman distances. They gave a method for deriving and analyzing parallel-update algorithms in this setting through the use of auxilliary functions. All of our algorithms and convergence proofs are based on this method. Our work builds on several previous papers which have compared boosting approaches to logistic regression. Fried- man, Hastie and Tibshirani [14] first noted the similarity between the boosting and logistic regression loss functions, and derived the sequential-update algorithm LogitBoost for the logistic loss. However, unlike our algorithm, theirs requires that the weak learner solve least-squares problems rather than classification problems. Another sequential-update algorithm for a different but related problem was proposed by Cesa-Bianchi, Krogh and Warmuth [5]. Duffy and Helmbold [12] gave conditions under which a loss function gives a boosting algorithm. They showed that minimizing logistic loss does lead to a boosting algorithm in the PAC sense, which suggests that our algorithm for this problem, which is very close to theirs, may turn out also to have the PAC boosting property. Lafferty [17] went further in studying the relationship between logistic regression and the exponential loss through the use of a family of Bregman distances. However, the setting described in his paper apparently cannot be extended to precisely include the exponential loss. The use of Bregman distances that we describe has important differences leading to a natural treatment of the exponential loss and a new view of logistic regression. Our work builds heavily on that of Kivinen and Warmuth [16] who, along with Lafferty, were the first to make a connection between AdaBoost and information geometry. They showed that the update used by AdaBoost is a form of "entropy projection." However, the Bregman distance that they used differed slightly from the one that we have chosen (normalized relative entropy rather than unnormalized relative entropy) so that AdaBoost's fit in this model was not quite complete; in particular, their convergence proof depended on assumptions that do not hold in general. Kivinen and Warmuth also described updates for general Bregman distances including, as one of their examples, the Bregman distance that we use to capture logistic regression. BOOSTING, LOGISTIC MODELS AND LOSS FUNCTIONS be a set of training examples where each instance x i belongs to a domain or instance space X , and each label y We assume that we are also given a set of real-valued functions on Following convention in the MaxEnt literature, we call these functions features; in the boosting literature, these would be called weak or base hypotheses. We study the problem of approximating the y i 's using a linear combination of features. That is, we are interested in the problem of finding a vector of parameters - 2 R n such that f - "good approximation" of y i . How we measure the goodness of such an approximation varies with the task that we have in mind. For classification problems, it is natural to try to match the sign of f - that is, to attempt to minimize where is true and 0 otherwise. Although minimization of the number of classification errors may be a worthwhile goal, in its most general form, the problem is intractable (see, for instance, [15]). It is therefore often advantageous to instead minimize some other nonnegative loss function. For instance, the boosting algorithm AdaBoost [13, 20] is based on the exponential loss exp \Gammay It can be verified that Eq. (1) is upper bounded by Eq. (2); however, the latter loss is much easier to work with as demonstrated by AdaBoost. Briefly, on each of a series of rounds, AdaBoost uses an oracle or subroutine called the weak learning algorithm to pick one feature (weak hypothesis) h j , and the associated parameter - j is then updated. It has been noted by Breiman [3, 4] and various later authors that both of these steps are done in such a way as to (approximately) cause the greatest decrease in the exponential loss. In this paper, we show for the first time that AdaBoost is in fact a provably effective method for finding parameters - which minimize the exponential loss (assuming the weak learner always chooses the "best" h j ). We also give an entirely new algorithm for minimizing exponential loss in which, on each round, all of the parameters are updated in parallel rather than one at a time. Our hope is that this parallel-update algorithm will be faster than the sequential-update algorithm; see Section 10 for preliminary experiments in this regard. Instead of using f - as a classification rule, we might instead postulate that the y i 's were generated stochastically as a function of the x i 's and attempt to use f - (x) to estimate the probability of the associated label y. A very natural and well-studied way of doing this is to pass f - through a logistic function, that is, to use the estimate The likelihood of the labels occuring in the sample then is Y \Gammay Maximizing this likelihood then is equivalent to minimizing the log loss of this model \Gammay Generalized and improved iterative scaling [9, 10] are popular parallel-update methods for minimizing this loss. In this paper, we give an alternative parallel-update algorithm which we compare to iterative scaling techniques in preliminary experiments in Section 10. In this section, we give background on optimization using Bregman distances. This will form the unifying basis for our study of boosting and logistic regression. The particular set-up that we follow is taken primarily from Lafferty, Della Pietra and Della Pietra [18]. R be a continuously differentiable and strictly convex function defined on a closed, convex set D ' . The Bregman distance associated with F is defined for to be For instance, when BF is the (unnormalized) relative entropy DU It can be shown that, in general, every Bregman distance is nonnegative and is equal to zero if and only if its two arguments are equal. There is a natural optimization problem that can be associated with a Bregman distance, namely, to find the vector that is closest to a given vector q 0 2 D subject to a set of linear constraints. These constraints are specified by an m \Theta n matrix M and a vector - D. The vectors p satisfying these constraints are those for which the problem is to find arg min where The "convex dual" of this problem gives an alternative formulation. Here, the problem is to find the vector of a particular form that is closest to a given vector - p. The form of such vectors is defined via the Legendre transform, written simply v ffi q when F is clear from context): Using calculus, this can be seen to be equivalent to For instance, when BF is unnormalized relative entropy, it can be verified using calculus that (v From Eq. (6), it is useful to note that For a given m \Theta n matrix M and vector q 0 2 D, we consider vectors obtained by taking the Legendre transform of a linear combination of columns of M with the vector q 0 , that is, vectors in the set The dual optimization problem now can be stated to be the problem of finding arg min where Q is the closure of Q. The remarkable fact about these two optimization problems is that their solutions are the same, and, moreover, this solution turns out to be the unique point at the intersection of P and Q. We take the statement of this theorem from Lafferty, Della Pietra and Della Pietra [18]. The result appears to be due to Csisz- ar [6, 7] and Topsoe [21]. A proof for the case of (normalized) relative entropy is given by Della Pietra, Della Pietra and Lafferty [10]. See also Csisz- ar's survey article [8]. Theorem 1 Let - and Q be as above. Assume BF 1. Then there exists a unique 2. BF \Delta for any 3. 4. q Moreover, any one of these four properties determines q ? uniquely. This theorem will be extremely useful in proving the convergence of the algorithms described below. We will show in the next section how boosting and logistic regression can be viewed as optimization problems of the type given in part 3 of the theorem. Then, to prove optimality, we only need to show that our algorithms converge to a point in P "Q. REGRESSION REVISITED We return now to the boosting and logistic regression problems outlined in Section 2, and show how these can be cast in the form of the optimization problems outlined above. Recall that for boosting, our goal is to find - such that exp@ \Gammay i is minimized, or, more precisely, if the minimum is not attained at a finite -, then we seek a procedure for finding a sequence which causes this function to converge to its infimum. For shorthand, we call this the ExpLoss problem To view this problem in the form given in Section 3, we all 0's and all 1's vectors). We which it follows that (M-) . Finally, we take F to be as in Eq. (4) so that BF is the unnormalized relative entropy. As noted earlier, in this case, v ffi q is as given in Eq. (7). In particular, this means that Furthermore, it is trivial to see that DU so that DU \Delta is equal to Eq. (10). Thus, minimizing DU equivalent to minimizing Eq. (10). By Theorem 1, this is equivalent to finding satisfying the constraints Logistic regression can be reduced to an optimization problem of this form in nearly the same way. Recall that here our goal is to find - (or a sequence of -'s) which minimize For shorthand, we call this the LogLoss problem. We define and M exactly as for exponential loss. The vector q 0 is still constant, but now is defined to be (1=2)1, and the space D is now restricted to be [0; 1] m . These are minor differences, however. The only important difference is in the choice of the function F , namely, The resulting Bregman distance is Trivially, For this choice of F , it can be verified using calculus that (v so that \Delta is equal to Eq. (13) so minimizing DB is equivalent to minimizing Eq. (13). As before, this is the same as finding q 2 Q satisfying the constraints in Eq. (12). In this section, we describe a new algorithm for the ExpLoss and LogLoss problems using an iterative method in which all weights - j are updated on each iteration. The algorithm is shown in Fig. 1. The algorithm can be used with any function F satisfying certain conditions described below; in particular, we will see that it can be used with the choices of F given in Section 4. Thus, this is really a single algorithm that can be used for both loss-minimization problems by setting the parameters appropriately. Note that, without loss of generality, we assume in this section that for all instances i, The algorithm is very simple. On each iteration, the vector ffi t is computed as shown and added to the parameter vector - t . We assume for all our algorithms that the inputs are such that infinite-valued updates never occur. This algorithm is new for both minimization problems. Optimization methods for ExpLoss, notably AdaBoost, have Parameters: D Assumptions 1 and 2 such that BF lim For ffl For ffl Update parameters: - Figure 1: The parallel-update optimization algorithm. generally involved updates of one feature at a time. Parallel- update methods for LogLoss are well known (see, for exam- ple, [9, 10]). However, our updates take a different form from the usual updates derived for logistic models. A useful point is that the distribution q t+1 is a simple function of the previous distribution q t . By Eq. (8), This gives for ExpLoss and LogLoss respectively. We will prove next that the algorithm given in Fig. 1 converges to optimality for either loss. We prove this abstractly for any matrix M and vector q 0 , and for any function F satisfying the following assumptions: Assumption 1 For any v 2 R m , q 2 D, Assumption 2 For any c ! 1, the set is bounded. We will show later that the choices of F given in Section 4 satisfy these assumptions which will allow us to prove convergence for ExpLoss and LogLoss. To prove convergence,we use the auxiliary-function technique of Della Pietra, Della Pietra and Lafferty [10]. Very roughly, the idea of the proof is to derive a nonnegative lower bound called an auxiliary function on how much the loss decreases on each iteration. Since the loss never increases and is lower bounded by zero, the auxiliary function must converge to zero. The final step is to show that when the auxiliary function is zero, the constraints defining the set P must be satisfied, and therefore, by Theorem 1, we must have converged to optimality. More formally, we define an auxiliary function for a sequence M to be a continuous function satisfying the two conditions: and Before proving convergence of specific algorithms, we prove the following lemma which shows, roughly, that if a sequence has an auxiliary function, then the sequence converges to the optimum point q ? . Thus, proving convergence of a specific algorithm reduces to simply finding an auxiliary function. A be an auxiliary function for matrix M. Assume the q t 's lie in a compact subspace of Q where Q is as in Eq. (9); in particular, this will be the case if Assumption 2 holds and BF lim Proof: By condition (18), BF \Delta is a nonincreasing sequence which is bounded below by zero. Therefore, the sequence of differences BF must converge to zero. By condition (18), this means that A(q t ) must also converge to zero. Because we assume that the q t 's lie in a compact space, the sequence of q t 's must have a sub-sequence converging to some point - D. By continuity of A, we have A( - where P is as in Eq. (5). On the other hand, - q is the limit of a sequence of points in Q so - by Theorem 1. This argument and the uniqueness of q ? show that the have only a single limit point q ? . Suppose that the entire sequence did not converge to q ? . Then we could find an open set B containing q ? such that fq 1 contains infinitely many points and therefore has a limit point which must be in the closed set so must be different from q ? . This, we have already argued, is impossible. Therefore, the entire sequence converges to q ? . We can now apply this lemma to prove the convergence of the algorithm of Fig. 1. Theorem 3 Let F satisfy Assumptions 1 and 2, and assume that BF 1. Let the sequences - generated by the algorithm of Fig. 1. Then lim where Q is as in Eq. (9). That is, lim Proof: Let so that W We claim that the function is an auxiliary function for Clearly, A is continuous and nonpositive. We can upper bound the change in \Delta on round t by A(q t ) as follows: Eqs. (20) and (21) follow from Eq. (16) and Assumption 1, respectively. Eq. (22) uses the fact that, for any x j 's and for by Jensen's inequality applied to the convex function e x . Eq. (23) uses the definitions of W t;j and W \Gamma t;j , and Eq. (24) uses our choice of ffi t (indeed, ffi t was chosen specifically to minimize Eq. (23)). If j (q), that is, Thus, A is an auxiliary function for :. The theorem now follows immediately from Lemma 2. To apply this theorem to the ExpLoss and LogLoss prob- lems, we only need to verify that Assumptions 1 and 2 are satisfied. For ExpLoss, Assumption 1 holds with equality. For LogLoss, The first and second equalities use Eqs. (14) and (15), respec- tively. The final inequality uses 1 Assumption 2 holds trivially for LogLoss since is bounded. For ExpLoss, if DU which clearly defines a bounded subset of R . 6 SEQUENTIAL ALGORITHMS In this section, we describe another algorithm for the same minimization problems described in Section 4. However, unlike the algorithm of Section 5, the one that we present now only updates the weight of one feature at a time. While the parallel-update algorithm may give faster convergence when there are not too many features, the sequential-update algorithm can be used when there are a very large number of features using an oracle for selecting which feature to update next. For instance, AdaBoost, which is essentially equivalent to the sequential-update algorithm for ExpLoss, uses an assumed weak learning algorithm to select a weak hypothesis, i.e., one of the features. The sequential algorithm that we present for LogLoss can be used in exactly the same way. The algorithm is shown in Fig. 2. Theorem 4 Given the assumptions of Theorem 3, the algorithm of Fig. 2 converges to optimality in the sense of Theorem 3. Proof: For this theorem, we use the auxiliary function Parameters: (same as in Fig. 1) Output: (same as in Fig. 1) For ae ff t if else ffl Update parameters: - Figure 2: The sequential-update optimization algorithm. This function is clearly continuous and nonpositive. We have that where Eq. (27) uses the convexity of e \Gammaff t x , and Eq. (29) uses our choice of ff t (as before, we chose ff t to minimize the bound in Eq. (28)). If so Thus, A is an auxiliary function for and the theorem follows immediately from Lemma 2. As mentioned above, this algorithm is essentially equivalent to AdaBoost, specifically, the version of AdaBoost first presented by Freund and Schapire [13]. In AdaBoost, on each iteration, a distribution D t over the training examples is computed and the weak learner seeks a weak hypothesis with low error with respect to this distribution. The algorithm presented in this section assumes that the space of weak hypotheses consists of the features h and that the learner always succeeds in selecting the feature with lowest error (or, more accurately, with error farthest from 1=2). Translating to our notation, the weight D t (i) assigned to example AdaBoost is exactly equal to q t;i =Z t , and the weighted error of the t-th weak hypothesis is equal Theorem 4 then is the first proof that AdaBoost always converges to the minimum of the exponential loss (assuming an idealized weak learner of the form above). Note that when theorem also tells us the exact form of lim D t . However, we do not know what the limiting behavior of D t is when q nor do we know about the limiting behavior of the parameters - t (whether or not q We have also presented in this section a new algorithm for logistic regression. In fact, this algorithm is the same as one given by Duffy and Helmbold [12] except for the choice of ff t . In practical terms, very little work would be required to alter an existing learning system based on AdaBoost so that it uses logistic loss rather than exponential loss-the only difference is in the manner in which q t is computed from - t . We can even do this for systems based on "confidence-rated" boosting [20] in which ff t and j t are chosen together on each round to minimize Eq. (26) rather than an approximation of this expression as used in the algorithm of Fig. 2. (Note that the proof of Theorem 4 can easily be modified to prove the convergence of such an algorithm using the same auxiliary 7 A PARAMETERIZED FAMILY OF ITERATIVE ALGORITHMS In previous sections, we described separate parallel- and sequential-update algorithms. In this section, we describe a parameterized family of algorithms that includes the parallel- update algorithm of Section 5 as well as a sequential-update algorithm that is different from the one in Section 6. This family of algorithms also includes other algorithms that may be more appropriate than either in certain situations as we explain below. The algorithm, which is shown in Fig. 3, is similar to the parallel-update algorithm of Fig. 1. On each round, the quantities t;j and W \Gamma t;j are computed as before, and the vector d t is computed as ffi t was computed in Fig. 1. Now, however, this vector d t is not added directly to - t . Instead, another vector a t is selected which provides a "scaling" of the features. This vector is chosen to maximize a measure of progress while restricted to belong to the set AM . The allowed form of these scaling vectors is given by the set A, a parameter of the algorithm; AM is the restriction of A to those vectors a satisfying the constraint that for all i, a The parallel-update algorithm of Fig. 1 is obtained by choosing assuming that all i. (Equivalently, we can make no such assumption, and choose Parameters: (same as in Fig. 1) A ' R n m\Thetan satisfying the condition that a Output: (same as in Fig. 1) For ffl For d t;j =2 ffl a a j ffl Update parameters: - Figure 3: A parameterized family of iterative optimization algorithms. We can obtain a sequential-update algorithm by choosing A to be the set of unit vectors (i.e., with one component equal to 1 and all others equal to 0), and assuming that M ij 2 j. The update then becomes ae d t;j if else where Another interesting case is when we assume that all i. It is then natural to choose which ensures that A. Then the maximization over AM can be solved analytically giving the update . (This idea generalizes easily to the case in which any dual norms p and q.) A final case is when we do not restrict the scaling vectors at all, i.e., we choose A = R . In this case, the maximization problem that must be solved to choose each a t is a linear programming problem with n variables and m constraints. We now prove the convergence of this entire family of algorithms. Theorem 5 Given the assumptions of Theorem 3, the algorithm of Fig. 3 converges to optimality in the sense of Theorem 3. Proof: We use the auxiliary function a j are as in Theorem 3. This function is continuous and nonpositive. We can bound the change in using the same technique given in Theorem 3: a t;j d a a t;j a t;j Finally, if a j 0: Since for every j there exists a 2 AM with a j ? 0, this implies Applying Lemma 2 completes the theorem. In this section, we show how all of our results can be extended to the multiclass case. Because of the generality of the preceding results, we will see that no new algorithms need be devised and no new convergence proofs need be proved for this case. Rather, all of the preceding algorithms and proofs can be directly applied to the multiclass case. In the multiclass case, the label set Y has cardinality k. Each feature is of the form h In logistic regression, we use a model e f- (x;y) '6=y e f- (x;')\Gammaf - (x;y) y). The loss on a training set then is e f- We transform this into our framework as follows: Let fy i gg: The vectors p, q, etc. that we work with are in R . That is, they are 1)m-dimensional and are indexed by pairs in B. Let - . The convex function F that we use for this case is which is defined over the space The resulting Bregman distance is '6=y Clearly, It can be shown that (v Assumption 1 can be verified by noting that (i;')2B Now let M (1=k)1. Plugging in these definitions gives that \Delta is equal to Eq. (31). Thus, the algorithms of Sections 5, 6 and 7 can all be used to solve this minimization problem, and the corresponding convergence proofs are also directly applicable. There are several multiclass versions of AdaBoost. Ada- Boost.M2 [13] (a special case of AdaBoost.MR [20]), is based on the loss function (i;')2B exp For this loss, we can use a similar set up except for the choice of F . We instead use (i;')2B for . In fact, this is actually the same F used for (binary) AdaBoost. We have merely changed the index set to B. Thus, as before, (i;')2B and (v Choosing M as we did for multiclass logistic regression and we have that BF \Delta is equal to the loss in Eq. (33). We can thus use the preceding algorithms to solve this multiclass problem as well. In particular, the sequential-update algorithm gives AdaBoost.M2. AdaBoost.MH [20] is another multiclass version of Ada- Boost. For AdaBoost.MH, we replace B by the index set and for each example i and label ' 2 Y , we define ae The loss function for AdaBoost.MH is exp We now let M use again the same F as in binary AdaBoost with q to obtain this multiclass version of AdaBoost. 9 A COMPARISON TO ITERATIVE In this section, we describe the generalized iterative scaling (GIS) procedure of Darroch and Ratcliff [9] for comparison to our algorithms. We largely follow the description of GIS given by Berger, Della Pietra and Della Pietra [1] for the multiclass case. To make the comparison as stark as possible, we present GIS in our notation and prove its convergence using the methods developed in previous sections. In doing so, we are also able to relax one of the key assumptions traditionally used in studying GIS. We adopt the notation and set-up used for multiclass logistic regression in Section 8. (To our knowledge, there is no analog of GIS for the exponential loss so we only consider the case of logistic loss.) We also extend this notation by defining q i;y so that q i;' is now defined for all Moreover, it can be verified that q defined in Eq. (30) if In GIS, the following assumptions regarding the features are usually made: In this section, we prove that GIS converges with the second condition replaced by a milder one, namely, that Since, in the multiclass case, a constant can be added to all features h j without changing the model or loss function, and since the features can be scaled by any constant, the two assumptions we consider clearly can be made to hold without loss of generality. The improved iterative scaling algorithm of Della Pietra, Della Pietra and Lafferty [10] also requires only these milder assumptions but is much more complicated to implement, requiring a numerical search (such as Newton- Raphson) for each feature on each iteration. GIS works much like the parallel-update algorithm of Section 5 with F , M and q 0 as defined for multiclass logistic regression in Section 8. The only difference is in the computation of the vector of updates ffi t , for which GIS requires direct access to the features h j . Specifically, in GIS, ffi t is defined to be where Clearly, these updates are quite different from the updates described in this paper. Using more notation from Sections 5 and 8, we can re-formulate our framework as follows: \Theta h j (i;')2B We can now prove the convergence of these updates using the usual auxiliary function method. Theorem 6 Let F , M and q 0 be as above. Then the modified GIS algorithm described above converges to optimality in the sense of Theorem 3. Proof: We will show that is an auxilliary function for the vectors q computed by GIS. Clearly, A is continuous, and the usual nonnegativity properties of unnormalized relative entropy imply that From Eq. (35), H only if W Thus, implies that the constraints q T the proof of Theorem 3. All that remains to be shown is that where We introduce the notation and then rewrite the gain as follows using Eq. (32): Plugging in definitions, the first term of Eq. (38) can be written as Next we derive an upper boundon the second term of Eq. (38): 0.9training loss i.s. seq seq2 par 40.30.50.70.9training loss i.s. seq seq2 par Figure 4: The training logistic loss on data generated by a noisy hyperplane with many (left) or few (right) relevant features. Eq. (40) follows from the log bound ln x - x \Gamma 1. Eq. (42) uses Eq. (25) and our assumption on the form of the h j 's. Eq. (43) follows from our definition of the update ffi. Finally, combining Eqs. (36), (38), (39) and (44) gives Eq. (37) completing the proof. It is clear that the differences between GIS and the updates given in this paper stem from Eq. (38), which is derived from on the i'th term in the sum. This choice of C effectively means that the log bound is taken at a different point (ln 1). In this more general case, the bound is exact at varying C varies where the bound is taken, and thereby varies the updates. In this section, we briefly describe some experiments using synthetic data. These experiments are preliminary and are only intended to suggest the possibility of these algo- rithms' having practical value. More systematic experiments are clearly needed using both real-world and synthetic data, and comparing the new algorithms to other commonly used procedures. We first tested how effective the methods are at minimizing the logistic loss on the training data. In the first ex- periment, we generated data using a very noisy hyperplane. More specifically, we first generated a random hyperplane in 100-dimensional space represented by a vector w 2 R 100 (chosen uniformly at random from the unit sphere). We then chose 300 points x 2 R 100 where each point is normally distributed x - N(0; I). We next assigned a label y to each point depending on whether it fell above or below the chosen hyperplane, i.e., After each label was chosen, we perturbed each point x by adding to it a random amount " where " - N(0; 0:8 I). This had the effect of causing the labels of points near the separating hyperplane to be more noisy than points that are farther from it. The features were identified with coordinates of x. We ran the parallel- and sequential-update algorithms of Sections 5 and 6 (denoted "par" and "seq" in the figures) on this data. We also ran the sequential-update algorithm that is a special case of the parameterized family described in Section 7 (denoted "seq2"). Finally, we ran the iterative scaling algorithm described in Section 9 ("i.s. The results of this experiment are shown on the left of Fig. 4 which shows a plot of the logistic loss on the training set for each of the four methods as a function of the number of iterations. (The loss has been normalized to be 1 when of our methods do very well in comparison to iterative scaling. The parallel-update method is clearly the best, followed closely by the second sequential-update algorithm. The parallel-update method can be as much as times faster (in terms of number of iterations) than iterative scaling. On the right of Fig. 4 are shown the results of a similar experiment in which all but four of the components of w were forced to be zero. In other words, there were only four relevant variables or features. In this experiment, the sequential-update algorithms, which perform a kind of feature selection, initially have a significant advantage over the test error log seq exp seq log par exp par Figure 5: The test misclassification error on data generated by a noisy hyperplane with Boolean features. parallel-update algorithm, but are eventually overtaken. In the last experiment, we tested how effective the new competitors of AdaBoost are at minimizing the test misclassification error. In this experiment, we chose a separating hyperplane w as in the first experiment. Now, however, we chose 1000 points x uniformly at random from the Boolean hypercube f\Gamma1; +1g 100 . The labels y were computed as before. After the labels y were chosen, we flipped each coordinate of each point x independently with probability 0:05. This noise model again has the effect of causing examples near the decision surface to be noisier than those far from it. For this experiment, we used the parallel- and sequential- update algorithms of Sections 5 and 6 (denoted "par" and "seq"). In both cases, we used variants based on exponential loss ("exp") and logistic loss ("log"). (In this case, the sequential-update algorithms of Sections 6 and 7 are identi- cal.) Fig. 5 shows a plot of the classification error on a separate test set of 5000 examples. There is not a very large difference in the performance of the exponential and logistic variants of the algorithms. However, the parallel-update variants start out doing much better, although eventually all of the methods converge to roughly the same performance level. ACKNOWLEDGMENTS Many thanks to Manfred Warmuth for first teaching us about Bregman distances and for many comments on an earlier draft. Thanks also to Nigel Duffy, David Helmbold and Raj Iyer for helpful discussions and suggestions. Some of this research was done while Yoram Singer was at AT&T Labs. --R Della Pietra The relaxation method of finding the common point of convex sets and its application to the solution of problems in convex programming. Arcing the edge. Prediction games and arcing classifiers. Generalized iterative scaling for log-linear models Inducing features of random fields. Scaling up a boosting- based learner via adaptive sampling Potential boosters? A decision-theoretic generalization of on-line learning and an application to boosting Additive logistic regression: a statistical view of boosting. Boosting as entropy projection. Additive models Statistical learning algorithms based on Bregman dis- tances Functional gradient techniques for combining hypothe- ses Improved boosting algorithms using confidence-rated predictions Information theoretical optimization techniques. From computational learning theory to discovery science. --TR --CTR Stefan Riezler, New Developments in Parsing Technology, Computational Linguistics, v.32 n.3, p.439-442, September 2006 Nir Krause , Yoram Singer, Leveraging the margin more carefully, Proceedings of the twenty-first international conference on Machine learning, p.63, July 04-08, 2004, Banff, Alberta, Canada Hoiem , Alexei A. Efros , Martial Hebert, Automatic photo pop-up, ACM Transactions on Graphics (TOG), v.24 n.3, July 2005 Zhihua Zhang , James T. Kwok , Dit-Yan Yeung, Surrogate maximization/minimization algorithms for AdaBoost and the logistic regression model, Proceedings of the twenty-first international conference on Machine learning, p.117, July 04-08, 2004, Banff, Alberta, Canada Cynthia Rudin , Ingrid Daubechies , Robert E. Schapire, The Dynamics of AdaBoost: Cyclic Behavior and Convergence of Margins, The Journal of Machine Learning Research, 5, p.1557-1595, 12/1/2004 Steven J. Phillips , Miroslav Dudk , Robert E. Schapire, A maximum entropy approach to species distribution modeling, Proceedings of the twenty-first international conference on Machine learning, p.83, July 04-08, 2004, Banff, Alberta, Canada Amir Globerson , Terry Y. Koo , Xavier Carreras , Michael Collins, Exponentiated gradient algorithms for log-linear structured prediction, Proceedings of the 24th international conference on Machine learning, p.305-312, June 20-24, 2007, Corvalis, Oregon Zhihua Zhang , James T. Kwok , Dit-Yan Yeung, Surrogate maximization/minimization algorithms and extensions, Machine Learning, v.69 n.1, p.1-33, October 2007 Taneli Mielikinen , Evimaria Terzi , Panayiotis Tsaparas, Aggregating time partitions, Proceedings of the 12th ACM SIGKDD international conference on Knowledge discovery and data mining, August 20-23, 2006, Philadelphia, PA, USA Joshua Goodman, Sequential conditional Generalized Iterative Scaling, Proceedings of the 40th Annual Meeting on Association for Computational Linguistics, July 07-12, 2002, Philadelphia, Pennsylvania Stefano Merler , Bruno Caprile , Cesare Furlanello, Parallelizing AdaBoost by weights dynamics, Computational Statistics & Data Analysis, v.51 n.5, p.2487-2498, February, 2007 Gokhan Tur, Extending boosting for large scale spoken language understanding, Machine Learning, v.69 n.1, p.55-74, October 2007 Hoiem , Alexei A. Efros , Martial Hebert, Recovering Surface Layout from an Image, International Journal of Computer Vision, v.75 n.1, p.151-172, October 2007 W. John Wilbur , Lana Yeganova , Won Kim, The Synergy Between PAV and AdaBoost, Machine Learning, v.61 n.1-3, p.71-103, November 2005 Heinz H. Bauschke, Duality for Bregman projections onto translated cones and affine subspaces, Journal of Approximation Theory, v.121 n.1, p.1-12, March Joseph Turian , I. Dan Melamed, Advances in discriminative parsing, Proceedings of the 21st International Conference on Computational Linguistics and the 44th annual meeting of the ACL, p.873-880, July 17-18, 2006, Sydney, Australia Michael Collins, Parameter estimation for statistical parsing models: theory and practice of distribution-free methods, New developments in parsing technology, Kluwer Academic Publishers, Norwell, MA, 2004 Michael Collins , Terry Koo, Discriminative Reranking for Natural Language Parsing, Computational Linguistics, v.31 n.1, p.25-70, March 2005 Ron Meir , Gunnar Rtsch, An introduction to boosting and leveraging, Advanced lectures on machine learning, Springer-Verlag New York, Inc., New York, NY,
logistic regression;maximum-entropy methods;boosting;iterative scaling;convex optimization;information geometry;adaboost;bregman distances
599694
Reinforcement Learning for Call Admission Control and Routing under Quality of Service Constraints in Multimedia Networks.
In this paper, we solve the call admission control and routing problem in multimedia networks via reinforcement learning (RL). The problem requires that network revenue be maximized while simultaneously meeting quality of service constraints that forbid entry into certain states and use of certain actions. The problem can be formulated as a constrained semi-Markov decision process. We show that RL provides a solution to this problem and is able to earn significantly higher revenues than alternative heuristics.
Introduction A number of researchers have recently explored the application of reinforcement learning (RL) to resource allocation and admission control problems in telecommu- nications, e.g., channel allocation in wireless systems, network routing, and admission control in telecommunication networks (Nie and Haykin, 1998, Singh, 1997, Boyan and Littman, 1994, Marbach, et al, 1998). This paper focuses on applications of the RL method to call admission control (CAC) and routing in broadband multimedia communication networks, such as ATM networks. Broadband networks carry heterogeneous traffic types simultaneously on the same channels. The channels are packet-based so that customers can send at varying rates over time. Calls arrive and depart over time and the network can choose to accept or reject connection requests. If the new call is accepted, the network will choose an appropriate route to deliver the call from it source node to its destination node. The network provides Quality of Service (QoS) guarantees at the packet level, e.g., maximum probability of congestion, and at the call level, e.g. limits on call blocking probabil- ities. In return, the network collects revenue (payoff) from customers for calls that it accepts into the network. The network wants to find a CAC and routing policy that maximizes the long term revenue/utility and meets QoS constraints. Maximizing revenue while meeting QoS constraints suggests a constrained semi-Markov decision process (SMDP), as in Mitra, et al (1998). The rapid growth in the number of states with problem complexity has led to RL approaches to the prob- lem, as in Marbach and Tsitsiklis (1997), Marbach, et al (1998). However, these RL applications have ignored QoS criteria. This work draws on a closely related and more fundamental problem of constrained optimization of (semi-)Markov decision processes, which has been studied by researchers from control theory, operation re- search and artificial intelligence communities, see e.g. Altman and Shwartz (1991), Feinberg (1994), Gabor, et al (1998). Unlike model-based algorithms (e.g. linear programming in Mitra, et al, 1998), the RL algorithm used in this paper is a stochastic iterative algorithm, it does not require a priori knowledge of the state transition probabilities associated with the underlying Markov chain, and thus can be used to solve real network problems with large state spaces that cannot be handled by model-based algorithms, and can automatically adapt to real traffic conditions. This work builds on earlier work of the authors (Brown, et al, 1999), in that it provides a more general framework for studying the CAC and routing problem, under QoS constraints. It also provides more detailed information and proofs for the RL algorithm used in the study, and contains results for combined CAC and routing in a multimedia network, which were not reported in Tong and Brown (1999). Section 2 describes the problem model used in this study. Section 3 formulates the CAC problem as a SMDP, and gives a RL algorithm that solves the SMDP. Section 4 considers QoS constraints in more details. Simulations for CAC on a single link system is presented in Section 5. Combined CAC and network routing is studied in Section 6, with simulation results for a 4-node, 12-link network. Section 7 concludes the paper. 2. Problem description This section describes the CAC problem for a single-link communication system. There is a substantial literature on CAC in one link multiservice networks, e.g. Marbach and Tsitsiklis (1997), Mitra, et al (1998), and references in Dziong and Mason (1994). The single link case is significant since it is the basic building block for larger networks and, as shown in Section 6 of this paper, combined CAC and routing for a multi-link network system can be decomposed into single link processes. We thus first focus on a single-link system. Users attempt to access the link over time and the network immediately chooses to accept or reject the call. If accepted, the call generates traffic in terms of bandwidth as a function of time. At some later time, the call terminates and departs from the network. For each call accepted, the network receives an immediate revenue payment. The network measures QoS metrics such as transmission delays, packet loss ratios, or call rejection probabilities for each service class, and compares them against the guarantees given to the calls. The problem is described by the call arrival, traffic, and departure processes; the revenue payments; QoS metrics; QoS constraints; and network model. To be concrete, we describe the choices used in the later examples. Calls are divided into discrete classes indexed by I . The calls are generated via independent Poisson arrival processes (arrival rate - i ) and have exponential holding times (mean holding time 1=- i ). Within a call the bandwidth is an on/off process where the traffic is either on, generating packets at rate r i , or off at rate zero with mean holding times 1=- on i and 1=- off . When a class i call is admitted, the system collects REINFORCEMENT LEARNING FOR CALL ADMISSION CONTROL 3 a fixed amount of revenue which can be interpreted as the average reward for carrying the i\Gammath class call (Dziong and Mason, 1994). The network element connects to the network with a fixed bandwidth B. The total bandwidth used by accepted calls varies over time. One important packet-level QoS metric is the fraction of time that the total band-width exceeds the network bandwidth and causes packet losses, i.e., the congestion probability, I . We choose the packet-level QoS guarantee to be the upper limit of congestion probability, p i , which we denote the Capacity constraint. In previous works (e.g. Carlstrom and Nordstrom, 1997, Marbach, et al, 1998) each call had a constant bandwidth over time so that the effect on QoS was predictable. Variable rate traffic is safely approximated by assuming that it always transmits at its maximum or peak rate. This peak rate allocation under-utilizes the network; in some cases by orders of magnitude less than what is possible. Network efficiency can be improved by statistical multiplexing: Statistically, bursty sources are unlikely to all simultaneously communicate at their peak rates. Thus it is possible to carry more bursty or variable rate traffic than would be possible by allocating capacity according to peak rate requirements, while maintaining service quality. Stochastic traffic rates in real traffic, the desire for high network utilization/revenue, and the resulting potential for QoS violations characterize the problem in this study. Another important QoS metric is the call-level blocking probability. When offered traffic from each class must be cut back to meet the capacity constraint, it is important to do so fairly, which we denote the Fairness constraint. Fairness can be defined in a number of different ways, but one intuitive notion is that calls from every class are entitled to the same admission probability, or equivalently, the same rejection probability, (Dziong and Mason, 1994). This will be more precisely defined in Section 4. Ultimately our goal is to find a policy, -, that for every system state, s, chooses the correct control action, a, so that we maximize revenue subject to the QoS constraints. Formally, we consider the following problem of finding the CAC policy, -, that maximizes J 0 (-) (1) subject to J j (- l fset of all policiesg (3) where K is the number of QoS constraints, l are real numbers that characterize the QoS constraints, J 0 (-) characterizes the average network revenue under policy -, and J j characterize the QoS under policy -. We consider objectives of the form an ) an ) K. Action an is chosen at state s n according to the policy -, an ) are the reward functions associated with revenue (for are assumed to be bounded. The -(s n ; an ) are the average sojourn times at state s n under action an , while n indexes the n\Gammath decision epoch (Decisions are made at points of time referred to as decision epochs). 3. Semi-Markov decision processes and reinforcement learning The following sections develop the components to the problem and finish by justifying a particular method suitable for the CAC problem. 3.1. States and actions This section develops the state action model and a reduced state space representation suitable for the CAC problem. The CAC problem can be formulated as a semi-Markov decision process (SMDP) in which state transitions and control selections take place at discrete times, but the time from one transition to the next is a continuous random variable. At any given point of time, the system is in a particular configuration, x, defined by the number of each type of ongoing calls, and y, the number of calls in the on state of each type. At random times an event e can occur (only one event can occur at any time instant), where e is an I \Gammavector indicating either a class i call arrival, a call termination, a call being turned on, or a call being turned off event, I . The configuration and event together determine the state of the system, e). For an I-class system, s is a 3I dimensional vector. Since the number of possible choices for e is in general small compared to those for x; y, the size the state space is dominated by the configuration part of the state. It can be shown that using the nearly complete decomposability approximation we can reduce the state descriptor into the form of stands for a call arrival or departure event of class i. Let I ) be the configuration, e i denote the I \Gammavector whose elements are equal to zero except the ith element, whose value is unity. Then the states associated with a class i call arrival are the states associated with a class i call departure are I . This reduction, by ignoring the number of calls in the on state and the events of a call being turned on or off, gives us enough accuracy for the CAC problem, as shown experimentally by Mitra, et al (1998). Here we give two reasons for this simplification. First, the moment a call turns on or off is not a decision point for the admission controller, and therefore no action needs to be taken. Theorem 2 in the Appendix shows that ignoring the events of a call being turned on or off is valid. Section 3.4 also provides further discussions on the similar simplifications. Second, it is intuitively clear that this simplification is a good approximation when the process describing the number of calls in the on state reaches equilibrium between any change in the number of calls in progress due to the call arrival/departure. Hence, when making a call admission decision, the number of calls of each class in progress is important, but the number of calls of each class in the on state is not, because these quantities oscillate rapidly relative to call arrivals and departures. If we view the ignorance of y as state aggregation, and assume that for a fixed x, the Q-values do not change much for different y, REINFORCEMENT LEARNING FOR CALL ADMISSION CONTROL 5 then the discussions in Section 3.6 further justify this reduction of dropping y. We note that y does affect the congestion probability. Assuming the y process reaches equilibrium and corresponds to fixed x, and assuming source independence, the probability for the configuration (x; y) is given by the binomial distribution I Y where b i is the fraction of time a class i call spends in the on state, The average congestion probability for class i with fixed x is thus x I y I =0 where 1f\Deltag is the indicator function. So the average congestion probability depends only on x. Capacity constraints associated with (6) are conservative in that the set is the set of x such that the long run average packet-level QoS constraints are always satisfied, and we will never go into any state for any period of time where the capacity constraint will be violated if we stay there forever. The set C c uniquely determines a state space S: for any i, (x; e i . Mitra, et al (1998) considers a more aggressive approach to the packet-level QoS constraints, that averages across all the allowable configurations x. Let x2Ca T (x) be the total system time, T (x) be the portion of T the system spends at x, C a is the set of the allowable configurations x such that x2Ca are less than or equal to target p I . Obviously, C a is not unique, and C c is a possible C a , although in general it is too conservative. In some occasions, to emphasis the dependence of C c and C a on p I ), we also write C c (p ) and C a (p ). In summary, we choose the state descriptor to be is the number of class i calls in progress, and e i stands for a new class i call arrival, \Gammae i for a class i call departure, 1 - i - I . When an event occurs, the learner has to choose an action feasible for that event. The action set is A(s)=f0=reject, 1=acceptg upon a new call arrival. Call terminations are not decision points, so no action needs to be taken. Symbolically, at 6 H. TONG AND T.X BROWN such states A(s)=f\Gamma1=no action due to call departuresg. Note that the actions available at state s, A(s), in general depend on s. For example, if adding a new call at a state s will violate the capacity constraint, then the action set at that state should be constrained to f0g. At some subsequent random time another event occurs, and this cycle repeats. The revenue structure for CAC is: The task of the learner is to determine a policy for accepting calls given s, that maximizes the long-run average revenue, over an infinite horizon while meeting the QoS requirements. For CAC, the system constitutes a finite state space e)g, (due to the capacity constraint), finite action space A=f\Gamma1,0,1g, semi-Markov decision process. 3.2. Transition probabilities This section considers the probability model and concludes that for large state spaces, classical approaches based on the transition probability model are not fea- sible. Theoretically, a state transition probability p(s; a; s 0 ) - the probability of going from state s under action a to next state s 0 - can be derived (Mitra, et al, 1998), which depends on the configuration x and call arrival rates. But exact system models are often infeasible for several important reasons. First, call arrival rates may depend not only on each call class, but also on the configuration x (Dziong and Mason, 1994). Therefore, the call arrival rate for each class may not be a constant in general. Second, for any network of reasonable size, the state space is extremely large. As an example, a 4-node, 12-link network with 3 service types has more than 10 states (Marbach, et al, 1998). It is not even possible to explicitly list all the states. Finally, fixing a model before computing the optimal policy means that it will not be robust if the actual traffic condition departs from the assumed model. For the above reasons, it is clear that for any practical system with large state space, it will be very difficult, if not impossible, to determine the exact transition model for the Markov chain before performing any model-based algorithm to compute the optimal policy. This is the main motivation for this study to apply model-free RL algorithms to solve CAC problems. Although we will not explicitly compute the transition probabilities, we make the following assumptions in this study: let - ss 0 (a) be the continuous random inter- transition time from state s to state s 0 under action a, with probability distribution F ss 0 (-ja), Assumption A1. Assumption A2. a) is the expectation of - ss 0 (a), for any s 2 REINFORCEMENT LEARNING FOR CALL ADMISSION CONTROL 7 Z 1-dF ss 0 (-ja) (10) In particular, there exists Assumption A3. Unichain Condition: For every stationary policy -, transition matrix (p(s; -(s); s 0 determines a Markov chain on S with one ergodic class and a (possibly empty) set of transient states. Assumption A1 guarantees the transition probabilities are well defined. Assumption A2 guarantees that the number of transitions in a finite time interval is, almost surely, finite. A3 guarantees that except for some initial transient states, any state can reach any other state with non-zero probability. 3.3. Q-learning This section develops the RL methodology used in this paper for the unconstrained maximization of revenue. The QoS constraints will be considered in Section 4. We learn an optimal policy using Watkins' Q-learning algorithm (Watkins and Dayan, 1992). Given optimal Q-values, Q (s; a), the policy - defined by is optimal. In particular, (12) implies the following procedures. When a call arrives, the Q-value of accepting the call and the Q-value of rejecting the call is determined. If rejection has the higher value, we drop the call. Else, if acceptance has the higher value, we accept the call. Only one action (and Q-value) exists at a call departure. To learn Q (s; a), we update our value function as follows: on a transition from state s to s 0 under action a in time - ss 0 (a), where is the stepsize or learning rate, k is an integer variable to index successive updates, and ff ? 0 is chosen to be sufficiently close to 0 so that the discounted problem is equivalent to the average reward problem (the Tauberian approximation, Gabor, et al, 1998). It is well known that Q-learning (13) is the Robbins-Monro stochastic approximation method that solves the so-called Bellman optimality equation associated with the decision process. Let Z 1e \Gammaff- dF ss 0 (-ja) for all s, and a 2 A(s). Assumption A2 guarantees that H is a contraction mapping with contraction factor Z 1e \Gammaff- dF ss 0 (-ja) with respect to the maximum norm. Theorem 1. Suppose thatX for all s 2 and each state-action pair is updated an infinite number of times. Then, Q k (s; a) converges with probability 1 to Q (s; a), for every s and a. Proof: See Bertsekas and Tsitsiklis (1996). 3.4. A simplified learning process There is a practical issue concerning the implementation of Q-learning (13). From the above discussions, Q-learning needs to be executed at every state transition, including the transition caused by a call departure, at which the feasible action set is there is only one action at states associated with call departures, it is not necessary to learn the optimal Q-values at these states to induce the optimal policy at these states. Is it possible to avoid the updates of Q-values at departure states, and still get the same optimal policy? This will reduce the amount of computation and storage of Q-values significantly, since the state space is almost halved by dropping the call departure states. We note that the only interesting states at which decisions need to be made are those associated with call arrivals, )g. So the decision point jumps from one arrival to the next arrival, where an interarrival period may contain zero, one, or more departures. Given where e j is the first arrival after e i , for the cases where there are n ? 0 departures between two adjacent arrivals, by Chapman-Kolmogorov equations (Bertsekas and Gallager, 1992), the transition probability for the actual decision process is s is the intermediate state corresponds to a call departure. It is shown in the Appendix that the same optimal policy can be obtained by only doing Q-learning at the states associated with call arrivals. This result is REINFORCEMENT LEARNING FOR CALL ADMISSION CONTROL 9 intuitive since the call departures are random disturbances that only affect the state transitions. Even though (18) further complicates the already intractable transition model for the SMDP, since Q-learning does not depend on the explicit model, the asymptotic convergence to the optimal policy follows. 3.5. Exploration In order for Q-learning to perform well, all potentially important state-action pairs (s; a) must be explored. Specifically, the convergence theorem of Q-learning requires that all state-action pairs (s; a) are tried infinitely often. This section develops an exploration strategy suitable for the CAC problem. A common way to try all state-action pairs in RL is, with a small probability ffl, a random action rather than the action recommended by RL is chosen at each decision point during training, the so-called ffl\Gammarandom exploration. For the CAC problem considered in this paper, without exploration some states will be visited with probabilities several orders higher than some other states, and experiments have shown that ffl\Gammarandom exploration is very unlikely to help in this situation. Therefore, after training some states will be visited many times while some other states will only be visited for a few times, and the resulting Q-value functions are far from converging, and an optimal policy cannot be expected in reasonable time. To see this, the call arrival process can be modeled as truncation of I independent M/M/1 queues system. The truncated system is the same as for the untruncated system, except that all configurations I ) for which capacity constraint is violated have been eliminated. The stationary distribution of this system, assuming the greedy policy (the policy that always accepts a new call if the capacity constraint will not be violated by adding the new call), is given by Bertsekas and Gallager (1992) G is a normalization constant, is the allowed set of configurations of the truncated system. Since the state s and action a deterministically define the next configuration x 0 of the next state s 0 , and the event part of s 0 , e 0 (arrival only, at which an action needs to be taken), occurs independent of x 0 with probability determined by - i due to the memoryless assumption, so the stationary distribution of states s 0 depends on (19). As an example, consider the same experimental parameters shown in Table 1 of Section 5 below, except that to simplify the calculation of the allowable configuration set C of the truncated system, we use the peak-rate allocation, so 1g. Using (19) and (20) we have, for the most visited state, 0:2297, and for the least visited state, P i.e., more than five orders of difference in the stationary distribution of state-action pairs for this small system. It is shown in Szepesvari (1998) that the convergence rate of Q-learning is approximated by for some suitable constant B ? 0, where k is the same index as in (13), and i as defined in (15). To overcome the slow convergence caused by the small value of P min =Pmax in the stationary distribution, a controlled exploration scheme is derived based on the facts that Q-learning is an off-policy learning method (Sutton and Barto, 1998, Section 7.6), and that in SMDP the state transitions, and thus the state distri- bution, can be controlled by choosing appropriate actions. At each state during training where there are more than one feasible actions, with probability ffl the control action is chosen that leads to the least visited configuration. This ffl\Gammadirected heuristic effectively reduces the difference in the number of visits between states, and significantly speeds up the convergence of the value functions. In terms of the Q-learning formula (13), action a is chosen according to the exploration scheme, and action b is chosen according to the current Q-value. 3.6. Function approximation vs. lookup tables Q-learning deals effectively with the curse of modeling (an explicit state transition model is not needed, and a simulator can be used instead). Another major difficulty with SMDP problems is the curse of dimensionality (the exponential state space explosion with the problem dimension). In the above treatment, we have assumed that the problem state space is kept small enough so that a lookup table can be used. Clearly, when the number of state-action pairs becomes large, lookup table representation will be infeasible, and a compact representation where Q is represented as a function of a smaller set of parameters using a function approximator is necessary. In this paper, we choose the approximation architecture to correspond to state aggregation. We consider the partition of the state space S into disjoint subsets \Gammadimensional parameter vector OE whose mth component is meant to approximate the Q-value function for all states s 2 Sm under action a. In other words, we are dealing with piecewise constant approximation ~ Q(s; When the value of M is small, a lookup table can be used for the aggregated problem. In this case, it can be shown (Bertsekas and Tsitsiklis, 1996) that Q-learning converges to the optimal policy for the aggregated problem. Other function approximators can be used, they may perform well in practice, however, there is no convergence result as for the state aggregation case, and we wish to avoid them here. By Proposition 6.8 in Bertsekas and Tsitsiklis (1996), and the Tauberian REINFORCEMENT LEARNING FOR CALL ADMISSION CONTROL 11 approximation, it is easy to show that the performance loss due to state aggregation is bounded by where J 0 and ~ 0 are the optimal average revenue per unit time for the original and the aggregated problem, respectively, i as defined in (15); and In CAC, state aggregation can be interpreted as a feature-based architecture whereby we assign a common value OE(m; a) to all states s, given a, that share a common feature vector. For example, a feature vector may involve for each call class a three value indicator, that specifies whether the load of each call class is "high", "medium", or "low" in the system, instead of specifying precisely the number of ongoing calls of each class, x. Since states with similar numbers of calls would be expected to have similar Q-values, " is expected to be small. Therefore, the state space can be greatly reduced, and lookup table can be used. 3.7. Summary This section formulates the CAC problem as a SMDP, and justify the Q-learning approach to solving the CAC problem. It shows that we can simplify the problem by ignoring the details of the within call processes and not computing Q-values for states that have no decision. Standard ffl\Gammarandom exploration policies will significantly slow down learning in this problem, so a simple ffl\Gammadirected exploration strategy is introduced. Aggregation of states is shown to be a simplifying heuristic that follows readily from the problem structure. The next section develops a method for incorporating the constraints into this framework. 4. Constraints We restrict the maximization to policies that never violate QoS guarantees, (1) - (3). For general SMDP problems, the constrained optimal policy is a randomized stationary policy, which randomizes in at most K states for a problem with K \Gammaconstraints (Feinberg, 1994). However, model-based linear programming algorithms have to be employed to derive such a policy, which is impractical for CAC where the number of states can be very large. Since randomizations are needed at only K states, which is usually much smaller than the total number of states, the non-randomized stationary policy learned by RL is often a good approximation to the constrained optimal policy (Gabor, et al, 1998). In general SMDP, due to stochastic state transitions, meeting such constraints may not be possible (e.g. from any state no matter what actions are taken there is a possibility of entering restricted states). In admission control, service quality depends on the number of calls admitted into the system and adding calls is strictly controlled by the admission controller, so that meeting such QoS constraints is possible. We consider two important classes of QoS constraints in CAC in an integrated service network. One is the State-dependent constraints, the other is the Past- dependent constraints. The (conservative) capacity constraint is an example of state-dependent constraints. State-dependent constraints are QoS intrinsic to a state. The congestion probability is a function solely of the number of calls in progress of the current state, [cf. (6)]. Past-dependent constraints depend on statistics over the past history. An example is the fairness criterion. Fairness depends on the statistics of the rejection ratios over the past history. We address these two constraints separately. 4.1. Capacity constraint For simplicity, we consider a total packet congestion probability upper bound, p . For the conservative approach, this means the set C c (p [cf (6) and (7)] x I y I =0 As stated, the conservative capacity constraint is an intrinsic property of a state and it only depends on the current state. This allows us to collect QoS statistics about each state and treat them in a principled way (e.g. computing confidence intervals on the estimates). The current state and action (s n ; an ) uniquely determine the next configuration, xn+1 , and the projected congestion probability for the next state s n+1 is determined only by xn+1 . Therefore, to forecast the impact of an at we need to evaluate if p(xn+1 ), the expected congestion probability, is greater or less than the constraint p . If an action will cause p(xn+1 action should be eliminated from the feasible action set A(sn ). In CAC, if adding a new call will violate the capacity constraint, then the only feasible action is to reject the new call request. When considering the aggressive capacity constraint, we need to determine the set C a = C a (p ) of allowable configurations, defined implicitly (but not uniquely) from lim x2Ca where T (x) is the total time the system spends at x, and x2Ca T (x). We note that the distribution T (x)=T depends on the control policy. Again, generalization to the case where different service types have different packet-level QoS requirements can be easily made. REINFORCEMENT LEARNING FOR CALL ADMISSION CONTROL 13 As stated, C c (p ) serves as a possible C a but it is usually too conservative. To construct a more aggressive set C a (p ), we gradually decrease p c from 1, and find a series of sets C c (p c ) corresponding to the changing p c . Clearly, the size of C c (p is non-increasing with the decrease of p c , however, it must always contain C c (p ). In practice, at some value p c0 under the learned policy, if the aggressive congestion probability will be sufficiently close to, and still less than the constraint p , then the search for C a (p ) can stop, and we choose the C a (p c0 ) for the aggressive capacity constraint. In essence, we try to find a corresponding value of conservative threshold p c to the aggressive threshold p , and construct C a from the conservative approach. This way, the aggressive capacity constraint remains to be a state-dependent constraint, and as for the conservative capacity constraint, we can implement this constraint by constraining the action set at each state. Although C a determined in the above way may not be the most aggressive one in term of the revenue maximization (1) - (3), the loss of optimality is expected to be small. 4.2. Fairness constraint be the measured rejection ratio for class i upon the nth call arrival (before the nth decision is made). For arbitrarily constraints on R i (s n ), we may not be able to find a feasible policy. The fairness constraint involves comparisons of rejection ratios for all types of calls. We formulate the fairness constraints as 1-i-I 1-i-I where l d is the maximum allowed rejection ratio discrepancy. A feasible policy exists by always rejecting all call types. The aggressive fairness constraint can be formulated as lim - l d (28) where - sn sn+1 (a) is the inter-transition duration from state s n to s n+1 under action a. This formulation is a constrained SMDP problem (1) - (3) with the capacity constraint is implemented by constraining the feasible action set at each state as described in the preceding subsection. To deal with the fairness constraint, we use the Lagrange multiplier framework studied in Beutler and Ross (1986). Since the fairness constraint is a past-dependent constraint (the vector R(sn+1 ) depends on the rejection ratios over the past his- tory), to fit into this framework, we need to include this history information into our state descriptor. The new state descriptor, - s, has the form where the I \Gammavector req (resp. rej) denotes the total number of call requests (resp. rejections) from each class before the current call arrival, - is the time interval between the last and the current call request, and is the original state 14 H. TONG AND T.X BROWN descriptor. We obtain a Markov chain by doing this expansion, however, the state space has been enlarged significantly. Specifically, due to the inclusion of req; rej, and -, the state space is now infinite, and we must resort to some form of function approximation to solve the SMDP problem. In this paper, we use state aggregation as our approximation architecture, by quantizing the rejection ratios R and -. In terms of a Lagrange multiplier !, we consider the unconstrained optimization for the parametrized reward a) is the original reward function associated with the is the cost function associated with the constraint the numerator of (28). If there exists a non-randomized policy - ! that solves the Bellman optimality equation associated with reward function (30), and in the mean time, achieves the equality in (28), then Beutler and Ross (1986) shows that - ! is the constrained optimal policy. In case such optimal policy does not exist, it is shown that the constrained optimality is achieved by randomization at only one state - s 0 , between two non-randomized policies, - ! 2 , that only differ from each other in - slightly undershooting (resp. overshooting) l d . Clearly, in case that the non-randomized constrained optimal policy does not exist, - ! 1 is the next best non-randomized policy, and the loss of optimality is minimal. For the above reasons, and to avoid the complications of randomized policies, we concentrate on non-randomized policies in this study. 4.3. Summary This section shows how the constraints can be introduced to the problem, either by modulating the action space or modifying the reward function. While optimality requires a randomized policy, since the policy only needs to be randomized in two states out of many states, we greatly simplify the search by restricting ourselves to deterministic policies. 5. Simulation results The experiments use the following model. The total bandwidth is normalized to 1.0 unit of traffic per unit time. The target congestion probability is p Two source types are considered with the properties shown in Table 1. The fairness constraint is that the average rejection ratio discrepancy for two service types should not differ more than l As noted before, all holding times are exponential. We first concentrate on the conservative approach to the capacity constraint. Since exploration is employed to ensure that all potentially important state-action REINFORCEMENT LEARNING FOR CALL ADMISSION CONTROL 15 Table 1. Experimental parameters Source Type Parameter I II on rate, r 0.08 0.2 Mean on period, 1=- on 5 5 Mean off period, 1=- off 15 45 Call arrival rate, - 0.067 0.2 Call holding time, 1=- Immediate payoff, pairs are tried, it naturally enables us to collect statistics that can be used to estimate QoS at these state-action pairs. It should be emphasized that a single visit to a state is not sufficient to determine the long run QoS metrics due to variability in the within call process. As the number of times that each state-action pair is visited increases, the estimated service quality becomes more and more accurate and, with confidence, we can gradually eliminate those state-action pairs that will violate QoS requirements. As a consequence, the value function is updated in a gradually correct subset of state-action space in the sense that QoS requirements are met for any action within this subspace. As stated in Section 4, the capacity constraint eliminates those state-action pairs that violate the congestion probability upper limit. In the experiments, we use a simple way to eliminate state-action pairs with confidence. Since our target congestion probability is be the total number of visits to the configuration x, (counted as the number of time steps in the simulation), and w(x) be the number of congestions at x, then if w(x) and T (x) ? 200, or if w(x) 20000, we conclude that (s; a) is not acceptable. These thresholds provide close approximations to the confidence intervals in Brown (1997). A more sophisticated way to estimate p(x) is proposed in Tong and Brown (1998), where artificial neural networks (NNs) are trained based on the maximum likelihood principle so that the NN estimates of p(x) extrapolate well down to p In simulations, the discount factor ff is chosen to be 10 \Gamma4 , learning rate exploration Initial Q-values for RL are artificially set such that Q-learning started with the greedy policy. After training is completed, we apply a test data set to compare the policy obtained through RL with alternative heuristic policies. The final QoS measurements obtained at the end of the RL training while learning QoS are used for testing different policies. To test the RL policies, when there is a new call arrival, the algorithm first determines if accepting this call will violate QoS. If it will, the call is rejected, else the action is chosen according to a = arg max a2A(s) Q(s; a), where 0=rejectg. For the QoS constraint we use three cases: Peak rate allocation; statistical multiplexing function learned on-line, denoted QoS learned; and statistical multiplexing function given a priori, denoted QoS given. We examine six different cases: (1) RL: QoS given; (2) RL: QoS learned; (3) RL: peak rate; A heuristic that only accepts calls from the most valuable class, i.e., type I, with QoS given; (5) Greedy: QoS given; (6) Greedy: peak rate. From the results shown in Fig. 1, it is clear that simultaneous Q-learning and QoS learning converges correctly to the RL policy obtained by giving the QoS a priori and doing standard Q-learning only. We see significant gains (about 15%) due to statistical multiplexing in (6) vs (5), and (3) vs (1). The gains due to RL are about 25% in (6) vs (3), and (5) vs (2). Together they yield about 45% increase in revenue over conservative peak rate allocation in this example. It is also clear from the figure that the RL policies perform better than the heuristic policies. Fig. (2) shows the rejection ratios for different policies. Now we consider the aggressive approach to the capacity constraint. From the simulation, it is found that the value of p corresponds to the aggressive capacity constraint p . The acceptance regions (i.e., C a and C c ) for both the aggressive and conservative approaches are shown in Fig. 3. The aggressive acceptance region is much larger than the conservative one. In the figure, the number of type II users starts at two due to insufficient measurement data (for the confidence level) in the region below that. Comparing Figs. 4 and 5 with Figs. 1 and 2, we can see that the aggressive approach earns significantly more revenue than the conservative approach, for both greedy policy and RL policy, note that the peak rate allocation earns the same total amount of rewards (un-normalized) with both approaches. In Fig. 4, the Q-values are initialize so that the RL policy starts with the greedy policy. In the above examples, the performance improvement due to RL is more significant than the improvement due to statistical multiplexing. Because no fairness constraint is imposed for this case, rejection ratios for the two types of calls differ significantly. Our fairness constraint requires that the two rejection ratios cannot differ more than 5% on average. To test RL under the fairness constraint, we set the reward parameters for a type I call to be 1, and for a type II call to be 10, and keep other parameters in Table 1 unchanged. As stated before, we use feature-based state aggregation to cope with the difficulty of the large state space caused by fairness constraint. Specifically, we learn Q(h(-s); a) instead of Q(-s; a), where the feature quantization. In the following experiment, the experienced rejection ratio discrepancy f(R(-s)) is quantized into 100 levels, and - is quantized into only 2 levels, with corresponding to - 4 (the approximate average inter-arrival time), and Although s is not aggregated in this experiment, for cases where s is more complicated, it is also possible to aggregate s into a simpler feature. ! is found to be 80.0 in the simulation. The learned RL policy is compared with a greedy policy under the fairness constraint, which accepts all calls as long as the fairness constraint is met, otherwise, if the fairness constraint is violated, it only accepts calls from the class experiencing highest rejection ratio. The results are shown in Figs. 6 and 7. With fairness as a strong constraint on possible policies, the gain due to RL reduces as expected. From Figs. 1, 4, and 6, we see that Q-learning converges quickly. The fact that the RL curves in these figures show oscillations is connected with the learning rates, REINFORCEMENT LEARNING FOR CALL ADMISSION CONTROL 17 total reward Comparison of different policies, exponential ON/OFF246 1.RL: QoS given 2.RL: QoS learned 3.RL: peak rate 4.Greedy, type only 5.Greedy: QoS given 6.Greedy: peak rate Figure 1. Comparison of total rewards of RL while learning QoS (capacity constraint RL with given QoS measurements, RL with peak rate, greedy policies and peak rate allocation, normalized by the greedy total reward rates 1-Greedy: peak rate, 2-RL: peak rate, 3-Greedy: QoS given, 4-RL: QoS learned, exponential ON/OFF Figure 2. Comparison of rejection ratios for the policies learned in Fig. 1. a) in (13). Specifically, in order for Q-learning to converge, fl k (s; a) have to satisfy (16) and (17) for all (s; a). But in the simulations, we used a small constant learning rate, condition (17) is not met. The reason that (17) is not adhered to is because typically, there is no prior knowledge as to how and when a) should be decreased - once the learning rate becomes very small, the algorithm may stop making any noticeable progress, and the training process could become too long. 6. Combining CAC with network routing In general, the issues of CAC and routing are closely related in a communication network. Combined CAC and routing can also be formulated as a SMDP. However, the exact characterization of network state would require the specification of the number of calls in progress from each class on each possible route in the network. Such a detailed specification of state is intractable for computation. By assuming statistical independence of the links in the network (Dziong, 1997, Krishnan, 1990), some form of decompositions of network routing process into single link processes is usually employed (Dziong and Mason, 1994, Marbach, et al, 1998). Based on the preceding results for single link admission control and the link state independence approximation, we propose a decomposition rule that allows decentralized training and decision making for combined CAC and routing in a network, which also tries to maximize the network revenue. 123579number of users of class number of users of class II comparison of accept regions Aggressive Conservative Figure 3. Comparison of acceptance regions. total reward Comparison of different policies, exponential ON/OFF RL: QoS learned Greedy: QoS given Greedy: peak rate Figure 4. Comparison of total rewards of RL while learning QoS (capacity constraint Greedy policy and peak rate alloca- tion, normalized by the greedy total reward, Aggressive. 30.10.30.50.70.9rejection rates 1-Greedy: peak rate, 2-Greedy: QoS given, 3-RL: QoS learned, exponentialON/OFF Figure 5. Comparison of rejection ratios for the policies learned in Fig. 4. REINFORCEMENT LEARNING FOR CALL ADMISSION CONTROL 19 total reward Comparison of different policies, exponential ON/OFF RL: QoS learned Greedy: QoS given Figure 6. Comparison of total rewards obtained from RL policy and Greedy policy, when both capacity constraint and fairness constraint are imposed, normalized by the greedy total reward. rejection rates Figure 7. Comparison of rejection ratios with both capacity constraint and fairness constraint for the policies learned in Fig. 6. Let R denote all the predefined routes in the network, the action space for the system is action due to call departures, route the new call over route r 2Rg. Each link (i; j), from node i to node j, keeps a separate is the link state variable. Whenever a new call of type k is routed over a route r which contains link (i; j), the immediate reward associated with the link (i; j) is equal to c ij satisfying (i;j)2r For example, is the number of links along the route r. Q-learning can be performed for each link similarly as in the single link case. At each arrival, we update the Q-value of link (i; j), only if this arrival is associated with the link. For a new type k call originated at node o, destined for node d, the decision is made at node o in the following way: od ) be the set of routes that can carry the call without violating QoS constraints; ii) Define the net gain g r of accepting the new call under routing decision r by ae P (i;j)2r \Theta Figure 8. Network model. The admission and routing decision is r r2A(s od )[f0g r (34) Decision Making: If r reject the call. Otherwise, route the call over route r . In the above approach, although the network state s is simplified into the link state each link, the action space for each link is not simplified into acceptg, as in Dziong and Mason (1994), Marbach, et al (1998). This is important since by doing so the link Q-functions can distinguish single-link calls from multi-link calls, and avoid accepting too many multi-link calls, and block single-link calls that may bring the same amount of revenue while using less network resources. Table 2. Experimental parameters Source Type Parameter I II III On rate, r Call arrival rate, - 0.1 0.1 0.067 Call holding time, 1=- 200 180 120 Immediate payoff, We present simulation results obtained for the case of a network consisting of 4 nodes and 12 unidirectional links. There are two different classes of links with a total bandwidth of 1.5 and 2 units, respectively (indicated by thick and thin arrows REINFORCEMENT LEARNING FOR CALL ADMISSION CONTROL 21 in Fig. 8). We assume three different source types, whose parameters are given in Table 2. Call arrivals at each node are independent Poisson processes with mean -, the destination node is randomly selected among the other three nodes. For each source and destination node pair, the list of possible routes consists of three entries: the direct path and two alternative 2-hop routes. To emphasize the effect of RL, we only consider the capacity constraint and assume peak rate allocation on each link in the simulations. We use feature-based state aggregation to approximate the Q-values for each link, where we learn Q(h(s); r) instead of Q(s; r), and i.e., the numbers of ongoing calls from each type are aggregated into eight levels. The policy obtained through RL is compared with a commonly used heuristic policy that gives the direct path priority. When the direct path reaches its capacity, the heuristic will try the 2-hop routes, and find one that does not violate the capacity constraint. If no such route exists, the call is rejected. The results are given in Fig. 9 (Total Fig. 10 (Call rejection ratios), and Fig. 11 (Routing behavior). The results show that the RL policy increases the total revenue by almost 30% compare to the commonly used heuristic routing policy. 7. Conclusion This paper formulates the CAC and routing problem as a constrained SMDP, and provides a RL algorithm for computing the optimal control policy. We incorporate two important classes of QoS constraints, state-dependent and past-dependent con- straints, into a RL solution to maximize a network's revenue. The formulation is quite general and has been applied to the capacity and fairness constraints. The approach was experimented with on a single link as well as a network problem, and we showed significant improvement even for simple examples. Future work includes: further study on combined CAC and routing; and studying other function approximators, such as neural networks, to approximate Q-value functions. Acknowledgments This work was funded by NSF CAREER Award NCR-9624791. Appendix Proof for the simplified learning process The following Theorem shows that we can avoid learning Q-values at state transitions corresponding to calls being turned on or off (Section 3.1), and call departures (Section 3.4). Let J ff and c(s; A(s)g be the set of the intermediate states, g. 22 H. TONG AND T.X BROWN total reward Comparison of different routing policies, exponential ON/OFF RL Heuristic Figure 9. Comparison of the total rewards for the 4-node network, normalized by the Heuristic total reward. 20.10.30.50.70.9Rejection ratios: 1-Heuristic, 2-RL, exponential ON/OFF rejection rates Figure 10. Comparison of the rejection ratios for the policies in Fig. 9. Routing-Heuristic portion of calls routed on direct and paths direct 1st 2-hop 2nd 2-hop Routing-RL portion of calls routed on direct and paths direct 1st 2-hop 2nd 2-hop Figure 11. Comparison of the routing behavior for the policies in Fig. 9. REINFORCEMENT LEARNING FOR CALL ADMISSION CONTROL 23 Theorem 2. Assume that from each s 2 S 2 , a 2 A(s), it takes at most m sa steps to go to a state - s 0 all the states between s and - s 0 are in S 1 , and 1. Then the optimal stationary policy for the modified decision process by only considering states in S 2 is also optimal for the original decision process. Proof: The optimal policy for the original problem is Z 1e \Gammaff- dF ss 0 (-ja) for all s 2 S. The optimal policy - ff for the modified decision process is, since there is only one feasible action in A(s) for s 2 S 1 . For each s 2 S 2 , n in (18) can be at most m sa due to the assumption. hi Z 1e \Gammaff- dF ss 0 (-ja) oe where s 0 is the first state after s that is in S 2 . Define Z 1e \Gammaff- dF ss 0 (-ja) Since m sa is finite, without loss of generality, assume m other values of sa , the procedure is similar). The summation term in (A.3) becomes hi "/ \DeltaD(s; The second summation in the second term of the above formula is due to the condition that p(-s Combining (A.5) and (A.6) From (A.3), (A.4), and (A.7), we have for all s Z 1e \Gammaff- dF ss 0 (-ja) By the uniqueness of the optimal value function, it is easy to verify that J ff Therefore, by (A.1), (A.2), and (A.8) In the above proof, e.g. (A.4), we used the memoryless property of the transition processes. In CAC, states such as s serve as - s 0 . Since from s 0 , it is not possible to have any more call departures. And due to the capacity constraint, from any state s, under any action a, it will take at most finite number of consecutive call departures to reach a state like s 0 . --R Adaptive control of constrained Markov chains. Data Networks Adaptive statistical multiplexing for broadband communications. Optimizing admission control while ensuring quality of service in multimedia networks via reinforcement learning. Control of self-similar ATM call traffic by reinforcement learning Call admission and routing in multi-service loss networks IEEE Trans. ATM Network Resource Management Constrained semi-Markov decision processes with average reward International Conference on Machine Learning Markov decision algorithms for dynamic routing. A Neuro-Dynamic Approach to Admission Control in ATM Networks: The Single Single Link Case Reinforcement learning for call admission control and routing in integrated service networks. Robust dynamic admission control for unified cell and call QoS in statistical multiplexers. Reinforcement learning for dynamic channel allocation in cellular telephone systems. Reinforcement Learning The asymptotic convergence-rate of Q-learning Advances in NIPS 10 Estimating loss rates in an integrated services network by neural networks. Adaptive call admission control under quality of service con- straints: a reinforcement learning solution --TR
routing;reinforcement learning;call admission control;quality of service;multimedia networks
599699
Near-Optimal Reinforcement Learning in Polynomial Time.
We present new algorithms for reinforcement learning and prove that they have polynomial bounds on the resources required to achieve near-optimal return in general Markov decision processes. After observing that the number of actions required to approach the optimal return is lower bounded by the mixing time T of the optimal policy (in the undiscounted case) or by the horizon time T (in the discounted case), we then give algorithms requiring a number of actions and total computation time that are only polynomial in T and the number of states and actions, for both the undiscounted and discounted cases. An interesting aspect of our algorithms is their explicit handling of the Exploration-Exploitation trade-off.
Introduction In reinforcement learning, an agent interacts with an unknown environment, and attempts to choose actions that maximize its cumulative payo (Sut- ton & Barto, 1998; Barto et al., 1990; Bertsekas & Tsitsiklis, 1996). The environment is typically modeled as a Markov decision process (MDP), and it is assumed that the agent does not know the parameters of this process, but has to learn how to act directly from experience. Thus, the reinforcement learning agent faces a fundamental trade-o between exploitation and exploration (Bertsekas, 1987; Kumar & Varaiya, 1986; Thrun, 1992): that is, should the agent exploit its cumulative experience so far, by executing the action that currently seems best, or should it execute a dierent action, with the hope of gaining information or experience that could lead to higher future payos? Too little exploration can prevent the agent from ever converging to the optimal behavior, while too much exploration can prevent the agent from gaining near-optimal payo in a timely fashion. There is a large literature on reinforcement learning, which has been growing rapidly in the last decade. Many dierent algorithms have been proposed to solve reinforcement learning problems, and various theoretical results on the convergence properties of these algorithms have been proven. For example, Watkins Q-learning algorithm guarantees asymptotic convergence to optimal values (from which the optimal actions can be derived) provided every state of the MDP has been visited an innite number of times (Watkins, 1989; Watkins & Dayan, 1992; Jaakkola et al., 1994; Tsitsiklis, 1994). This asymptotic result does not specify a strategy for achieving this innite exploration, and as such does not provide a solution to the inherent exploitation-exploration trade-o. To address this, Singh et al. (1998) specify two exploration strategies that guarantee both su-cient exploration for asymptotic convergence to optimal actions, and asymptotic exploitation, for both the Q-learning and SARSA algorithms (a variant of Q-learning) (Rum- mery & Niranjan, 1994; Singh & Sutton, 1996; Sutton, 1995). Gullapalli and Barto (1994) and Jalali and Ferguson (1989) presented algorithms that learn a model of the environment from experience, perform value iteration on the estimated model, and with innite exploration converge to the optimal policy asymptotically. These results, and to the best of our knowledge, all other results for reinforcement learning in general MDPs, are asymptotic in nature, providing no guarantee on either the number of actions or the computation time the agent requires to achieve near-optimal performance. On the other hand, non-asymptotic results become available if one considers restricted classes of MDPs, if the model of learning is modied from the standard one, or if one changes the criteria for success. Thus, Saul and Singh (1996) provide an algorithm and learning curves (convergence rates) for an interesting special class of MDPs problem designed to highlight a particular exploitation-exploration trade-o. Fiechter (1994; 1997), whose results are closest in spirit to ours, considers only the discounted-payo case, and makes the learning protocol easier by assuming the availability of a \reset" button that allows his agent to return to a set of start-states at arbitrary times. Others have provided non-asymptotic results for prediction in uncontrolled Markov processes (Schapire & Warmuth, 1994; Singh & Dayan, 1998). Thus, despite the many interesting previous results in reinforcement learning, the literature has lacked algorithms for learning optimal behavior in general MDPs with provably nite bounds on the resources (actions and computation time) required, under the standard model of learning in which the agent wanders continuously in the unknown environment. The results presented in this paper ll this void in what is essentially the strongest possible sense. We present new algorithms for reinforcement learning, and prove that they have polynomial bounds on the resources required to achieve near-optimal payo in general MDPs. After observing that the number of actions required to approach the optimal return is lower bounded, for any algorithm, by the mixing time T of the optimal policy (in the undiscounted-payo case) or by the horizon time T (in the discounted-payo case), we then give algorithms requiring a number of actions and total computation time that are only polynomial in T and the number of states, for both the undiscounted and discounted cases. An interesting aspect of our algorithms is their rather explicit handling of the exploitation-exploration trade-o. Two important caveats apply to our current results, as well as all the prior results mentioned above. First, we assume that the agent can observe the state of the environment, which may be an impractical assumption for some reinforcement learning problems. Second, we do not address the fact that the state space may be so large that we will have to resort to methods such as function approximation. While some results are available on reinforcement learning and function approximation (Sutton, 1988; Singh et al., 1995; Gordon, 1995; Tsitsiklis & Roy, 1996), and for partially observable MDPs (Chrisman, 1992; Littman et al., 1995; Jaakkola et al., 1995), they are all asymptotic in nature. The extension of our results to such cases is left for future work. The outline of the paper is as follows: in Section 2, we give standard denitions for MDPs and reinforcement learning. In Section 3, we argue that the mixing time of policies must be taken into consideration in order to obtain nite-time convergence results in the undiscounted case, and make related technical observations and denitions. Section 4 makes similar arguments for the horizon time in the discounted case, and provides a needed technical lemma. The heart of the paper is contained in Section 5, where we state and prove our main results, describe our algorithms in detail, and provide intuitions for the proofs of convergence rates. Section 6 eliminates some technical assumptions that were made for convenience during the main proofs, while Section 7 discusses some extensions of the main theorem that were deferred for the exposition. Finally, in Section 8 we close with a discussion of future work. Preliminaries and Denitions We begin with the basic denitions for Markov decision processes. Denition 1 A Markov decision process (MDP) M on states and with actions a The transition probabilities P a which for any action a, and any states i and j, specify the probability of reaching state j after executing action a from state i in M . Thus, state i and action a. The payo distributions, for each state i, with mean RM (i) (where R max RM (i) 0), and variance Var M (i) Var max . These distributions determine the random payo received when state i is visited. For simplicity, we will assume that the number of actions k is a constant; it will be easily veried that if k is a parameter, the resources required by our algorithms scale polynomially with k. Several comments regarding some benign technical assumptions that we will make on payos are in order here. First, it is common to assume that payos are actually associated with state-action pairs, rather than with states alone. Our choice of the latter is entirely for technical simplicity, and all of the results of this paper hold for the standard state-action pay- os model as well. Second, we have assumed xed upper bounds R max and Var max on the means and variances of the payo distributions; such a restriction is necessary for nite-time convergence results. Third, we have assumed that expected payos are always non-negative for convenience, but this is easily removed by adding a su-ciently large constant to every payo. Note that although the actual payos experienced are random variables governed by the payo distributions, for most of the paper we will be able to perform our analyses in terms of the means and variances; the only exception will be in Section 5.5, where we need to translate high expected payos into high actual payos. We now move to the standard denition of a stationary and deterministic policy in an MDP. Denition 2 Let M be a Markov decision process over states with actions a . A policy in M is a mapping g. Later we will have occasion to dene and use non-stationary policies, that is, policies in which the action chosen from a given state also depends on the time of arrival at that state. An MDP M , combined with a policy , yields a standard Markov process on the states, and we will say that is ergodic if the Markov process resulting from is ergodic (that is, has a well-dened stationary distribu- tion). For the development and exposition, it will be easiest to consider MDPs for which every policy is ergodic, the so-called unichain MDPs (Put- erman, 1994). In a unichain MDP, the stationary distribution of any policy does not depend on the start state. Thus, considering the unichain case simply allows us to discuss the stationary distribution of any policy without cumbersome technical details, and as it turns out, the result for unichains already forces the main technical ideas upon us. Our results generalize to non-unichain (multichain) MDPs with just a small and necessary change to the denition of the best performance we can expect from a learning algo- rithm. This generalization to multichain MDPs will be given in Section 7. In the meantime, however, it is important to note that the unichain assumption does not imply that every policy will eventually visit every state, or even that there exists a single policy that will do so quickly; thus, the exploitation-exploration dilemma remains with us strongly. The following denitions for nite-length paths in MDPs will be of repeated technical use in the analysis. Denition 3 Let M be a Markov decision process, and let be a policy in M . A T-path in M is a sequence p of T of The probability that p is traversed in M upon starting in state i 1 and executing policy is Pr We now dene the two standard measures of the return of a policy. Denition 4 Let M be a Markov decision process, let be a policy in M , and let p be a T -path in M . The (expected) undiscounted return along in M is (R and the (expected) discounted return along p in M is < 1 is a discount factor that makes future reward less valuable than immediate reward. The T-step undiscounted return from state i is U Pr and the T-step discounted return from state i is Pr where in both cases the sum is over all T -paths p in M that start at i. We dene U are in the unichain case, U M (i) is independent of i, and we will simply write U M . Furthermore, we dene the optimal T-step undiscounted return from i in M by U fU and similarly, the optimal T-step discounted return from i in M by Also, U are in the unichain case, U M (i) is independent of i, and we will simply write U M . The existence of these limits is guaranteed in the unichain case. Finally, we denote the maximum possible T -step return by G T the undiscounted case G T while in the discounted case G T TR max . 3 The Undiscounted Case and Mixing Times It is easy to see that if we are seeking results about the undiscounted return of a learning algorithm after a nite number of steps, we need to take into account some notion of the mixing times of policies in the MDP. To put it simply, in the undiscounted case, once we move from the asymptotic return to the nite-time return, there may no longer be a well-dened notion of \the" optimal policy. There may be some policies which will eventually yield high return (for instance, by nally reaching some remote, high-payo state), but take many steps to approach this high return, and other policies which yield lower asymptotic return but higher short-term return. Such policies are simply incomparable, and the best we could hope for is an algorithm that \competes" favorably with any policy, in an amount of time that is comparable to the mixing time of that policy . The standard notion of mixing time for a policy in a Markov decision process M quanties the smallest number T of steps required to ensure that the distribution on states after T steps of is within of the stationary distribution induced by , where the distance between distributions is measured by the Kullback-Leibler divergence, the variation distance, or some other standard metric. Furthermore, there are well-known methods for bounding this mixing time in terms of the second eigenvalue of the transition matrix P M , and also in terms of underlying structural properties of the transition graph, such as the conductance (Sinclair, 1993). It turns out that we can state our results for a weaker notion of mixing that only requires the expected return after T steps to approach the asymptotic return. Denition 5 Let M be a Markov decision process, and let be an ergodic policy in M . The -return mixing time of is the smallest T such that for all T 0 T , jU Suppose we are simply told that there is a policy whose asymptotic return U exceeds some value R in an unknown MDP M , and that the Reward R Reward 0 1- D Figure 1: A simple Markov process demonstrating that nite-time convergence results must account for mixing times. -return mixing time of is T . In principle, a su-ciently clever learning algorithm (for instance, one that managed to discover \quickly") could achieve return close to U M in not much more than T steps. Conversely, without further assumptions on M or , it is not reasonable to expect any learning algorithm to approach return U M in many fewer than T steps. This is simply because it may take the assumed policy itself on the order of T steps to approach its asymptotic return. For example, suppose that M has just two states and only one action (see Figure 1): state 0 with payo 0, self-loop probability 1 , and probability of going to state 1; and absorbing state 1 with payo R >> 0. Then for small and , the -return mixing time is on the order of 1=; but starting from state 0, it really will require on the order of 1= steps to reach the absorbing state 1 and start approaching the asymptotic return R. We now relate the notion of -return mixing time to the standard notion of mixing time. be a Markov decision process on N states, and let be an ergodic policy in M . Let T be the smallest value such that for all T 0 T , for any state i, the probability of being in state i after T 0 steps of is within of the stationary probability of i under . Then the -return mixing time of is at most 3TRmax . The proof of the lemma follows in a straightforward way from the linearity of expectations, and is omitted. The important point is that the -return mixing time is polynomially bounded by the standard mixing time, but may in some cases be substantially smaller. This would happen, for instance, if the policy quickly settles on a subset of states with common payo, but takes a long time to settle to its stationary distribution within this subset. Thus, we will choose to state our results for the undiscounted return in terms of the -return mixing time, but can always translate into the standard notion via Lemma 1. With the notion of -return mixing time, we can now be more precise about what type of result is reasonable to expect for the undiscounted case. We would like a learning algorithm such that for any T , in a number of actions that is polynomial in T , the return of the learning algorithm is close to that achieved by the best policy among those that mix in time T . This motivates the following denition. Denition 6 Let M be a Markov decision process. We dene T; M to be the class of all ergodic policies in M whose -return mixing time is at most T . We let opt( T; M ) denote the optimal expected asymptotic undiscounted return among all policies in T; M . Thus, our goal in the undiscounted case will be to compete with the policies in T; M in time that is polynomial in T , 1= and N . We will eventually give an algorithm that meets this goal for every T and simultaneously . An interesting special case is when is the -mixing time of the asymptotically optimal policy, whose asymptotic return is U . Then in time polynomial in T , 1= and N , our algorithm will achieve return exceeding U with high probability. It should be clear that, modulo the degree of the polynomial running time, such a result is the best that one could hope for in general MDPs. 4 The Discounted Case and the Horizon Time For the discounted case, the quantication of which policies a learning algorithm is competing against is more straightforward, since the discounting makes it possible in principle to compete against all policies in time proportional to the horizon time. In other words, unlike in the undiscounted case, the expected discounted return of any policy after T 1=(1 steps approaches the expected asymptotic discounted return. This is made precise by the following lemma. be any Markov decision process, and let be any policy in M . If then for any state i, We call the value of the lower bound on T given above the -horizon time for the discounted MDP M . Proof: The lower bound on V M (i) follows trivially from the denitions, since all expected payos are nonnegative. For the upper bound, x any innite path p, and let R 1 be the expected payos along this path. Then is the T -path prex of the innite path p. Solving for T yields the desired bound on T ; since the inequality holds for every xed path, it also holds for the distribution over paths induced by any policy .In the discounted case, we must settle for a notion of \competing" that is slightly dierent than for the undiscounted case. The reason is that while in the undiscounted case, since the total return is always simply averaged , a learning algorithm can recover from its \youthful mistakes" (low return during the early part of learning), this is not possible in the discounted case due to the exponentially decaying eects of the discounting factor. The most we can ask for is that, in time polynomial in the -horizon time, the learning algorithm has a policy that, from its current state, has discounted return within of the asymptotic optimal for that state. Thus, if time were reinitialized to 0, with the current state being the start state, the learned policy would have near-optimal expected return. This is the goal that our algorithm will achieve for general MDPs in the discounted case. 5 Main Theorem We are now ready to describe our new learning algorithms, and to state and prove our main theorem: namely, that the new algorithms will, for a general MDP, achieve near-optimal performance in polynomial time, where the notions of performance and the parameters of the running time (mixing and horizon times) have been described in the preceding sections. For ease of exposition only , we will rst state the theorem under the assumption that the learning algorithm is given as input a \targeted" mixing time T , and the optimal return opt( T; achieved by any policy mixing within T steps (for the undiscounted case), or the optimal value function V (i) (for the discounted case). This simpler case already contains the core ideas of the algorithm and analysis, and these assumptions are entirely removed in Section 6. Theorem 3 (Main Theorem) Let M be a Markov decision process over N states. (Undiscounted case) Recall that T; M is the class of all ergodic policies whose -return mixing time is bounded by T , and that opt( T; M ) is the optimal asymptotic expected undiscounted return achievable in T; M . There exists an algorithm A, taking inputs ; -; N;T and opt( T; such that the total number of actions and computation time taken by A is polynomial in 1=; 1=-; N , T , and R max , and with probability at least 1 -, the total actual return of A exceeds opt( T; (Discounted case) Let V (i) denote the value function for the policy with the optimal expected discounted return in M . Then there exists an algorithm A, taking inputs ; -; N and V (i), such that the total number of actions and computation time taken by A is polynomial in 1=; 1=-; N , the horizon time ), and R max , and with probability at least 1 -, A will halt in a state i, and output a policy The remainder of this section is divided into several subsections, each describing a dierent and central aspect of the algorithm and proof. The full proof of the theorem is rather technical, but the underlying ideas are quite intuitive, and we sketch them rst as an outline. 5.1 High-Level Sketch of the Proof and Algorithms Although there are some dierences between the algorithms and analyses for the undiscounted and discounted cases, for now it will be easiest to think of there being only a single algorithm. This algorithm will be what is commonly referred to as indirect or model-based : namely, rather than only maintaining a current policy or value function, the algorithm will actually maintain a model for the transition probabilities and the expected payos for some subset of the states of the unknown MDP M . It is important to emphasize that although the algorithm maintains a partial model of M , it may choose to never build a complete model of M , if doing so is not necessary to achieve high return. It is easiest to imagine the algorithm as starting by doing what we will call balanced wandering . By this we mean that the algorithm, upon arriving in a state it has never visited before, takes an arbitrary action from that state; but upon reaching a state it has visited before, it takes the action it has tried the fewest times from that state (breaking ties between actions randomly). At each state it visits, the algorithm maintains the obvious statistics: the average payo received at that state so far, and for each action, the empirical distribution of next states reached (that is, the estimated transition probabilities). A crucial notion for both the algorithm and the analysis is that of a known state. Intuitively, this is a state that the algorithm has visited \so many" times (and therefore, due to the balanced wandering, has tried each action from that state many times) that the transition probability and expected payo estimates for that state are \very close" to their true values in M . An important aspect of this denition is that it is weak enough that \so many" times is still polynomially bounded, yet strong enough to meet the simulation requirements we will outline shortly. The fact that the denition of known state achieves this balance is shown in Section 5.2. States are thus divided into three categories: known states, states that have been visited before, but are still unknown (due to an insu-cient number of visits and therefore unreliable statistics), and states that have not even been visited once. An important observation is that we cannot do balanced wandering indenitely before at least one state becomes known: by the Pigeonhole Principle, we will soon start to accumulate accurate statistics at some state. This fact will be stated more formally in Section 5.5. Perhaps our most important denition is that of the known-state MDP . If S is the set of currently known states, the current known-state MDP is simply an MDP M S that is naturally induced on S by the full MDP M ; brie y, all transitions in M between states in S are preserved in M S , while all other transitions in M are \redirected" in M S to lead to a single additional, absorbing state that intuitively represents all of the unknown and unvisited states. Although the learning algorithm will not have direct access to M S , by virtue of the denition of the known states, it will have an approximation . The rst of two central technical lemmas that we prove (Section 5.2) shows that, under the appropriate denition of known state, ^ good simulation accuracy : that is, the expected T -step return of any policy M S is close to its expected T -step return in M S . (Here T is either the mixing time that we are competing against, in the undiscounted case, or the horizon time, in the discounted case.) Thus, at any time, ^ M S is a partial model of M , for that part of M that the algorithm \knows" very well. The second central technical lemma (Section 5.3) is perhaps the most enlightening part of the analysis, and is named the \Explore or Exploit" Lemma. It formalizes a rather appealing intuition: either the optimal (T - step) policy achieves its high return by staying, with high probability, in the set S of currently known states | which, most importantly, the algorithm can detect and replicate by nding a high-return exploitation policy in the partial model ^ S | or the optimal policy has signicant probability of leaving S within T steps | which again the algorithm can detect and replicate by nding an exploration policy that quickly reaches the additional absorbing state of the partial model ^ Thus, by performing two o-line, polynomial-time computations on ^ (Section 5.4), the algorithm is guaranteed to either nd a way to get near-optimal return in M quickly, or to nd a way to improve the statistics at an unknown or unvisited state. Again by the Pigeonhole Principle, the latter case cannot occur too many times before a new state becomes known, and thus the algorithm is always making progress. In the worst case, the algorithm will build a model of the entire MDP M , but if that does happen, the analysis guarantees that it will happen in polynomial time. The following subsections esh out the intuitions sketched above, providing the full proof of Theorem 3. In Section 6, we show how to remove the assumed knowledge of the optimal return. 5.2 The Simulation Lemma In this section, we prove the rst of two key technical lemmas mentioned in the sketch of Section 5.1: namely, that if one M is a su-ciently accurate approximation of another MDP M , then we can actually approximate the T -step return of any policy in M quite accurately by its T -step return M . Eventually, we will appeal to this lemma to show that we can accurately assess the return of policies in the induced known-state MDP M S by computing their return in the algorithm's approximation ^ (that is, we will appeal to Lemma 4 below using the settings important technical point is that the goodness of approximation required depends only polynomially on 1=T , and thus the denition of known state will require only a polynomial number of visits to the state. We begin with the denition of approximation we require. Denition 7 Let M and ^ M be Markov decision processes over the same state space. Then we say that M is an -approximation of M if: For any state i, RM (i) R ^ For any states i and j, and any action a, P a We now state and prove the Simulation Lemma, which says that provided M is su-ciently close to M in the sense just dened, the T -step return of policies in ^ and M will be similar. Lemma 4 (Simulation Lemma) Let M be any Markov decision process over states. (Undiscounted M be an O((=(NTG T of M . Then for any policy in T;=2 1 , and for any state i, U (Discounted Case) Let T (1=(1 ))), and let M be an O(=(NTG T )-approximation of M . Then for any policy and any state i, 1 Note that the lemma for the undiscounted case is stated with respect to those policies whose =2-return mixing time is T , as opposed to -return mixing time. However, the =2- return and -return mixing times are linearly related by standard eigenvalue arguments. Proof: Let us x a policy and a start state i. Let us say that a transition from a state i 0 to a state j 0 under action a is -small in M if P a . Then the probability that T steps from state i following policy will cross at least one -small transition is at most NT . This is because the total probability of all -small transitions in M from any state i 0 under action (i 0 ) is at most N , and we have T independent opportunities to cross such a transition. This implies that the total expected contribution to either U by the walks of that cross at least one -small transition of M is at most NTG T Similarly, since P a implies P a M is an - approximation of M ), the total contribution to either U by the walks of that cross at least one -small transition of M is at most . We can thus bound the dierence between U U restricted to these walks by . We will eventually determine a choice for and solve for . Thus, for now we restrict our attention to the walks of length T that do not cross any -small transition of M . Note that for any transition satisfying P a , we can convert the additive approximation P a to the multiplicative approximation (1 )P a =. Thus, for any T -path p that, under , does not cross any -small transitions of M , we have For any T -path p, the approximation error in the payos yields and Since these inequalities hold for any xed T -path that does not traverse any -small transitions in M under , they also hold when we take expectations over the distributions on such T -paths in M and ^ M induced by . Thus, and where the additive =4 terms account for the contributions of the T -paths that traverse -small transitions under , as bounded by Equation (19). For the upper bounds, we will use the following Taylor expansion: Now to complete the analysis for the undiscounted case, we need two conditions to hold: and because then =2. The rst condition would be satised if solving for we obtain T=2 =8G T or =(4T G T This value of also implies that is a constant and therefore satisfying the second condition would require that Recalling the earlier constraint given by Equation (19), if we choose , then we nd that and =(4T G T and are all satised by the choice of given in the lemma. A similar argument yields the desired lower bound, which completes the proof for the undiscounted case. The analysis for the discounted case is entirely analogous, except we must additionally appeal to Lemma 2 in order to relate the T -step return to the asymptotic return. 2 The Simulation Lemma essentially determines what the denition of known state should be: one that has been visited enough times to ensure (with high probability) that the estimated transition probabilities and the estimated payo for the state are all within O((=(NTG T values. The following lemma, whose proof is a straightforward application of Cherno bounds, makes the translation between the number of visits to a state and the desired accuracy of the transition probability and payo estimates. Lemma 5 Let M be a Markov decision process. Let i be a state of M that has been visited at least m times, with each action a having been executed at least bm=kc times from i. Let ^ P a M (ij) denote the empirical probability transition estimates obtained from the m visits to i. For with probability at least 1 -, we have P a for all states j and actions a, and RM (i) RM where Var (i)] is the maximum variance of the random payos over all states. Thus, we get our formal denition of known states: Denition 8 Let M be a Markov decision process. We say that a state i of M is known if each action has been executed from i at least times. 5.3 The \Explore or Exploit" Lemma Lemma 4 indicates the degree of approximation required for su-cient simulation accuracy, and led to the denition of a known state. If we let S denote the set of known states, we now specify the straightforward way in which these known states dene an induced MDP. This induced MDP has an additional \new" state, which intuitively represents all of the unknown states and transitions. Denition 9 Let M be a Markov decision process, and let S be any subset of the states of M . The induced Markov decision process on S, denoted S , has states S [ fs 0 g, and transitions and payos dened as follows: For any state i 2 S, RMS all payos in M S are deterministic (zero variance) even if the payos in M are stochastic. For any action a, P a MS is an absorbing state. For any states any action a, P a MS (ij). Thus, transitions in M between states in S are preserved in M S . For any state i 2 S and any action a, P a MS (is 0 2S P a (ij). Thus, all transitions in M that are not between states in S are redirected to s 0 in M S . Denition 9 describes an MDP directly induced on S by the true unknown MDP M , and as such preserves the true transition probabilities between states in S. Of course, our algorithm will only have approximations to these transition probabilities, leading to the following obvious approximation to M denote the obvious empirical approximation to S is the natural approximation to M S . The following lemma establishes the simulation accuracy of ^ immediately from Lemma 4 and Lemma 5. Lemma 6 Let M be a Markov decision process, and let S be the set of currently known states of M . Then with probability at least 1 -, (Undiscounted Case) For any policy in T;=2 MS , and for any state i, U MS MS MS (Discounted Case) Let T (1=(1 ))). Then for any policy and any state i, MS (i) V MS (i) V MS (37)that is, the states of ^ are simply all the states visited so far, the transition probabilities of M are the observed transition frequencies, and the rewards are the observed rewards Let us also observe that any return achievable in M S (and thus approximately achievable in ^ achievable in the \real world" Lemma 7 Let M be a Markov decision process, and let S be the set of currently known states of M . Then for any policy in M , any state i 2 S, and any T , U MS MS Proof: Follows immediately from the facts that M S and M are identical on S, the expected payos are non-negative, and that outside of S no payo is possible in M S . 2 We are now at the heart of the analysis: we have identied a \part" of the unknown MDP M that the algorithm \knows" very well, in the form of the approximation M S to M S . The key lemma follows, in which we demonstrate the fact that M S (and thus, by the Simulation Lemma, ^ must always provide the algorithm with either a policy that will yield large immediate return in the true MDP M , or a policy that will allow rapid exploration of an unknown state in M (or both). Lemma 8 (Explore or Exploit Lemma) Let M be any Markov decision pro- cess, let S be any subset of the states of M , and let M S be the induced Markov decision process on M . For any i 2 S, any T , and any 1 > > 0, either there exists a policy in M S such that U MS (respectively, V MS there exists a policy in M S such that the probability that a walk of T steps following will terminate in Proof: We give the proof for the undiscounted case; the argument for the discounted case is analogous. Let be a policy in M satisfying U U suppose that U MS witnesses the claim of the lemma). We may write U Pr Pr r Pr where the sums are over, respectively, all T -paths p in M that start in state all T -paths q in M that start in state i and in which every state in q is in S, and all T -paths r in M that start in state i and in which at least one state is not in S. Keeping this interpretation of the variables p; q and r xed, we may write Pr Pr MS [q]U MS (q) U MS (i; T The equality follows from the fact that for any path q in which every state is in S, Pr MS [q] and UM and the inequality from the fact that U MS takes the sum over all T -paths in M S , not just those that avoid the absorbing state s 0 . Thus Pr which implies that X r Pr r Pr r Pr and so X r Pr as desired. 2 5.4 O-line Optimal Policy Computations Let us take a moment to review and synthesize. The combination of Lemmas 6, 7 and 8 establishes our basic line of argument: At any time, if S is the set of current known states, the T -step return of any policy in ^ lower bounds the T -step return of (any extension of) in M . At any time, there must either be a policy in ^ whose T -step return in M is nearly optimal, or there must be a policy in ^ M S that will quickly reach the absorbing state | in which case, this same policy, executed in M , will quickly reach a state that is not currently in the known set S. In this section, we discuss how with two o-line, polynomial-time computations , we can nd both the policy with highest return (the exploitation policy), and the one with the highest probability of reaching the absorbing state in T steps (the exploration policy). This essentially follows from the fact that the standard value iteration algorithm from the dynamic programming literature is able to nd T -step optimal policies for an arbitrary MDP with N states in O(N 2 T ) computation steps for both the discounted and the undiscounted cases. For the sake of completeness, we present the undiscounted and discounted value iteration algorithms (Bertsekas & Tsitsiklis, 1989) below. The optimal T -step policy may be non-stationary, and is denoted by a sequence t (i) is the optimal action to be taken from state i on the t th step. T-step Undiscounted Value Iteration: Initialize: for all For for all i, U t (i) MS MS (ij)U t+1 (j) for all i MS MS (ij)U t+1 (j)] Undiscounted value iteration works backwards in time, rst producing the optimal policy for time step T , then the optimal policy for time step T 1, and so on. Observe that for nite T a policy that maximizes cumulative T -step return will also maximize the average T -step return. T-step Discounted Value Iteration: Initialize: for all For for all MS a MS (ij)V t+1 (j) for all i MS MS (ij)V t+1 (j)] Again, discounted value iteration works backwards in time, rst producing the optimal policy for time step T , then the optimal policy for time step T 1, and so on. Note that the total computation involved is O(N 2 T ) for both the discounted and the undiscounted cases. Our use of value iteration will be straightforward: at certain points in the execution of the algorithm, we will perform value iteration o-line twice: once on ^ (using either the undiscounted or discounted version, depending on the measure of return), and a second time on what we will denote ^ (on which the computation will use undiscounted value iteration, regardless of the measure of return). The S has the same transition probabilities as dierent payos: in ^ S , the absorbing state s 0 has payo R max and all other states have payo 0. Thus we reward exploration (as represented by visits to s 0 ) rather than exploitation. If ^ is the policy returned by value iteration on 0 is the policy returned by value iteration on ^ guarantees that either the T -step return of ^ from our current known state approaches the optimal achievable in M (which for now we are assuming we know, and can thus detect), or the probability that ^ that the execution of ^ 0 in M reaches an unknown or unvisited state in T steps with signicant probability (which we can also detect). Putting it All Together All of the technical pieces we need are now in place, and we now give a more detailed description of the algorithm, and tie up some loose ends. In Section 6, we remove the assumption that we know the optimal returns that can be achieved in M . In the sequel, we will use the expression balanced wandering to denote the steps of the algorithm in which the current state is not a known state, and the algorithm executes the action that has been tried the fewest times before from the current state. Note that once a state becomes known, by denition it is never involved in a step of balanced wandering again. We use m known to denote the number of visits required to a state before it becomes a known state (dierent for the undiscounted and discounted cases), as given by Denition 8. We call the algorithm the Explicit Explore or Exploit (or because whenever the algorithm is not engaged in balanced wandering, it performs an explicit o-line computation on the partial model in order to nd a T -step policy guaranteed to either exploit or explore. In the description that follows, we freely mix the description of the steps of the algorithm with observations that will make the ensuing analysis easier to digest. The Explicit Explore or Exploit (Initialization) Initially, the set S of known states is empty. (Balanced Wandering) Any time the current state is not in S, the algorithm performs balanced wandering. (Discovery of New Known States) Any time a state i has been visited known times during balanced wandering, it enters the known set S, and no longer participates in balanced wandering. Observation: Clearly, after N(m known 1)+1 steps of balanced wan- dering, by the Pigeonhole Principle some state becomes known. This is the worst case, in terms of the time required for at least one state to become known. More generally, if the total number of steps of balanced wandering the algorithm has performed ever exceeds Nm known , then every state of M is known (even if these steps of balanced wandering are not consecutive). This is because each known state can account for at most m known steps of balanced wandering. (O-line Optimizations) Upon reaching a known state i 2 S during balanced wandering, the algorithm performs the two o-line optimal policy computations on ^ S described in Section 5.4: { (Attempted Exploitation) If the resulting exploitation policy ^ achieves return from i in ^ S that is at least U =2 (respec- tively, in the discounted case, at least V (i) =2), the algorithm executes for the next T steps (respectively, halts and outputs Here T is the given =2-mixing time given to the algorithm as input (respectively, the horizon time). { (Attempted Exploration) Otherwise, the algorithm executes the resulting exploration policy (derived from the o-line computation steps in M , which by Lemma 8 is guaranteed to have probability at least =(2G T leaving the set S. (Balanced Wandering) Any time an attempted exploitation or attempted exploration visits a state not in S, the algorithm immediately resumes balanced wandering. Observation: Thus, every action taken by the algorithm in M is either a step of balanced wandering, or is part of a T -step attempted exploitation or attempted exploration. This concludes the description of the algorithm; we can now wrap up the analysis. One of the main remaining issues is our handling of the condence parameter - in the statement of the main theorem: for both the undiscounted and discounted case, Theorem 3 ensures that a certain performance guarantee is met with probability at least 1 -. There are essentially three dierent sources of failure for the algorithm: At some known state, the algorithm actually has a poor approximation to the next-state distribution for some action, and thus ^ S does not have su-ciently strong simulation accuracy for M S . Repeated attempted explorations fail to yield enough steps of balanced wandering to result in a new known state. (Undiscounted case only) Repeated attempted exploitations fail to result in actual return near U . Our handling of the failure probability - is to simply allocate -=3 to each of these sources of failure. The fact that we can make the probability of the rst source of failure (a \bad" known state) controllably small is quantied by Lemma 6. Formally, we use - Lemma 6 to meet the requirement that all states in M S be known simultaneously. For the second source of failure (failed attempted explorations), a standard Cherno bound analysis su-ces: by Lemma 8, each attempted exploration can be viewed as an independent Bernoulli trial with probability at least =(2G T least one step of balanced wandering). In the worst case, we must make every state known before we can exploit, requiring Nm known steps of balanced wandering. The probability of having fewer than Nm known steps of balanced wandering will be smaller than -=3 if the number of (T -step) attempted explorations is O((G T We can now nish the analysis for the discounted case. In the discounted case, if we ever discover a policy ^ whose return from the current state i in M S is close to V (i) (attempted exploitation), then the algorithm is nished by arguments already detailed | since (with high probability) ^ M S is a very accurate approximation of part of M , ^ must be a near-optimal policy from in M as well (Lemma 7). As long as the algorithm is not nished, it must be engaged in balanced wandering or attempted explorations, and we have already bounded the number of such steps before (with high probability) every state is in the known set S. If and when S does contain all states of M , then ^ M S is actually an accurate approximation of the entire MDP M , and then Lemma 8 ensures that exploitation must be possible (since exploration is not). We again emphasize that the case in which S eventually contains all of the states of M is only the worst case for the analysis | the algorithm may discover it is able to halt with a near-optimal exploitation policy long before this ever occurs. Using the value of m known given for the discounted case by Denition 8, the total number of actions executed by the algorithm in the discounted case is thus bounded by T times the maximum number of attempted explorations, given by Equation (45), for a bound of The total computation time is bounded by O(N 2 T ) (the time required for the o-line computations) times the maximum number of attempted explo- rations, giving For the undiscounted case, things are slightly more complicated, since we do not want to simply halt upon nding a policy whose expected return is near U , but want to achieve actual return approaching U , which is where the third source of failure (failed attempted exploitations) enters. We have already argued that the total number of T -step attempted explorations the algorithm can perform before S contains all states of M is polynomially bounded. All other actions of the algorithm must be accounted for by T -step attempted exploitations. Each of these T -step attempted exploitations has expected return at least U =2. The probability that the actual return, restricted to just these attempted exploitations, is less than U 3=4, can be made smaller than -=3 if the number of blocks exceeds O((1=) 2 log(1=-)); this is again by a standard Cherno bound analysis. However, we also need to make sure that the return restricted to these exploitation blocks is su-cient to dominate the potentially low return of the attempted explorations. It is not di-cult to show that provided the number of attempted exploitations exceeds O(G T times the number of attempted explorations (bounded by Equation (45)), both conditions are satised, for a total number of actions bounded by O(T=) times the number of attempted explorations, which is The total computation time is thus O(N 2 T=) times the number of attempted explorations, and thus bounded by This concludes the proof of the main theorem. We remark that no serious attempt to minimize these worst-case bounds has been made; our immediate goal was to simply prove polynomial bounds in the most straightforward manner possible. It is likely that a practical implementation based on the algorithmic ideas given here would enjoy performance on natural problems that is considerably better than the current bounds indicate. (See Moore and Atkeson, 1993, for a related heuristic algorithm.) 6 Eliminating Knowledge of the Optimal Returns and the Mixing Time In order to simplify our presentation of the main theorem, we made the assumption that the learning algorithm was given as input the targeted mixing time T and the optimal return opt( T; achievable in this mixing time (in the undiscounted case), or the value function V (i) (in the discounted case; the horizon time T is implied by knowledge of the discounting factor In this section, we sketch the straightforward way in which these assumptions can be removed without changing the qualitative nature of the results, and brie y discuss some alternative approaches that may result in a more practical version of the algorithm. Let us begin by noting that knowledge of the optimal returns opt( T; or V (i) is used only in the Attempted Exploitation step of the algorithm, where we must compare the return possible from our current state in ^ with the best possible in the entire unknown MDP M . In the absence of this knowledge, the Explore or Exploit Lemma (Lemma ensures us that it is safe to have a bias towards exploration. More precisely, any time we arrive in a known state i, we will rst perform the Attempted Exploration o-line computation on the modied known-state MDP ^ S described in Section 5.4, to obtain the optimal exploration policy ^ 0 . Since it is a simple matter to compute the probability that ^ 0 will reach the absorbing state s 0 of S in T steps, we can then compare this probability to the lower bound As long as this lower bound is exceeded, we may 0 in an attempt to visit a state not in S. If this lower bound is not guarantees that the o-line computation on ^ S in the Attempted Exploitation step must result in an exploitation policy ^ that is close to optimal. As before, in the discounted case we halt and output ^ while in the undiscounted case we execute ^ in M and continue. Note that this exploration-biased solution to removing knowledge of results in the algorithm always exploring all states of M that can be reached in a reasonable amount of time, before doing any ex- ploitation. Although this is a simple way of removing the knowledge while keeping a polynomial-time algorithm, practical variants of our algorithm might pursue a more balanced strategy, such as the standard approach of having a strong bias towards exploitation instead, but doing enough exploration to ensure rapid convergence to the optimal performance. For instance, we can maintain a schedule (t) 2 [0; 1], where t is the total number of actions taken in M by the algorithm so far. Upon reaching a known state, the algorithm performs Attempted Exploitation (execution of ^ Attempted Exploration (execution of ^ (t). For choices such as analyses ensure that we will still explore enough that ^ S will, in polynomial time, contain a policy whose return is near the optimal of M , but the return we have enjoyed in the meantime may be much greater than the exploration-biased solution given above. Note that this approach is similar in spirit to the \-greedy" method of augmenting algorithms such as Q-learning with an exploration component, but with a crucial dierence: while in -greedy exploration, we with probability (t) attempt a single action designed to visit a rarely visited state, here we are proposing that with probability (t) we execute a multi-step policy for reaching an unknown state, a policy that is provably justied by ^ S . For the undiscounted case, it still remains to remove our assumption that the algorithm knows the targeted mixing time T . Indeed, we would like to state our main theorem for any value of T : that is, for any T , as long as we run the algorithm for a number of steps that is polynomial in T and the other parameters, the total return will exceed opt( T; probability. This is easily accomplished: ignoring all other parameters, we already have an algorithm A(T ) that, given T as input, runs for P (T ) steps for some xed polynomial P () and meets the desired criterion. We now propose a new algorithm A 0 , which does not need T as input, and simply runs A sequentially for :. For any T , the amount of time A 0 must be run before A 0 has executed A(T ) is which is still polynomial in T . We just need to run A 0 for su-ciently many steps after the rst steps to dominate any low-return periods that took place in those P 0 (T ) steps, similar to the analysis done for the undiscounted case towards the end of Section 5.5. We again note that this solution, while su-cient for polynomial time, is far from the one we would implement in practice: for instance, we would clearly want to modify the algorithm so that the many sequential executions of A shared and accumulated common partial models of M . 7 The Multichain Case The main issue in extending our results to arbitrary multichain MDPs is that the asymptotic undiscounted return for any policy is not independent of the start state. This makes the undiscounted case for multichain MDPs look a lot like the usual discounted case. Indeed, our results extend to arbitrary multichain MDPs in the discounted case without any modication. Therefore, one way to deal with the undiscounted-case multichain MDPs is to only ask that given polynomial time our algorithm will be in a state for which it has a policy that has an expected return that is near-optimal for that state. Another way is to modify what we can expect when we compete against a policy: instead of expecting to compete against the largest asymptotic return over any start state for that policy, we can compete against the lowest asymptotic return over any start state for that policy. Thus, we modify Denitions 5 and 6 as follows: be a Markov decision process, and let be any policy in M . The -return mixing time of is the smallest T such that for all M (i)j for all i. Definition 6 Let M be an arbitrary Markov decision process. We dene M to be the class of all policies in M whose -return mixing time is at most T . We let opt( T; M (i)], be the optimal expected asymptotic undiscounted return among all policies in T; M . Under these rened denitions, all of our undiscounted-case results on unichain MDPs extend without modication to arbitrary MDPs. 8 Future Work There are a number of interesting lines for further research. Practical implementation. Although the polynomial bounds proven here are far too large to immediately claim the practical relevance of our algorithm, we feel that the underlying algorithmic ideas are very promising and will eventually result in a competitive algorithm. We are currently examining the practical issues and choices that arise for an implementation, some of which were discussed brie y in Section 6, and we hope to report on an implementation and experiments soon. A model-free version. Partially related to the last item, it would be nice to nd an algorithm similar to ours that did not require maintaining a partial model, but only a policy (or perhaps several). We are currently investigating this as well. Large state spaces. It would be interesting to study the applicability of recent methods for dealing with large state spaces, such as function approximation, to our algorithm. This has been recently investigated in the context of factored MDPs (Kearns & Koller, 1999). Acknowledgements We give warm thanks to Tom Dean, Tom Dietterich, Tommi Jaakkola, Leslie Kaelbling, Michael Littman, Lawrence Saul, Terry Sejnowski, and Rich Sutton for valuable comments. Satinder Singh was supported by NSF grant IIS-9711753 for the portion of this work done while he was at the University of Colorado, Boulder. --R Sequential decision problems and neural networks. Dynamic Programming: Deterministic and Stochastic Models. Parallel and Distributed Compu- tation: Numerical Methods Athena Scienti Expected mistake bound model for on-line reinforcement learning Stable function approximation in dynamic program- ming Convergence of indirect adaptive asynchronous value iteration algorithms. On the convergence of stochastic iterative dynamic programming algorithms. Reinforcement learning algorithm for partially observable Markov decision problems. A distributed asynchronous algorithm for expected average cost dynamic programming. Stochastic Systems: Estimation Markov decision processes Learning curve bounds for markov decision processes with undiscounted rewards. On the worst-case analysis of temporal-dierence learning algorithms Machine Learning: Algorithms for random generation and counting: a Markov chain approach. Analytical mean squared error curves for temporal di Reinforcement learning with soft state aggregation. Convergence results for single-step on-policy reinforcement learning algo- rithms Reinforcement learning with replacing eligibility traces. Generalization in reinforcement learning: Successful examples using sparse coarse coding. Reinforcement Learning: An Introduc- tion The role of exploration in learning control. Asynchronous stochastic approximation and Q- learning Learning from Delayed Rewards. --TR --CTR David Wingate , Kevin D. Seppi, P3VI: a partitioned, prioritized, parallel value iterator, Proceedings of the twenty-first international conference on Machine learning, p.109, July 04-08, 2004, Banff, Alberta, Canada Alexander L. Strehl , Michael L. Littman, A theoretical analysis of Model-Based Interval Estimation, Proceedings of the 22nd international conference on Machine learning, p.856-863, August 07-11, 2005, Bonn, Germany Alexander L. Strehl , Lihong Li , Eric Wiewiora , John Langford , Michael L. Littman, PAC model-free reinforcement learning, Proceedings of the 23rd international conference on Machine learning, p.881-888, June 25-29, 2006, Pittsburgh, Pennsylvania Shie Mannor , Duncan Simester , Peng Sun , John N. Tsitsiklis, Bias and variance in value function estimation, Proceedings of the twenty-first international conference on Machine learning, p.72, July 04-08, 2004, Banff, Alberta, Canada Reveliotis , Theologos Bountourelis, Efficient PAC Learning for Episodic Tasks with Acyclic State Spaces, Discrete Event Dynamic Systems, v.17 n.3, p.307-327, September 2007 Carlos Diuk , Alexander L. Strehl , Michael L. Littman, A hierarchical approach to efficient reinforcement learning in deterministic domains, Proceedings of the fifth international joint conference on Autonomous agents and multiagent systems, May 08-12, 2006, Hakodate, Japan Eyal Even-Dar , Shie Mannor , Yishay Mansour, Action Elimination and Stopping Conditions for the Multi-Armed Bandit and Reinforcement Learning Problems, The Journal of Machine Learning Research, 7, p.1079-1105, 12/1/2006 Daniela Pucci De Farias , Nimrod Megiddo, Combining expert advice in reactive environments, Journal of the ACM (JACM), v.53 n.5, p.762-799, September 2006 Pieter Abbeel , Andrew Y. Ng, Exploration and apprenticeship learning in reinforcement learning, Proceedings of the 22nd international conference on Machine learning, p.1-8, August 07-11, 2005, Bonn, Germany Daniela Pucci de Farias , Benjamin Van Roy, A Cost-Shaping Linear Program for Average-Cost Approximate Dynamic Programming with Performance Guarantees, Mathematics of Operations Research, v.31 n.3, p.597-620, August 2006 Amol Deshpande , Zachary Ives , Vijayshankar Raman, Adaptive query processing, Foundations and Trends in Databases, v.1 n.1, p.1-140, January 2007
markov decision processes;reinforcement learning;exploration versus exploitation
599704
Variable Resolution Discretization in Optimal Control.
The problem of state abstraction is of central importance in optimal control, reinforcement learning and Markov decision processes. This paper studies the case of variable resolution state abstraction for continuous time and space, deterministic dynamic control problems in which near-optimal policies are required. We begin by defining a class of variable resolution policy and value function representations based on Kuhn triangulations embedded in a kd-trie. We then consider top-down approaches to choosing which cells to split in order to generate improved policies. The core of this paper is the introduction and evaluation of a wide variety of possible splitting criteria. We begin with local approaches based on value function and policy properties that use only features of individual cells in making split choices. Later, by introducing two new non-local measures, influence and variance, we derive splitting criteria that allow one cell to efficiently take into account its impact on other cells when deciding whether to split. Influence is an efficiently-calculable measure of the extent to which changes in some state effect the value function of some other states. Variance is an efficiently-calculable measure of how risky is some state in a Markov chain: a low variance state is one in which we would be very surprised if, during any one execution, the long-term reward attained from that state differed substantially from its expected value, given by the value function.The paper proceeds by graphically demonstrating the various approaches to splitting on the familiar, non-linear, non-minimum phase, and two dimensional problem of the Car on the hill. It then evaluates the performance of a variety of splitting criteria on many benchmark problems, paying careful attention to their number-of-cells versus closeness-to-optimality tradeoff curves.
Introduction This paper is about non-uniform discretization of state spaces when finding optimal controllers for continuous time and space Markov Processes. Uniform discretizations (generally based on finite element or finite difference techniques (Kushner & Dupuis, 1992) provide us with important convergence results (see the analytical approach of (Barles & Souganidis, 1991; Crandall, Ishii, & Li- ons, 1992; Crandall & Lions, 1983; Munos, 1999) and the probabilistic results of (Kushner & Dupuis, 1992; Dupuis & James, 1998)), but suffer from impractical computational requirements when the size of the discretization step is small, especially when the state space is high dimensional. On the other hand, approximation methods (Bertsekas & Tsitsiklis, 1996; Baird, 1995; Sutton, 1996) can handle high EMI MUNOS AND ANDREW MOORE dimensionality but in general, have no guarantee of convergence to the optimal solution (Boyan & Moore, 1995; Baird, 1995; Munos, 1999). Some local convergence results are in (Gordon, 1995; Baird, 1998). In this paper we try to keep the convergence properties of the discretized methods while introducing an approximation factor by the iterative designing of a variable resolution. In this paper we only consider the "general towards specific" approach : an initial coarse grid is successively refined at some areas of the state space by using a splitting process, until some desired approximation (of the value function or the optimal control) is reached. First, we implement two splitting criteria based on the value function (see section 6), then we define a criterion of inconsistency between the value function and the policy (see section 7). In order to define the effect of the splitting of a state on others states, we define in section 8 the notion of influence. And we estimate the expected gain in the approximation of the value function when splitting states by defining in section 9 the variance of a Markov chain. By combining these two notions, we deduce, for a given discretization, the states whose splitting will mostly influence the parts of the state space where there is a change in the optimal control, leading to increase the resolution at those important areas. We illustrate the different splitting criteria on the "Car on the hill" problem and in section 11 we show the results for other control problems, including the well known 4 dimensions "Cart-pole" and "Acrobot" problems. In this paper we make the assumption that we have a model of the dynamics and of the reinforcement function. Moreover we assume that the dynamics is deterministic. 2. Description of the optimal control problem We consider discounted deterministic control problems, which include the well-known reinforcement learning benchmarks of Car on the Hill (Moore, 1991), Cart-Pole (Barto, Sutton, & Anderson, 1983) and Acrobot (Sutton, 1996). Let x(t) 2 X be the state of the system, with the state space X be a compact subset of IR d . The evolution of the state depends on the control u(t) 2 U (with the control space U a finite set of discrete actions) by the differential equation, called state dynamics : dx dt For an initial state x and a control function u(t), this equation leads to a unique trajectory x(t). Let - be the exit time from the state space (with the convention that if x(t) always stays in X, then 1). Then, we define the gain J as the discounted cumulative reinforcement : where r(x; u) is the current reinforcement and R(x) the boundary reinforcement. fl is the discount factor (0 - 1). For convenience reasons, in what follows, we assume that fl ! 1. However, most of the results apply to the undiscounted case assuming that for any control u(t), the trajectories do not loop (i.e. VARIABLE RESOLUTION DISCRETIZATION IN OPTIMAL CONTROL 3 The objective of the control problem is to find, for any initial condition x, the control u (t) that optimizes the functional J . Here we use the method of Dynamic Programming (DP) that introduces the value function (VF), maximum of J as a function of initial state x : Following the DP principle, we can prove (Fleming & Soner, 1993) that V satisfies a first-order non-linear differential equation, called the Hamilton-Jacobi-Bellman Theorem 1 If V is differentiable at x 2 X, let DV (x) be the gradient of V at x, then the following HJB equation holds at x. u2U DP computes the VF in order to define the optimal control with a feed-back control policy U such that the optimal control u (t) at time t only depends on current state x(t) : u -(x(t)). Indeed, from the value function, we deduce the following optimal feed-back control policy : 3. The discretization process In order to discretize the continuous control problem described in the previous sec- tion, we use a process based on the finite element methods of (Kushner & Dupuis, 1992). We use a class of functions known as barycentric interpolators (Munos & Moore, 1998), built from a triangulation of the state-space. These functions are piecewise linear inside each simplex, but might be discontinuous at the boundary between two simplexes. This representation has been chosen for its very fast computational properties. Here is a description of this class of functions. The state-space is discretized into a variable resolution grid using a structure of a tree. The root of the tree covers the whole state space, supposed to be a (hyper) rectangle. It has two branches which divide the state space into two smaller rectangles by means of a hyperplane perpendicular to the chosen splitting dimension. In the same way, each node (except for the leaf ones) splits in some direction 1::d the rectangle it covers at its middle into two nodes of half area (see Figure 1). This kind of structure is known as a kd- trie (Knuth, 1973), and is a special kind of kd-tree (Friedman, Bentley, & Finkel, 1977) in which splits occur at the center of every cell. For every leaf, we consider the Coxeter-Freudenthal-Kuhn triangulation (or simply the Kuhn triangulation (Moore, 1992)). In dimension 2 (Figure 1(b)) each rectangle is composed of 2 triangles. In dimension 3 (see Figure 2) they are composed of 6 pyramids, and in dimension d, of d! simplexes. The interpolated functions consider here are defined by their values at the corners of the rectangles. We use the Kuhn triangulation to linearly interpolate inside the rectangles. Thus these functions are piecewise linear, continuous inside each rectangle, but may be discontinuous at the boundary between two rectangles. EMI MUNOS AND ANDREW MOORE (b) The corresponding tree (a) Example of discretization Figure 1. (a) An example of discretization of the state space. There are 12 rectangles and 24 corners (the dots). (b) The corresponding tree structure. The area covered by each node is indicated in gray level. We implement a Kuhn triangulation on every leaf Remark. As we are going to approximate the value function V with such piecewise linear functions, it is very easy to compute the gradient DV at (almost) any point of the state space, thus making possible to use the feed-back rule 4 to deduce the corresponding optimal control. x x Figure 2. The Kuhn triangulation of a (3d) rectangle. The point x is in the simplex (- 3.1. Computational issues Although the number of simplexes inside a rectangle is factorial with the dimension d, the computation time for interpolating the value at any point inside a rectangle is only of order (d ln d), which corresponds to a sorting of the d relative coordinates of the point inside the rectangle. Assume we want to compute the indexes of the (d vertices of the simplex containing a point defined by its relative coordinates respect to the rectangle whose corners are f- dg. The indexes of the corners VARIABLE RESOLUTION DISCRETIZATION IN OPTIMAL CONTROL 5 uses the binary decomposition in dimension d, as illustrated in Figure 2. Computing these indexes is achieved by sorting the coordinates from the highest to the smallest : there exist indices permutation of f0; ::; d \Gamma 1g, such that 1 - x j0 - of the (d vertices of the simplex containing the point are 1. For example, if the coordinates (illustrated by the point x in Figure 2) then the vertices are : - 0 (every simplex has this vertex, as well as - 2 d added The corresponding barycentric coordinates - d of the point inside the simplex are In the previous example, the barycentric coordinates are : The approach of using Kuhn triangulations to interpolate the value function has been introduced to the reinforcement learning literature by (Davies, 1997). 3.2. Building the discretized MDP For a given discretization, we build a corresponding Markov Decision Process (MDP) in the following way. The state space of the MDP is the set \Xi of corners of the tree. The control space is the finite set U . For every corner - 2 \Xi and control u 2 U we approximate a part of the corresponding trajectory x(t) (with the Euler or Runge-Kuta method) by integrating the state dynamics (1) from initial state - for a constant control u, during some time -; u) until it enters inside a new rectangle at some point j(-; u) (see Figure 3). At the same time, we also compute the integral of the current reinforcement : R -;u) which defines the reinforcement function of the MDP. Then we compute the vertices of the simplex containing j(-; u) and the corresponding barycentric coordinates -0 (j(-; u)); :::; -d (j(-; u)). The probabilities of transition of the MDP from state - and control u to states - i are defined by these barycentric coordinates (see Figure (j(-; u)). Thus, the DP equation corresponding to this MDP is : (j(-; u)):V (- If while integrating (1) from initial state - with the control u, the trajectory exits from the state space at time -; u), then (-; u) lead to a terminal state - t (i.e. satisfying p(- t the reinforcement : R -;u) 3.3. Resolution of the discretized MDP We can use any of the classical methods to solve the discretized MDP, i.e. value iteration, policy iteration, modified policy iteration (Puterman, 1994), (Bertsekas, EMI MUNOS AND ANDREW MOORE x x Figure 3. According to the current (variable res- olution) grid, we build a discrete MDP. For every corner - (state of the MDP) and every control u, we integrate the corresponding trajectory until it enters a new rectangle at j(-; u). The interpolated value at j(-; u) is a linear combination of the values of the vertices of the simplex it is in (here (- Furthermore, it is a linear combination with positive coefficients that sum to one. Thus, doing this interpolation is mathematically equivalent to probabilistically jumping to a vertex. The probabilities of transition of the MDP for (state -, control u) to (states f- i g i=0::2 are the barycentric coordinates - i (j(-; u)) of 1987), (Barto, Bradtke, & Singh, 1995) or the prioritized sweeping (Moore & Atke- son, 1993). 4. An example : the "Car on the Hill" control problem For a description of the dynamics of this problem, see (Moore & Atkeson, 1995). This problem is of dimension 2. In our experiments, we chose the reinforcement functions as follows : the current reinforcement r(x; u) is zero everywhere. The terminal reinforcement R(x) is \Gamma1 if the car exits from the left side of the state space, and varies linearly between +1 and \Gamma1 depending on the velocity of the car when it exits from the right side of the state space. The best reinforcement +1 occurs when the car reaches the right boundary with a null velocity (figure 4). The control u has only 2 possible values : maximal positive or negative thrust. Figure 6 represents the interpolated value function of the MDP obtained by a regular discretization of 257 by 257 states. We observe the following distinctive features of the value function : ffl There is a discontinuity in the VF along the "Frontier 1" (see Figure 6) which results from the fact that given an initial point situated above this frontier, the optimal trajectory stays inside the state space (and eventually leads to a positive reward) so the value function at this point is positive. Whereas for a initial point below this frontier, any control lead the car to exit from the left boundary (because the initial velocity is too negative), thus the corresponding value function is negative (see the optimal trajectories in Figure 5). We observe that there is no change in the optimal control around this frontier. ffl There is a discontinuity in the gradient of the VF along the upper part of "Frontier 2" which results from a change in the optimal control. For example, a point above frontier 2 can reach directly the top of the hill, whereas a point below this frontier has to go down and do one loop to gain enough velocity to reach the top (see Figure 5). Moreover, we observe that around the lower part VARIABLE RESOLUTION DISCRETIZATION IN OPTIMAL CONTROL 7 Goal Thrust Gravitation Resistance Reinforcement R=+1 for null velocity R=-1 for max. velocity Figure 4. The "Car on the Hill" control problem. Frontier 3 Frontier 2, upper part Frontier 2, lower part GOAL Position Velocity Figure 5. The optimal policy is indicated by different gray levels. Several optimal trajectories are drawn for different initial starting points. of frontier 2 (see Figures 6), there is no visible discontinuity of the VF despite the fact that there is a change in the optimal control. ffl There is a discontinuity in the gradient of the VF along the "Frontier 3" because of a change in the optimal control (below the frontier, the car accelerates in order to reach the reward as fast as possible, whereas above, it decelerates to reach the top of the hill with the lowest velocity and receive the highest reward). Figure 6. The value function of the Car-on-the-Hill problem obtained by a regular grid of 257 by states. The Frontier 1 illustrates the discontinuity of the VF, the Frontiers 2 and 3 (the dash lines) stands where there is a change in the optimal control. EMI MUNOS AND ANDREW MOORE We deduce from these observations that a good approximation of the value function does not necessarily mean a good approximation of the optimal control since : ffl The approximation of the value function is not sufficient to predict the change in the optimal control around the lower part of frontier 2. ffl A good approximation of the value function is not necessary around the frontier 1 since there is no change in the optimal control. 5. The variable resolution approach The idea is to start with an initial coarse discretization, build the corresponding MDP, solve it in order to have a (coarse) approximation of the value function, then, locally refine the discretization by splitting some cells according to the process : 1. Score each cell and each direction i according to how promising it is to split according to some measure, called split-criterion(i). 2. Pick the top f% (where f is a parameter) of the highest scoring cells. 3. Split them along the direction given by argmax i split-criterion(i). Use the dynamics and reward model to create a new (larger) discretized MDP (see the splitting process in Figure 7). Note that only the cells that were split, and those whose successive states involve a split cell need to have their state transition recomputed. 4. Go to step 1 until we estimate that the approximation of the value function or the optimal control is precise enough. Thus, the central purpose of this paper is the study of several splitting criteria. Figure 7. Several discretizations resulting of successive splitting operations. Remark. In this paper, we only consider a "general towards specialized" process in the sense that the discretization is always refined. We could also consider some "generalization" process where, for example the tree coding for the discretization could be pruned, in order to avoid non relevant partitioning into too small subsets. In what follows, we present several local splitting criteria and illustrate the resulting discretizations on the previous "Car on the Hill" control problem. VARIABLE RESOLUTION DISCRETIZATION IN OPTIMAL CONTROL 9 6. Criteria based on the value function 6.1. First criterion : average corner-value difference For every rectangle, we compute the average of the absolute difference of the values at the corners of the edges for all directions us denote Ave(i) this criterion for direction i. For example, consider the square described in Figure 2. Then this split-criterion is : Figure 8 represents the discretization obtained after 15 iterations of this procedure, starting with a 9 by 9 initial grid and using the corner-value difference criterion with a splitting rate of 50% of the rectangles at each iteration. Figure 8. The discretization of the state space for the "Car on the Hill" problem using the corner-value difference criterion. Figure 9. The discretization of the state space for the "Car on the Hill" problem using the value non-linearity criterion. 6.2. Second criterion : value non-linearity For every rectangle, we compute the variance of the absolute increase of the values at the corners of the edges for all directions This criterion is similar to the previous one except that it computes the variance instead of the average. Figure 9 shows the corresponding discretization using the value non-linearity criterion with a splitting rate of 50% after 15 iterations. Comments on these results: ffl We observe that in both cases, the splitting occurs around the frontiers 1, 3 and the upper part of frontier 2, previously defined. In fact, the first criterion leads to reduce the variation of the values, and splits wherever the value function is not constant. Figure 10(a)&(b) shows a (1-dimension) cut of a discontinuity and EMI MUNOS AND ANDREW MOORE the corresponding discretization and approximation obtained using the corner- value difference split criterion. ffl The value non-linearity criterion leads to reduce the change of variation of the values, thus splits wherever the value function is not linear. So this criterion will also concentrate on the same irregularities but with two important differences compared to the corner-value difference criterion : - The value non-linearity criterion splits more parsimoniously than the corner- value difference. See, for example, the difference of splitting in the area above the frontier 3. - The discretization resulting of the split of a discontinuity by the corner- value difference and the value non-linearity criteria are different (see Figure 10). The value non-linearity criterion splits where the approximated function (here some kind of sigmoid function whose slope depends on the density of the resolution) is the least linear (Figure 10(c)&(d)). This explains the 2 parallel tails observed around the frontiers (mainly the right part of frontier 1) in Figure 9. ffl The refinement process does not split around the bottom part of frontier 2 although there is a change in the optimal control (because the VF is almost constant in this area). Moreover, there is a huge amount of memory spent for the approximation of the discontinuity (frontier 1) although the optimal control is constant in this area. (a) Average split criterion Coarse resolution (b) Average split criterion Dense resolution (c) Variance split criterion Coarse resolution (d) Variance split criterion Dense resolution Figure 10. The discretization around a discontinuity resulting of the corner-value difference (a)&(b) and the value non-linearity (c)&(d) split criterion, for a coarse (a)&(c) and a dense (b)&(d) resolution. Thus we can wonder if it is really useful to split so much around frontier 1, knowing that it will not result in an improved policy ? Next section introduces a new criterion which takes into account the policy. VARIABLE RESOLUTION DISCRETIZATION IN OPTIMAL CONTROL 11 7. A criterion based on the policy Figure 5 shows the optimal policy and several optimal trajectories for different starting points. We would like to define a refinement process that could refine around the areas of change in the optimal control, that is around frontier 2 (upper and lower parts) and 3, but not around frontier 1. In what follows, we propose such a criterion based on the inconsistency of the control derived from the value function and from the policy. 7.1. The policy disagreement criterion When we solve the MDP and compute the value function of the DP equation (5), we deduce the following policy for any state - 2 \Xi : and we can compare it with the optimal control law (4) derived from the gradient of . The policy disagreement criterion compares the control derived from the local gradient of V (4) with the control derived from the policy of the MDP (6). Remark. Instead of computing the gradient DV for all the (d!) simplexes in the rectangles, we compute an approximated gradient ~ DV for all the (2 d ) corners, based on a finite difference quotient. For the example of figure 2, the approximated gradient at corner - 0 is Thus for every corner, we compute this approximated gradient and the corresponding optimal control from (4) and compare it to the optimal policy given by (6). Figure 11 shows the discretization obtained by splitting the rectangles where these two measures of the optimal control diverge. This criterion is interesting since it splits at the places where there is a change in the optimal control, thus refining the resolution at the most important parts of the state space for the approximation of the optimal control. However, as we can expect, if we only use this criterion, the value function will not be well approximated, thus this process may converge to a sub-optimal performance. Indeed, we can observe that on Figure 11, the bottom part of frontier 2 is (lightly) situated higher than its optimal position, illustrated on Figure 5. This results in an underestimation of the value function at this area because of the lack of precision around the discontinuity (frontier 1). In section 7.3, we will observe that the performance of the discretization resulting from this splitting criterion is relatively weak. However, this splitting criterion can be beneficially combined with the previous ones based on the approximation of the VF. 7.2. Combination of several criteria We can combine the policy disagreement criterion with the corner-value difference or value non-linearity criterion in order to take the advantages of both methods : a good approximation of the value function on the whole state space and an increase of the resolution around the areas of change in the optimal control. We can combine EMI MUNOS AND ANDREW MOORE Figure 11. The discretization of the state space using the policy disagreement criterion. Here we used an initial grid of 33 \Theta 33 and a splitting rate of 20%. Figure 12. The discretization of the state space for the "Car on the Hill" problem using the combination of the value non-linearity and the policy disagreement criterion. the previous criteria in several ways, for example by a weighted sum of the respective criteria, by a logical operation (split if an and/or combination of these criteria is satisfied), by an ordering of the criteria (first split with one criterion, then use an other one), etc. Figure 12 shows the discretization obtained by alternatively, between iterations, using the value non-linearity criterion (to obtain a good approximation of the value function) and the policy disagreement criterion (to increasing the accuracy around the area of change in the optimal control). 7.3. Comparison of the performance In order to compare the respective performance of the discretizations, we ran a set (here 256) of optimal trajectories (using the feed-back control law (4)) starting from initial states regularly situated in the state space. The performance of a discretization is the sum of the cumulated reinforcement (the gain defined by equation (2)) obtained by these trajectories, over the set of start positions. Figure 13 shows the respective performances of several splitting criteria as a function of the number of states. In this 2 dimensional control problem, the variable resolution approach perform much better (except for the policy disagreement criterion alone) than the uniform grids. However, as we will see later, for higher dimensional problems, the ressources allocated to approximate the discontinuities of the VF in areas not useful for improving the optimal control might be prohibitely high. Can we do better ? So far, we have only considered local splitting criteria, in the sense that we decide VARIABLE RESOLUTION DISCRETIZATION IN OPTIMAL CONTROL 13 Figure 13. The performance for the uniform versus variable resolution grids for several splitting criterion. Both the corner-value difference and value non-linearity splitting processes perform better than the uniform grids. The policy disagreement splitting is very good for a small number of states but does not improve after, and thus leads to sub-optimal performance. The policy disagreement combined with the value non-linearity gives the best performances. whether or not to split a rectangle according to information (value function and policy) relative to the rectangle itself. However, the effect of the splitting is not local : it has an influence on the whole state space. We will thus try to see if it is possible to find a better refinement process that could split an area if and only if it is useful to improve the performance. Sections that follow presents two notions which will be useful for defining such a global splitting criterion : the influence, which measures the extend to which local changes in some state effect the global VF, and the variance, which measures how accurate the current approximated VF is. 8. Notion of influence Let us consider the Markov chain resulting from the choice of the control for the optimal policy u of the MDP. For convenience reasons, let us denote 8.1. Intuitive idea The intuitive idea of the influence I(- i j-) of a state - i on another state - is to give a measure of to what extend the VF of state - i "contributes" to the VF of state -, i.e. the change in the VF at - resulting from a modification of the VF at - i . But the VF is the solution of a Bellman equation which depends on the structure of the Markov chain and the reinforcement values, thus we cannot modify the value at some state - i , without violating Bellman equation. However, we notice that the value function at state - i is affected linearly by the reinforcement obtained at state -, thus we can compute the "contribution" of state - i to state - by estimating the change in the VF at - resulting from a modification of the reinforcement R(- i ). EMI MUNOS AND ANDREW MOORE 8.2. Definition of the influence Let us define the discounted cumulative k\Gammachained probabilities p k (- i j-), which represent the sum of the discounted transition probabilities of all sequences of k states from - to Definition 1. Let - 2 \Xi. We define the influence of a state - i on the state - being the quantity : I(- i \Sigma be a subset of \Xi. We define the influence of a state - i on the subset \Sigma being the quantity : I(- i We call influencers of a state - (respectively of a subset \Sigma), the set of states that have a non-zero influence on - (resp. on \Sigma) (note, by definition, that all influences are non-negative). 8.3. Some properties of the influence First, we notice that if the times -) are ? 0, then the influence is well defined and is bounded by : I(- i with -). Indeed, from the definition of the discounted chained-probabilities, we have Moreover, we can relate the definition to the intuitive idea previously stated and the following properties hold : ffl The influence I(- i j-) is the partial derivative of V (-) by R(- ffl For any states - and - i , we have : Proof : The Bellman equation is applying Bellman equation to V (- i ), we have : From the definition of p 2 , we can rewrite this as : Again we can apply Bellman equation to V (- i ) and finally deduce that : Thus the contribution of R(- i ) to V (-) is : @V (-) VARIABLE RESOLUTION DISCRETIZATION IN OPTIMAL CONTROL 15 Property (8) is easily deduced from the very definition of the influence and the chained probability property (7), since for all -, 8.4. Computation of the influence Equation (8) is not a Bellman equation since the sum of the probabilities may be greater than 1, so we cannot deduce that the successive iterations : I n+1 (- i converge to the influence by using the classical contraction property in max-norm (Puterman, 1994). However, we have the following property : Thus, by denoting I(\Xij-) the vector whose components are the I(- i j-) and by introducing the 1-norm jjI(\Xij-)jj we deduce that : and we have the contraction property in the 1-norm which insures convergence of the iterated I n (- i j-) to the unique solution (the fixed point) I(- i j-) of (8). 8.5. Illustration on the "Car on the Hill" problem For any subset\Omega\Gamma we can compute its influencers. As an exam- ple, figure 14 shows the influencers of some 3 points. Figure 14. Influencers of 3 points (the crosses). The darker the gray level, the more important the influence. We notice that the influence of a state "follows" the direction of the optimal trajectory starting from that state (see figure 5) through some kind of "diffusion process". EMI MUNOS AND ANDREW MOORE Let us define the subset \Sigma to be those states of policy disagreement (in the sense of section 7.1). Figure 15(a) shows \Sigma for a regular grid of 129 \Theta 129. The influencers of \Sigma is computed and plotted in Figure 15(b). The darkest zones in Figure 15(b) are the places whose splitting will most affect the value function at the places (illustrated in Figure 15(a)) of change in the optimal control. (a) States of policy disagreement (b) Influence of these states Figure 15. The set of states of policy disagreement (a) and its influencers (b). Now we would like to define the areas whose refinement could lead to the highest quantitative change on the value function. This is closely related to the quality of the approximation of the value function for a given discretization. Indeed, the better the approximation, the lower a change in the value function may result from a splitting. In the following section, we introduce the variance of the Markov chain in order to estimate the quality of approximation of the VF for the current discretization, thus defining the areas whose splitting may lead to the highest change in the VF. 9. Variance of a Markov chain By using the notation of the previous section, Bellman equation states that \GammaR at - is a discounted average of the next values weighted by the probabilities of transition p(- i j-). We are interested in computing the variance of the next values in order to get an estimation of the range of the values averaged by V (-). The first idea is to compute the one-step-ahead variance e(-) of V \Theta However, the values V (- i ) also average some successive values V (- j ), so we would like that the variance also takes into account this second-step-ahead average, as well as all the following ones. The next sections define the value function as an averager of the reinforcements and present the definition of the variance of a Markov chain. VARIABLE RESOLUTION DISCRETIZATION IN OPTIMAL CONTROL 17 9.1. The value function as an averager of the reinforcements Let us denote s k (-) a sequence of first one is -. Let S k (-) be the set of all possible sequences s k (-). Let p(s k the product of the probabilities of transition of the successive states in a sequence, and for the cumulated time of the th first states of the sequence (with by definition - 0 (s k We have the following property : sk (-)2Sk (-) p(s k 1. We can prove that the value function satisfies the following equation (similar to the Bellman equation but for k-steps-ahead) : for any k, sk (-)2Sk (-) p(s k (-)) Let us denote s 1 (-) an infinite sequence of states starting with -, and S1 (-) the set of all possible such sequences. Define p(s 1 defined as previously for any i - 0. Then we still have the property : and the value function satisfies : 9.2. Definition of the Variance of a Markov chain Intuitively, the variance of a state - is a measure of how dissimilar the cumulative future reward obtained along all possible trajectories starting from - are. More precisely, we define it as the variance of the quantities averaged in equation Definition 2. Let - 2 \Xi. We define the variance oe 2 of the Markov chain at Let us prove that the variance satisfies a Bellman equation. By selecting out the case in the summation, we have : \Theta P 1 R(-))and from (11), we deduce that : \Theta \Theta By successively applying (11) to - 1 and by selecting out the state - i in the sequence \Theta \Theta P 1 \Theta EMI MUNOS AND ANDREW MOORE with e(-) satisfying (10). Thus the variance oe 2 (-) is the sum of the immediate contribution e(-) that takes into account the variation in the values of the immediate successors - i , and the discounted average of the variance oe 2 (- i ) of these successors. This is a Bellman equation and it can be solved by value iteration. Remark. We can give a geometric interpretation of the term e(-) related to the gradient of the value function at the iterated point to the barycentric coordinates - i (j). Indeed, from the definition of the discretized MDP (section 3.2), we have V (j) and from the piecewise linearity of the approximated functions we have V (- thus (j):fl 2-) [DV (j):(- which can be expressed as : with the matrix Q(j) defined by its elements Thus, e(-) is close to 0 in two specific cases : either if the gradient at the iterated point j is very low (i.e. the values are almost constant) or if j is very close to one vertex (then the barycentric coordinate - i is close to 1 and the - j (for are close to 0, thus Q(j) is low). In both of these cases, e(-) is low and implies that the iteration of - does not lead to a degradation of the quality of approximation of the value function (the variance does not increase). 9.3. Example : variance of the "Car on the Hill" Figure shows the standard deviation oe(-) for the Car-on-the-Hill problem for a uniform grid (of 257 by 257). Figure 16. The standard deviation oe for the "Car on the Hill". The standard deviation is very high around the indeed, a discontinuity is impossible to ap- proximateperfectly by discretization tech- niques, whatever the resolution is. We can observe this fact on figure 10 where the maximal error of approximation is equal to half the step of the discontinuity. How- ever, the higher the resolution is, the lower the integral of the error is (compare figure 10(a)&(c) versus (b)&(d)). There is a noticeable positive standard deviation around frontier 3 and the upper part of because the value function is an average of different values of the discounted terminal reinforcement. A refinement of the resolution in the areas where the standard deviation is low has no chance of producing an important change in the value function. Thus it appears that the areas where a splitting might affect the most the approximation of the value function are the rectangles of highest surface whose corners have the highest standard deviations. VARIABLE RESOLUTION DISCRETIZATION IN OPTIMAL CONTROL 19 10. A global splitting criterion Now we are going to combine the notions of influence and variance in order to define a new, non-local splitting criterion. We have seen that : ffl The states - of highest standard deviation oe(-) are the states of lowest quality of approximation of the VF, thus the states that could improve the most their approximation accuracy when split (figure 17(a)). ffl The states - of highest influence on the set \Sigma of states of policy disagreement (figure 15(b)) are the states whose value function affects the area where there is a change in the optimal control. Thus in order to improve the precision of approximation at the most relevant areas of the state space we split the states - of highest standard deviation that have an influence on the areas of change in the optimal control, according to the Stdev Inf criterion (see figure Figure shows the discretization obtained by using this splitting criterion. (a) Standard deviation (b) Influence x Standard deviation Figure 17. (a) The standard deviation oe(-) for the "Car on the Hill" (equivalent to figure 16) and (b) The Stdev Inf criterion, product of oe(-) by the influence I(-j\Sigma) (figure 15(b)). Figure 18. The discretization resulting of the Stdev Inf split criterion. We observe that the upper part of frontier 1 is well refined. This refinement occurred not because we split according to the value function (such as the corner-value difference or value non-linearity criterion) but because the splitting there is necessary to have a good approximation of the value function around the bottom part of (and even the upper part of frontier 2) where there is a change in the optimal control. The fact that the Stdev Inf criterion does not split the areas where the VF is discontinuous unless some refinement is necessary to get a better approximation of the optimal control, is very important since, as we will see in the simulations that follow, in higher dimensions, the cost to get an accurate approximation of the VF is too high. EMI MUNOS AND ANDREW MOORE Remark. The performance of this criterion for the "Car on the Hill" problem are similar to those of combining the value non-linearity and the policy disagreement criterion. We didn't plot those performances in figure 13 for clarity reasons and because they do not represent a major improvement. However, the difference of performances between the local criteria and the Stdev Inf criterion are much more significant in the case of more difficult problems (the Acrobot, the Cart-pole) as illustrated in what follows. 11. Illustration on other control problems 11.1. The Cart-Pole problem The dynamics of this 4-dimensional physical system (illustrated in figure 19(a)) are described in (Barto et al., 1983). In our experiments, we chose the following parameters as follows : the state space is defined by the position y 2 [\Gamma10; +10], angle velocities restricted to - 2]. The control consists in applying a strength of \Sigma10 Newton. The goal is defined by the area : no limits on - y and - '). This is a notably narrow goal to try to hit (see the projection of the state space and the goal on the 2d plan (y,') in figure 19). Notice that our task of "minimum time manoever to a small goal region" from an arbitrary start state is much harder than merely balancing the pole without falling (Barto et al., 1983). The current reinforcement r is zero everywhere and the terminal reinforcement R is \Gamma1 if the system exits from the state space (jyj ? 10 or j'j ? - if the system reaches the goal. _ _ _ _ y position -y 4.3 0.2= y Goal (b) The projection of the state space (a) The "Cart-pole" Figure 19. (a) Description of the Cart-pole. (b) The projection of the discretization (onto the plane (',y)) obtained by the Stdev Inf criterion and some trajectories for several initial points. Figure 20 shows the performance obtained for several splitting criteria previously defined for this 4 dimensional control problem. We observe the following points : VARIABLE RESOLUTION DISCRETIZATION IN OPTIMAL CONTROL 21 ffl The local criteria do not perform better than the uniform grids. The problem is that the VF is discontinuous at several parts of the state space (areas of high j'j for which it is too late to rebalance the pole, which is similar to the frontier 1 of the "Car on the Hill" problem) and the value-based criteria spend too many resources on approximating these useless areas. ffl The Stdev Inf criterion performs very well. We observe that the trajectories (see figure 19(b)) are nearly optimal (the angle j'j is maximized in order to reach the goal as fast as possible, and very close to its limit value, for which it is no more possible to recover the balance). Figure 20. Performance on the "Cart-pole". Figure 21. Performance on the Acrobot. 11.2. The Acrobot The Acrobot is a 4 dimensional control problem which consists of a two-link arm with one single actuator at the elbow. This actuator exerts a torque between the links (see figure 22(a)). It has dynamics similar to a gymnast on a high bar, where Link 1 is analogous to the gymnast's hands, arms and torso, Link 2 represents the legs, and the joint between the links is the gymnast's waist (Sutton, 1996). Here, the goal of the controller is to balance the Acrobot at its unstable, inverted vertical position, in the minimum time (Boone, 1997). The goal is defined by a very narrow range of - on both angles around the vertical position 22(b)), for which the system receives a reinforcement of R = +1. Anywhere else, the reinforcement is zero. The two first dimensions (' of the state space have a structure of a torus (because of the 2- modulo on the angles), which is implemented in our structure by having the vertices of 2 first dimensions being angle 0 and 2- pointing to the same entry for the value function in the interpolated kd-trie. Figure 21 shows the performance obtained for several splitting criteria previously defined. The respective performance of the different criteria are similar to the "Cart- pole" problem above : the local criteria are no better than the uniform grids ; the Stdev Inf criterion performs much better. Figure 22(b) shows the projection of the discretization obtained by the Stdev Inf criterion and one trajectory onto the 2d-plane (' 1 ,' 2 ). 22 R ' EMI MUNOS AND ANDREW MOORE Goal Goal (a) The Acrobot (b) Projection of the state space Figure 22. (a) Description of the Acrobot physical system. (b) Projection of the discretization (onto the plane (' 1 ,' 2 )) obtained by the Stdev Inf criterion, and one trajectory. Interpretation of the results : As we noticed for the two previous 4d prob- lems, the local splitting criteria fail to improve the performance of the uniform grids because they spend too many resources on local considerations (either approximating the value function or the optimal policy). For example, on the "Cart-pole" problem, the value non-linearity criterion will concentrate on approximating the VF mostly at parts of the state space where there is already no chance to rebalance the pole. And the areas around the vertical position (low '), which are the most important areas, will not be refined in time (however, if we continue the simulations after about 90000 states, the local criteria start to perform better than the uniform grids, because these areas get eventually refined). The Stdev Inf criterion, which takes into account global consideration for the splitting, performs very well for all the problems described above. 12. Conclusion and Future work In this paper we proposed a variable resolution discretization approach to solve continuous time and space control problems. We described several local splitting criteria, based on the VF or the policy approximation. We observed that this approach works well for 2d problems like the "Car on the Hill". However, for more complex problems, these local methods fail to perform better than uniform grids. Local value-based splitting is an efficient, model-based, relative of the Q-learning- based tree splitting criteria used, for example, by (Chapman & Kaelbling, 1991; Si- mons, Van Brussel, De Schutter, & Verhaert, 1982; McCallum, 1995). But it is only when combined with new non-local measures that we are able to get truly effec- tive, near-optimal performance on our control problems. The tree-based state-space partitions in (Moore, 1991; Moore & Atkeson, 1995) were produced by different criteria (of empirical performance), and produced far more parsimonious trees, but no attempt was made to minimize cost: merely to find a valid path. VARIABLE RESOLUTION DISCRETIZATION IN OPTIMAL CONTROL 23 In order to design a global criterion, we introduced the notions of influence which estimates the impact of states over others, and of variance of a Markov chain, which measure the quality of the current approximation. By combining these notions, we defined an interesting splitting criterion that gives very good performance (in comparison to the uniform grids) on all the problems studied. Another extension of these measures could be to learn them through interactions with the environment in order to design efficient exploration policies in reinforcement learning. Our notion of variance could be used with "Interval Estima- tion" heuristic (Kaelbling, 1993), to permit "optimism-in-the-face-of-uncertainty" exploration, or with the "back-propagation of exploration bonuses" of (Meuleau & Bourgine, 1999) for exploration in continuous state-spaces. Indeed, if we observe that the learned variance of a state - is high, then a good exploration strategy could be to inspect the states that have a high expected influence on -. In the future, it seems important to develop the following points : ffl A generalization process, in order to have also a "specific towards general" grouping of areas (for example by pruning the tree) that have been over-refined. ffl Suppose that we only want to solve the problem for a specific area\Omega of initial start states. Then we can restrict our refinement process to the areas used by the trajectories. The notion of influence introduced in this paper can be used for that purpose by computing the Stdev Inf criterion with respect to set of states of policy disagreement that have an influence on the area of initial states\Omega\Gamma instead of \Sigma, and can improve drastically the performance observed when starting from this specific area. ffl We would like to deal with the stochastic case. If we assume that we have a model of the noise, then the only change will be in the process of building the MDP (Kushner & Dupuis, 1992; Munos & Bourgine, 1997). ffl Release the assumption that we have a model and build an approximation of the dynamics and the reinforcement, and deal with the exploration problem. --R Residual algorithms Gradient descent for general reinforcement learning. Convergence of approximation schemes for fully nonlinear second order equations. Neuronlike Adaptive elements that that can learn difficult Control Problems. Learning to act using real-time dynamic program- ming Dynamic Programming Learning from Delayed Reinforcement In a Complex Domain. User's guide to viscosity solutions of second order partial differential equations. Viscosity solutions of hamilton-jacobi equations Multidimensional Triangulation and Interpolation for Reinforcement Learning. Rates of convergence for approximation schemes in optimal control. SIAM Journal Control and Optimization Controlled Markov Processes and Viscosity Solutions. An Algorithm for Finding Best Matches in Logarithmic Expected Time. Stable function approximation in dynamic programming. Learning in Embedded Systems. Sorting and Searching. In Machine Learning Exploration of multi-state environments: Local measures and back-propagation of uncertainty Variable Resolution Dynamic Programming: Efficiently Learning Action Maps in Multivariate Real-valued State-spaces Prioritized sweeping: Reinforcement learning with less data and less real time. The parti-game algorithm for variable resolution reinforcement learning in multidimensional state space Simplical Mesh Generation with Applications. A study of reinforcement learning in the continuous case by the means of viscosity solutions. Reinforcement learning for continuous stochastic control problems. Neural Information Processing Systems. Barycentric interpolators for continuous space and time reinforcement learning. Markov Decision Processes Generalization in reinforcement learning --TR --CTR David Wingate , Kevin D. Seppi, P3VI: a partitioned, prioritized, parallel value iterator, Proceedings of the twenty-first international conference on Machine learning, p.109, July 04-08, 2004, Banff, Alberta, Canada Chee Wee Phua , Robert Fitch, Tracking value function dynamics to improve reinforcement learning with piecewise linear function approximation, Proceedings of the 24th international conference on Machine learning, p.751-758, June 20-24, 2007, Corvalis, Oregon Philipp W. Keller , Shie Mannor , Doina Precup, Automatic basis function construction for approximate dynamic programming and reinforcement learning, Proceedings of the 23rd international conference on Machine learning, p.449-456, June 25-29, 2006, Pittsburgh, Pennsylvania Sbastien Jodogne , Justus H. Piater, Interactive learning of mappings from visual percepts to actions, Proceedings of the 22nd international conference on Machine learning, p.393-400, August 07-11, 2005, Bonn, Germany Feng , Richard Dearden , Nicolas Meuleau , Richard Washington, Dynamic programming for structured continuous Markov decision problems, Proceedings of the 20th conference on Uncertainty in artificial intelligence, p.154-161, July 07-11, 2004, Banff, Canada Duncan Potts , Claude Sammut, Incremental Learning of Linear Model Trees, Machine Learning, v.61 n.1-3, p.5-48, November 2005 Florian Bauer , Lars Grne , Willi Semmler, Adaptive spline interpolation for Hamilton-Jacobi-Bellman equations, Applied Numerical Mathematics, v.56 n.9, p.1196-1210, September 2006 Theodore J. Perkins , Andrew G. Barto, Lyapunov design for safe reinforcement learning, The Journal of Machine Learning Research, 3, 3/1/2003 Lars Grne , Willi Semmler, Asset pricing with dynamic programming, Computational Economics, v.29 n.3-4, p.233-265, May 2007
optimal control;reinforcement learning;variable resolution discretization;adaptive mesh refinement
599708
Classifiers that approximate functions.
A classifier system, XCSF, is introduced in which the prediction estimation mechanism is used to learn approximations to functions. The addition of weight vectors to the classifiers allows piecewise-linear approximation, where the classifier's prediction is calculated instead of being a fixed scalar. The weight vector and the classifier's condition co-adapt. Results on functions of up to six dimensions show high accuracy. The idea of calculating the prediction leads to the concept of a generalized classifier in which the payoff prediction approximates the environmental payoff function over a subspace defined by the classifier condition and an action restriction specified in the classifier, permitting continuous-valued actions.
Introduction There is considerable recent research on the properties and performance of the learning classifier system XCS (Wilson 1995; Butz and Wilson 2001). Areas of interest include data mining (e.g. Bernad'o, Llor'a, and Garrell 2001), generalization over inputs (Butz and Pelikan 2001), self-adaptation of learning parameters (Hurst and Bull 2001), and learning in non-Markov environments (Lanzi and Wilson 2000), among others. One area that has not received attention is function approximation, which XCS's accuracy-based fitness makes pos- sible. This paper demonstrates XCS as a function approximator, then shows how, somewhat surprisingly, this leads to a generalized classifier structure that embraces traditional classifier formats and, for the first time, permits classifiers capable of continuous-valued actions. XCS's classifiers estimate payoff. That is, the rules (classifiers) evolved by XCS each keep a statistical estimate of the payoff (reward, reinforcement) expected if the classifier's condition is satisfied and its action is executed by the system. Moreover, the classifiers form quite accurate payoff estimates, or predictions, since the classifiers' fitnesses under the genetic algorithm depend on their prediction accuracies. In effect, XCS approximates the mapping is the set of possible inputs, A the system's set of available actions (typically finite and discrete), and P is the set of possible payoffs. If attention is restricted to a single action a i 2 A, the mapping has the form X \Theta a i ) P, which is a function from input vectors x to scalar payoffs. Thus the system approximates a separate function for each a i . In the reinforcement learning contexts in which classifier systems are typically used, the reason for forming these payoff function approximations is to permit the system to choose, for each x, the best (highest-paying) action from A. However, there are contexts where the output desired from a learning system is not a discrete action but a continuous quantity. For instance in predicting continuous time series, the output might be a future series value. In a control context, the output might be a vector of continuous quantities such as angles or thrusts. Apart from classifier systems based on fuzzy logic (Valenzuela-Rend'on 1991; Bonarini 2000), there are none which produce real-valued outputs. Our hypothesis was that the payoff function approximation ability of XCS could be adapted to produce real-valued outputs, as well as be used for function approximation in general applications. To test this we adapted XCS to learn approximations to functions of the form where y is real and x is a vector with integer components x . The results demonstrated approximation to high accuracy, together with evolution of classifiers that tended to distribute themselves efficiently over the input domain. The research fed back, however, on basic classifier concepts. It was realized that thinking of a classifier as a function approximator implied a new, generalized, classifier syntax that covered most existing classifier formats and included not only discrete-action classifiers but ones with continuous actions. The next section describes modifications of XCS for function approximation. Section 3 has results on a simple piecewise-constant approximation. In Section 4 we introduce a new classifier structure that permits piecewise-linear approximations. Results on simple functions are shown in Section 5. In Section 6 we demonstrate accurate approximation of a six-dimensional function. Section 7 presents the generalized classifier syntax and examines its use. The final section has our conclusions and suggestions for future work. 2 Modification of XCS XCS was modified in two respects (later, a third). The first was to adapt the program for integer instead of binary input vectors. The second, very simple, was to make the program's payoff predictions directly accessible at the output and to restrict the system to a single (dummy) action. The resulting program was called XCSF. (We omit a description of basic XCS, but refer the reader to Wilson (1995), Wilson (1998), and the updated formal description in Butz and Wilson (2001) that XCSF follows most closely.) The changes to XCS for integer inputs were as follows (drawn from Wilson (2001)). The classifier condition was changed from a string from f0,1,#g to a concatenation of "interval predicates", int are integers. A classifier matches an input x with attributes x i if and only if l i - x i - u i for all x i . Crossover (two-point) in XCSF operates in direct analogy to crossover in XCS. A crossover point can occur between any two alleles, i.e., within an interval predicate or between pred- icates, and also at the ends of the condition (the action is not involved in crossover). Mu- tation, however, is different. The best method appears to be to mutate an allele by adding an amount \Sigmarand(m 0 ), where m 0 is a fixed integer, rand picks an integer uniform randomly from (0; m 0 ], and the sign is chosen uniform randomly. If a new value of l i is less than the minimum possible input value, in the present case 0, the new value is set to 0. If the new value is greater than u i , it is set equal to u i . A corresponding rule holds for mutations of u i . The condition of a "covering" classifier (a classifier formed when no existing classifier matches an input) has components l limited by the minimum possible input value, and each u limited by the maximum possible input value; rand 1 picks a random integer from [0; r 0 ], with r 0 a fixed integer. For the subsumption deletion operations, we defined subsumption of one classifier by another to occur if every interval predicate in the first classifier's condition subsumes the corresponding predicate in the second classifier's condition. An interval predicate subsumes another one if its l i is less than or equal to that of the other and its u i is greater than or equal to that of the other. For purposes of action-set subsumption, a classifier is more general than another if its generality is greater. Generality is defined as the sum of the widths u of the interval predicates, all divided by the maximum possible value of this sum. 3 Piecewise-Constant Approximation The simplest way to approximate the function with XCSF is to let x be the input and y the payoff. After sufficient sampling of the input space, the system prediction (a fitness-weighted average of matching classifiers' predictions) should, given an x, more or less accurately predict the corresponding y. In all XCS-like systems the fitness of a classifier depends on its accuracy of prediction, so that XCSF should converge to a population of classifiers that, over their respective input ranges, predict payoff well. The closeness of the approximation should be controllable with the error threshold ffl 0 , as follows. A classifier with prediction error ffl 1 has higher accuracy than a classifier with error ffl 2 if and Wilson 2001). Since classifier fitness depends on accuracy, classifiers with lower errors will win out in the evolutionary competition. However, by definition, classifiers with errors less than ffl 0 have constant fitness, so no further fitness pressure applies. Thus ffl 0 should limit the closeness of the approximation. It is important that besides evolving accurate classifiers, the system employ the classifiers efficiently over the input domain. In slowly-changing or low-gradient regions of the function we would hope to evolve classifiers with relatively large interval predicates. The function value, and thus a given classifier's error, would change relatively little over such regions; so, as in XCS, a tendency toward accurate, maximally general conditions (Wilson 1995) should cause the interval predicates to expand. Conversely, we should expect classifiers with small interval predicates where the function is changing rapidly. We also hope for an efficient distribution of classifiers over the domain in the sense that the tiling minimizes overlaps between classifier predicates. Figure shows typical results from an experiment in which XCSF approximated the function over the interval 0 - x ! 100. (In all experiments reported here, the input value range was [0,99].) Plotted are XCSF's prediction for each possible x as well as the function itself. The system learned from a dataset consisting of 1000 x; y pairs, with x chosen randomly and y the corresponding function value. In the experiment, a pair was drawn randomly from the dataset, its x value presented to XCSF as input, and the y value used as reward or reinforcement. XCSF formed a match set [M] of classifiers matching x and calculated the system prediction for each possible action in the usual way; since there was only one, dummy, action, just one system prediction was calculated and that became the system's output. An action set [A] was formed consisting of classifiers in [M] having the dummy action (i.e., all classifiers in [M]), and the predictions of the classifiers in [A] were adjusted using the reward, y, in the usual way; the other classifier parameters were also adjusted. A genetic algorithm was run in [A] if called for. This cycle was repeated 50,000 times after x Prediction Figure 1: Piecewise-constant approximation to the parabola function which the plot in Figure 1 was obtained by sweeping through all possible values of x and recording the resulting system predictions. Parameter settings for the experiment were as follows, using the notation of Butz and population size learning rate fitness power probability deletion threshold ' del = 50, fitness fraction for accelerated deletion In addition: mutation increment covering interval r subsumption was enabled, with time threshold ' Several aspects of Figure 1 are of interest. The Prediction curve has a "staircase" appearance typical of a piecewise-constant approximation. The height of the major "steps" varies between about 1000 and 2000. Examination of individual steps indicates an average error roughly consistent with the value of ffl 0 , suggesting that ffl 0 is controlling the closeness of the approximation. The width of the steps is, again roughly, wider in the "flatter" part of the function and narrower in the steep part. Finally, it is significant that the Prediction curve indeed takes the form of a staircase, instead of being smoother. Long flat "steps" suggest that one set of classifiers is in control (forms [M]) after which, on the next step, another set takes over. This in turn suggests a tendency toward efficient distribution of classifier resources over the domain. Figure another perspective. It is a listing of the (macro)classifiers of the population at the end of the experiment, 15 in all. Shown are each classifier's condition, prediction, error, fitness, and numerosity. Note that most classifiers with substantial fitnesses have errors less than ffl 0 . A special graphic notation is used to represent the condition. Since x has just one component, the condition contains just one interval predicate. The possible range of x, 0-99, is divided into 20 equal subranges. An interval predicate is indicated by a cluster of "O"s that covers its range. If an interval predicate entirely covers a subrange, e.g., 35-39, an "O" is placed at that range's position. If the interval predicate covers some of but less than the whole of a subrange, a small "o" is put there. This notation has been found more perspicuous than using the raw numbers. Note how, consistent with Figure 1, the classifier conditions are larger toward the beginning of the domain, where the function slope is lower. It is also interesting that the classifiers with higher fitnesses and numerosities cover the domain without a great deal of overlap. These classifiers dominate the calculation of the system prediction, since the latter CONDITION PRED ERR FITN NUM 0.oO- 8992. 283.796 31 1.Oo.- 7876. 322.906 2.oOO.- 6162. 503.564 20 3.OOO.- 5990. 570.188 9 4.oOOO.- 5988. 569.028 1 5.oOOo.- 5668. 413.075 3 6.oOO.- 5534. 281.090 3 8.oOOOo.- 5053. 524.002 1 9.oOOo.- 4861. 465.054 5 10.OOOo.- 3854. 468.862 12.OOOOO.- 1359. 377.358 13. -OOOOOOOOOo.- 821. 378.372 15 14. -OOOOOOOOo.- 820. 377.371 15 Figure 2: Classifiers from experiment of Figure 1. (PREDiction, ERRor, FITNess, NUMerosity.) is a fitness-weighted average of the predictions of matching classifiers. Because they dom- inate, the Prediction curve takes the form of a staircase. Apart from the presence of the remaining, lower fitness, classifiers, the distribution of resources over the domain is thus relatively efficient. In sum, XCSF succeeds in approximating the function in accordance with a stated error criterion (confirmed for additional values of ffl 0 ) and the classifiers are employed reasonably well. Still, a piecewise-constant approximation is primitive compared with an approximation where the approximating segments more closely follow the function's contour. The simplest such approach is a piecewise-linear approximation. But how could a piecewise-linear approximation be done with a classifier system? 4 Piecewise-linear Approximation Traditionally, a classifier's prediction is a number intended to apply for all inputs x that satisfy its condition. However, for function approximation, it would be desirable if the prediction could vary over the condition's domain, since the function being approximated generally varies. In effect, the prediction itself should be a function, the simplest form of which would be a linear polynomial in the input components, call it h(x). The function h(x) would substitute for the classifier's traditional (scalar) prediction, p. Then, given an input x, each matching classifier would calculate its prediction by computing h(x). For approximating a one-dimensional function f(x), h(x) would be a two-term polynomial In this case, w 1 can be thought of as the slope of an approximating straight line, with w 0 its intercept. For an n-dimensional f(x), is a weight vector (w is the input vector x augmented by a constant In this case h(x) computes a hyperplane approximation to f(x). Classifiers would have different weight vectors w since in general the domains of their conditions differ. Of course, the classifiers' weight vectors must be adapted. If classifiers are to predict with a given accuracy, the coefficients w i of their weight vectors must be appropriate. One approach is to use an evolutionary algorithm. The weight vector would be evolved along with the classifier condition. For this, the w i could be concatenated with the interval predicates of the condition and the whole thing evolved as a unit. Or, it might be preferable to use separate processes. For example, the Evolutionsstrategie might be more suitable than the GA for the weight vector because optimizing the weights of a linear network is unimodal, and ES is generally better at unimodal tasks. In the present work, however, we did not use an evolutionary technique for the weight vector but instead adapted it using a modification of the delta rule (Mitchell 1997). The delta rule is given by where w i and x i are the ith components of w and x 0 , respectively. In the quantity is the output, in the present case the classifier prediction, and t is the target, in this case the correct value of y according to is the amount by which the prediction should be corrected (the negative of the classifier's instantaneous error). Finally, j is the correction rate. The delta rule says to change the weight proportionally to the product of the input value and the correction. Notice that correcting the w i in effect changes the output by Because jx 0 j 2 is factored in, it is difficult to choose j so as to get a well-controlled overall rate of correction: j too large results in the weights fluctuating and not converging; if j is too small the convergence is unnecessarily slow. After some experimentation with this issue, we noticed that in its original use (Widrow and Hoff 1988), the correction rate was selected so that the entire error was corrected in one step; this was possible, however, because the input vector was binary, so its absolute value was a constant. In our problem, reliable one-step correction would be possible if a modified delta rule were employed: Now the total correction would be strictly proportional to (t \Gamma o) and could be reliably controlled by j. For instance, would give the one-step correction of Widrow and Hoff. In the experiments that follow, we used the modified delta rule with various values of Use of a delta rule requires selection of an appropriate value for x 0 , the constant that augments the input vector. In tests, we found that if x 0 was too small, weight vectors would not learn the right slope, and would tend to point toward the origin-i.e. w that x i is a factor in the above equation for \Deltaw i . If x 0 is small compared with the other x i , then adjustments of w 0 will tend to be swamped by adjustments of the other w i , keeping w 0 small. Choosing x 100-the same order of magnitude as the other x i -appeared to solve the problem. For piecewise-linear approximation, no changes were necessary to XCSF except for addition of the weight vectors to the classifiers, and provision for calculation of the predictions and application of the modified delta rule to the action set classifiers on every time-step. In a classifier created by covering, the weight vector was randomly initialized with weights from offspring classifiers inherited the parents' weight vectors. Both policies yielded performance improvements over other initializations. In the experiments, most parameter settings were the same as those given in Section 3; differences will be noted. Settings of the new parameter, j, will be given. x Prediction "2-line" Figure 3: Piecewise-linear approximation to piecewise-linear function "2-line". ffl CONDITION PRED ERR FITN NUM 0.oOOOOOOOOOO- 4705. 19.158 62 1.oOOOOOOOOO- 4670. 0.706 274 2.oOOOOOOOOO- 4670. 0.044 4. -OOOOOOOOOOo.- 3057. 16.005 6 5. -OOOOOOOOOOo.- 3050. 0.676 247 6. -OOOOOOOOOo.- 3050. 0.377 164 Figure 4: Classifiers from experiment of Figure 3 5 Tests on Simple Functions Preliminary testing was carried out approximating functions that were themselves linear or piecewise linear. For example, tests were done on the function "2-line", defined as Parameters for the experiment were the same as previously, except for 0:4. The approximation obtained (Figure was so close that the plots of the prediction and the function itself are difficult to distinguish visually. Figure 4 shows the seven classifiers at the end of the run 1 . They are clearly divided into one group for the upper segment of the function and another for the lower segment. The dominant classifier in the upper group, no. 1, has error zero and a predicate covering the interval 52-99 (inclusive). In the lower group, the dominant classifier, no. 5, also has error zero and covers the interval 0-50. Raising the error threshold caused the approximation to deteriorate. In Figure 5, ffl The prediction curve seems to ignore the break at reflecting the change in slope only gradually. The classifier list showed several that bridged the break point, with predictates from about 30 to 70. Evidently, with a larger error threshold, the system was not forced, as in Figure 3, to evolve classifiers that corresponded closely to the two function segments. 1 The prediction values represent the most recent weight-vector calculation and are not particularly significant. As in Section 3, this and all following experiments were run for 50,000 input cycles. x Prediction "2-line" Figure 5: Approximation to "2-line" with ffl x Prediction Figure Piecewise-linear approximation to parabola with ffl Figures 6 through 12 show typical results on parabola and sine functions. Parameters were the same as in the "2-line" experiments except (an insignificant difference). Values for ffl 0 are given in the captions. The two values chosen for each function are equivalent to 5% and 1% of the functions' ranges. To highlight the dominant classifiers and save space, the classifier lists include only the highest-fitness classifiers; the full populations are three or four times larger. While the parabola figures show good linear approximations with a small number of classifiers, it is somewhat surprising that-unlike the piecewise-constant case-the sizes of the interval predicates do not seem to reflect the function's slope. Perhaps for piecewise-linear approximation a different analysis is in order: predicate length may be more related to curve straightness than steepness. For the sinewaves, the approximation overshoots the peaks when ffl 0 is large (Figure 10), but this effect disappears with smaller values and the curve is quite nicely matched (Figure 12). Figure 11 suggests that the system divides the approximation into classifiers for the beginning, middle, and end of the curve. CONDITION PRED ERR FITN NUM 0.OOOOOOOOOOO- 9375. 246.286 151 1.OOOOOOOOOOOOOO- 9014. 431.122 54 2.oOOOOOOOOOOOOOO- 8985. 432.176 80 3.oOOOOOOOOOOOOOO- 8906. 456.037 37 4.oOOOOOOOOOOOOOOO- 8744. 456.035 33 5. -OOOOOOOOOOOOOOo.- 4184. 379.077 35 6. -OOOOOOOOOOOOOO.- 3756. 247.258 122 7. -OOOOOOOOOOOOOo.- 3564. 256.066 8. -OOOOOOOOOOOOo.- 3193. 262.035 9. -OOOOOOOOOOo.- 2250. 204.211 125 Figure 7: High fitness classifiers from experiment of Figure 6.2000600010000 x Prediction Figure 8: Piecewise-linear approximation to parabola with ffl CONDITION PRED ERR FITN NUM 0.oOOOOOO- 9591. 77.823 212 1.oOOOOOO.- 7734. 75.081 21 2.oOOOOOOO.- 7687. 89.035 9 3.oOOOOOOo.- 4438. 79.731 184 4.oOOOOo.- 3149. 26.123 41 6.oOOOOOo.- 1621. 61.072 13 7. -OOOOOOO.- 967. 104.607 219 8. -OOOOOOo.- 749. 85.074 Figure 9: High fitness classifiers from experiment of Figure 8. x Prediction Figure 10: Piecewise-linear approximation to sine function with ffl CONDITION PRED ERR FITN NUM 1. -OOOOOo.- 118. 10.083 22 2. -OOOOO.- 111. 7.572 158 3.OOOOo.- 66. 5.032 15 4.oOOOO-20. 4.792 173 5.oOOOOOO-23. 12.101 78 6.OOOOOOOOOOo.-130. 8.888 234 Figure 11: High fitness classifiers from experiment of Figure 10. x Prediction Figure 12: Piecewise-linear approximation to sine function with ffl 2. Instances System Figure 13: System error/100 and population size/3200 for approximation to six-dimensional "rms" function. 1. 6 Multi-dimensional Input XCSF was initially tested on functions of more than one variable by letting a linear function, i.e., a hyperplane function. The system rapidly evolved solutions with one or a few classifiers and arbitrary accuracy. This was expected, since the classifiers' weight vectors are effectively linear functions. To test XCSF on a multi-dimensional nonlinear function, we chose, somewhat arbitrarily, of "rms" function. Experiments with went well, so Parameters were the same as previously, except 1:0. The error threshold ffl of the range). In contrast to previous experiments in which instances were chosen randomly from a fixed data set, instances were picked randomly from the domain. Figure 13 plots the system error and population size. Starting initially very high, the system error (a moving average of the absolute difference between XCSF's prediction and the actual function value) fell rapidly to less than 1 (or .01 as plotted on this graph). The population size-in macroclassifiers-rose quickly to about 2400 and stayed there. The system seemed to have little difficulty approximating the function to within though quite a few classifiers were required. 7 Generalized Classifiers 7.1 Definition In XCS, as in other classifier systems, the classifier prediction is a scalar, and the system adapts the classifier conditions and the prediction scalars to find accurate classifiers that are as general as possible. In XCSF, the prediction was replaced by a weight vector computing a linear function, leading to a more powerful and subtle co-adaptation of the condition and the prediction. As an extreme but instructive example, XCSF can approximate a very high-dimensional linear function with O(1) classifiers, far less than required using scalar predictions. What do the results with XCSF suggest for classifier architecture? The essential novelty in XCSF is that the prediction is calculated, instead of being a fixed scalar. The prediction is a linear function of x, the input vector. More precisely, the prediction function approximates a desired output function over the input subdomain defined by the classifier's condition. Other classifiers approximate other parts of the desired output function. Taken together, the classifiers evolve to approximate, within a specified error criterion, the input-output mapping defined by y In the Introduction it was noted that XCS approximates the mapping X \Theta A ) P, which includes actions as well as inputs. But this is just another way of saying that the desired output y (a payoff prediction) is a function of both the input x and the action a taken by the system. We can certainly imagine approximating y with a linear function of both x and a. Further, we can define a generalized classifier that expresses these ideas. The generalized classifier says: "Within the subdomain of X \Theta A defined by the truth function t(x) and the action restriction r(a), the payoff is approximated by the prediction function p(x; a)." The components of (4) are as follows. The truth function t(x) defines the subdomain of X within which the classifier applies ("matches", in the traditional terminology). For example in a binary input space t(x) could be simply "01#0", meaning of course the set of strings f0110, 0100g. Or t(x) could be an S-expression such as (? x 1 x 3 ) (Lanzi 1999). It could also be a representation of a neural network (Bull and O'Hara 2001). Whatever its specific form, a classifier's t(x) determines, given an x, whether or not the classifier applies. The action restriction r(a) defines a range of effector values. For example, r(a) might specify a range of rudder angles between -10 and +34 degrees. More generally, if there were more than one effector (e.g. rudder, aileron, throttle) r(a) is an expression that defines a subdomain of the effector space: a set of effector vectors each taking values, e.g., rudder and aileron angles and throttle positions. In a very simple special case, r(a) would just name an action, such as "turn left", as occurs in traditional classifier systems. Whatever its specific form, a classifier's r(a) specifies an allowed set of effector values should the system decide to act according to this classifier, as will be described. Finally, the prediction function p(x; a) serves to calculate the classifier's payoff prediction just in case t(x) is satisfied and the system intends to take an action a (generally a vector) from r(a). According to its form-e.g. a linear expression in x and a or a combination of other basis functions-p(x; a) calculates a prediction, which is of course an approximation of expected payoff to within a given error criterion. In XCS, of course, p(x; a) is simply a constant. Consider, however, a robot taking fixed-length steps in a plane, but able to turn through any angle. If the robot were supposed to learn to orient and move toward a goal, environmental payoff would probably depend on a (and maybe x), so that the prediction function p(x; a) would depend at least on a. More generally, the prediction function of a given classifier would depend on some or all of the input and effector variables. 7.2 Operation How would generalized classifiers be used in the system's performance, reinforcement, and discovery cycles? In performance, the main step would be to calculate a payoff prediction for each classifier that matches the input x. Since the prediction function p(x; a) also depends on a, what value for a should be used? The answer, if the system is in an exploit mode (i.e., seeking to act on its best information so as to maximize payoff), is to choose a such that this classifier's payoff is maximized. Thus a a2r(a) where a is the chosen action and x is the current input. In many situations this is not a lengthy calculation. For instance, if p(x; a) is linear in x and a, e.g. of the form where the a i correspond to separate effectors, the maximum is obtained by choosing each a i so that the associated term is maximized. Once it had calculated a and the associated each classifier in the match set [M], the system would carry out the action whose prediction was highest. If, on the other hand, the system is in an explore mode (seeking to try new actions in hopes of gaining new information about environmental payoff), a for each classifier in [M] would be selected at random from r(a), or according to some other exploration regime. The system would then randomly choose one of the resulting actions for execution in the environment. The reinforcement or update cycle would consist of updating the classifier whose action was taken (often, updating occurs only in explore mode). The update would occur exactly as in XCSF: the prediction function would be adjusted according to the difference between its prediction and the actual payoff received; then the error and fitness values would be adjusted as in XCS. The discovery cycle would also occur as in XCSF, except that genetic operators, besides acting on the truth function t(x), would also act on the action restriction r(a). For this the syntax of r(a) must of course be amenable to the genetic operators. For example, if the action restriction was of the form (v and this was encoded by concatenating the the genetic operators would apply exactly as they do in XCSF. 7.3 A Special Case To illustrate the generality of (4), it is interesting to see how the Boolean multiplexer problem (Wilson 1995) might be represented. As is quite well known, in a typical learning experiment on the 6-multiplexer, XCS evolves pairs of classifiers such as Each is accurate and maximally general (i.e. can't be generalized further without losing accuracy). There are two classifiers for the same condition because the two possible actions- 1 or 0-result in different payoffs, and XCS evolves accurate classifiers whether or not they are "correct" (payoff 1000) or "wrong" (payoff 0). In the generalized representation, however, the above pair would be covered by a single classifier where r(a) is "#", meaning a can take on either 1 or 0, and p(x; a) is the linear expression 1000a. It can be seen that substituting 1 or 0 in p(x; a) results in the correct payoff for that action. Thus, in this example, the binary-input, discrete action, step-wise payoff case is fully captured by the generalized representation. 7.4 Continuous Actions In what sense does the generalized classifier of (4) lead to a system capable of continuous actions? As discussed in Sec. 7.2 a classifier is in principle capable of advocating any action value permitted by r(a). But in practice, when the system is in exploit mode, the classifier will choose just the action that maximizes its prediction. Thus for a given state of the classifier system a certain discreteness of actions is maintained. However, the degree of discreteness depends on the quality of the prediction function approximations: the better the approximations, the less discretized the action space, since each classifier will cover a smaller portion of that space. Therefore, one can perhaps say that the generalized classifier permits continuous actions in the limit. Why are continuous actions desirable in the first place? It is desirable for a system to be able to choose actions that maximize the payoff available from the environment. In continuous environments, payoff-maximizing actions (precise angles of turns, etc.) will be difficult for a system designer to anticipate, and so it is important that the system can choose them itself to within the limits of its resources-e.g. the quality of approximation permitted by its population size. In general this will be better than any predefined set of fixed actions. However, at some point the actions chosen by the generalized classifier system will be fine-grained enough, so that further resolution-or perfect continuity-will not add significantly to payoff returns. 8 Summary and Conclusions This paper introduced a classifier system, XCSF, designed to learn approximations to func- tions. The prediction estimation mechanism was used to form the approximations: given an input vector x, the value y of the function to be approximated was treated as a payoff to be learned. In its first incarnation, XCSF produced piecewise-constant approximations. A more advanced version added a weight vector to each classifier, permitting the approximation to be piecewise-linear. Tests on simple one-dimensional functions yielded arbitrarily close approximations, according to the setting of an error parameter. The system tended to evolve classifiers that distributed themselves reasonably efficiently over the function's do- main, though some overlap occurred together with the presence of a moderate number of redundant low-fitness classifiers. In limited tests on a six-dimensional nonlinear function, XCSF rapidly formed highly accurate approximations, though the number of classifiers required was much larger than for the one-dimensional functions. Future work should continue with multi-dimensional functions, to determine the tech- nique's general viability and estimate its complexity in terms of learning time and resources (classifiers) required. Since XCSF approximates linear functions effortlessly, regardless of dimensionality, it is likely that the complexity will relate to the degree of "smoothness" or "flatness" in hyperspace that the function exhibits. Comparisons should be made with fuzzy classifier systems, which appear to be quite different in concept: the output of a fuzzy system is computed jointly by more than one classifier, whereas in XCSF an accurate output can in principal be computed by just one. Function approximation with XCSF could be useful for on-line learning of any function or mapping from a vector of input values to an output value. An example would be financial time-series prediction, where a future price is presumably an approximable function of known prices or other quantities at earlier times in the series. Piecewise-linear function approximation in XCSF is based on the idea of calculating a classifier's prediction, and this leads to the concept of a generalized classifier in which the condition is a truth function t(x) of the input x and the prediction is an approximation function p(x; a) that depends on x and an action a. Such a classifier would apply in the subspace of the X \Theta A ) P mapping defined by t(x) and an action restriction r(a) specified in the classifier. Given x, the best action to take would be determined by maximizing a) over the restriction's range. This architecture would appear to permit the system to evolve classifiers that take actions that optimally match the environment's payoff landscape- instead of generally suboptimal actions from a pre-specified finite set. Since we have only presented generalized classifiers conceptually, the next step is to do experiments, especially in domains where they would appear to have advantages. The first advantage is of course continuous vs. discrete actions, so tests in continuous robotic environ- ments, either actual or simulated, are in order. The second advantage lies in the potential generalization power of generalized classifiers. If the payoff function relates to x and a in a way that is readily handled by piecewise-linear approximation, then a generalization advantage should be expected compared with conventional XCS systems. This means savings in space complexity (population size) as well as increased transparency in the system's model. Furthermore, approximation bases other than linear should be tried where promising. Acknowledgement This work was supported in part by NuTech Solutions Inc. --R XCS and GALE: A comparative study of two learning classifier systems with six other learning algorithms on classification tasks. An Introduction to Learning Fuzzy Classifier Systems. A neural rule representation for learning classifier systems. Analyzing the evolutionary pressures in XCS. Extending the Representation of Classifier Conditions Part II: From Messy Coding to S-Expressions Toward optimal classifier system performance in non-Markov environments Machine Learning. The Fuzzy Classifier System: a Classifier System for Continuously Varying Variables. Adaptive switching circuits. Classifier Fitness Based on Accuracy. Generalization in the XCS classifier system. Genetic Programming Mining Oblique Data with XCS. --TR --CTR Lashon B. Booker, Adaptive value function approximations in classifier systems, Proceedings of the 2005 workshops on Genetic and evolutionary computation, June 25-26, 2005, Washington, D.C. Amin Nikanjam , Adel Rahmani, An anticipatory approach to improve XCSF, Proceedings of the 8th annual conference on Genetic and evolutionary computation, July 08-12, 2006, Seattle, Washington, USA Daniele Loiacono , Pier Luca Lanzi, Improving generalization in the XCSF classifier system using linear least-squares, Proceedings of the 2005 workshops on Genetic and evolutionary computation, June 25-26, 2005, Washington, D.C. Pier Luca Lanzi , Daniele Loiacono , Stewart W. Wilson , David E. Goldberg, XCS with computed prediction in multistep environments, Proceedings of the 2005 conference on Genetic and evolutionary computation, June 25-29, 2005, Washington DC, USA Hau Trung Tran , Cdric Sanza , Yves Duthen , Thuc Dinh Nguyen, XCSF with computed continuous action, Proceedings of the 9th annual conference on Genetic and evolutionary computation, July 07-11, 2007, London, England Pier Luca Lanzi , Daniele Loiacono , Stewart W. Wilson , David E. Goldberg, Classifier prediction based on tile coding, Proceedings of the 8th annual conference on Genetic and evolutionary computation, July 08-12, 2006, Seattle, Washington, USA Pier Luca Lanzi , Daniele Loiacono , Stewart W. Wilson , David E. Goldberg, Prediction update algorithms for XCSF: RLS, Kalman filter, and gain adaptation, Proceedings of the 8th annual conference on Genetic and evolutionary computation, July 08-12, 2006, Seattle, Washington, USA Pier Luca Lanzi , Daniele Loiacono , Stewart W. Wilson , David E. Goldberg, Extending XCSF beyond linear approximation, Proceedings of the 2005 conference on Genetic and evolutionary computation, June 25-29, 2005, Washington DC, USA Pier Luca Lanzi , Stewart W. Wilson, Using convex hulls to represent classifier conditions, Proceedings of the 8th annual conference on Genetic and evolutionary computation, July 08-12, 2006, Seattle, Washington, USA Martin V. Butz , Pier Luca Lanzi , Stewart W. Wilson, Hyper-ellipsoidal conditions in XCS: rotation, linear approximation, and solution structure, Proceedings of the 8th annual conference on Genetic and evolutionary computation, July 08-12, 2006, Seattle, Washington, USA Pier Luca Lanzi , Daniele Loiacono, Classifier systems that compute action mappings, Proceedings of the 9th annual conference on Genetic and evolutionary computation, July 07-11, 2007, London, England Daniele Loiacono , Andrea Marelli , Pier Luca Lanzi, Support vector regression for classifier prediction, Proceedings of the 9th annual conference on Genetic and evolutionary computation, July 07-11, 2007, London, England Pier Luca Lanzi , Daniele Loiacono, Standard and averaging reinforcement learning in XCS, Proceedings of the 8th annual conference on Genetic and evolutionary computation, July 08-12, 2006, Seattle, Washington, USA Martin V. Butz, Kernel-based, ellipsoidal conditions in the real-valued XCS classifier system, Proceedings of the 2005 conference on Genetic and evolutionary computation, June 25-29, 2005, Washington DC, USA Martin V. Butz , Martin Pelikan, Studying XCS/BOA learning in Boolean functions: structure encoding and random Boolean functions, Proceedings of the 8th annual conference on Genetic and evolutionary computation, July 08-12, 2006, Seattle, Washington, USA Pier Luca Lanzi , Daniele Loiacono , Stewart W. Wilson , David E. Goldberg, Generalization in the XCSF Classifier System: Analysis, Improvement, and Extension, Evolutionary Computation, v.15 n.2, p.133-168, Summer 2007 Jan Drugowitsch , Alwyn M. Barry, A formal framework and extensions for function approximation in learning classifier systems, Machine Learning, v.70 n.1, p.45-88, January 2008 Jorge Muruzbal, A probabilistic classifier system and its application in data mining, Evolutionary Computation, v.14 n.2, p.183-221, June 2006
function approximation;continuous actions;generalized classifier;classifier systems
601777
Deciding the confluence of ordered term rewrite systems.
replace me
Introduction rewrite systems (TRS) have been applied to many problems in symbolic computa- tion, automated theorem proving, program synthesis and verification, and logic programming among others. Two fundamental properties of TRS are termination and confluence, which together ensure the existence and uniqueness of normal forms and hence a decidable word problem. Let us take a closer look at both properties. Termination of TRS is undecidable even for left-linear one-rule systems [Dau89]. However, a TRS R terminates if, and only if, there is some reduction ordering ? such that l ? r for each l ! r 2 R, and there are practical general-purpose methods for defining such ?. But standard TRS cannot deal with inherently non-orientable axioms (like the commutativity axiom). Therefore they have been generalized to ordered TRS (E; ?), where rewriting is The second author partially supported by the NSF grants CCR-9712396 and INT-9401087. The other three authors are supported by the CCL ESPRIT working group 22457. An earlier verion of this work, presented at the LICS'98 conference, included similar results limited to the LPO ordering. done by applying equations of E in whatever direction agrees with ? [HR87]. Hence ordered TRS can handle any set of equations E, being terminating by definition. A standard choice in practice for ? is some of the existing general-purpose path orderings, since they are easily defined and implemented. In Section 2 we characterize the requirements on ? that are needed for solving word problems by ordered rewriting, and we show that they can be obtained in a simple way for path orderings. Confluence is undecidable in general, but for terminating TRS a decision procedure is given in Knuth and Bendix' landmark paper [KB70]: a TRS is confluent if, and only if, all its critical pairs are joinable. For ordered TRS, deciding confluence is more difficult. It has been a long standing open question, listed for instance as open problem #64 in the RTA'93 list [DJK93]. The main problem is that, due to the ordering restrictions, different instances of a critical pair may require different joinability proofs. Here we prove the decidability of confluence if ? belongs to a class of path orderings: then it is possible to finitely analyze the joinability of all ground instances -possibly with new symbols- of each critical pair. Dealing with new symbols is essential for deciding arbitrary word problems, and it is also a fundamental characteristic of the notion of confluence, since the weaker property of ground confluence, i.e., confluence when rewriting only ground terms over the given signature, is undecidable even for terminating standard TRS [KNO90]. Example: Let E consist of the (clearly non-orientable) single equation y). Then there is a critical pair cp which is (z To show confluence, we have to prove that every instance cpoe is joinable by ordered rewriting with E. In this example, this can be done by considering a number of well-chosen ordering relations between terms that cover all possible cases. On the one hand, one considers (i) yoe, and, on the other, the further possible relations with uoe. In all cases, joinability follows. Note that it is not sufficient here to consider only relations between variables, as observed in [MN90]. In general the picture is not so simple as in the previous example. Joinability proofs may have more than one step, and the cases of ordering relations considered must be compatible with the ones of previous steps, and also the new equality relations may introduce additional subterms that can be rewritten. Furthermore, one has to show that the search process of attempted joinability proofs by such a case analysis is finite, while covering all possible cases. In the following we do this by building for each critical pair cp an arbitrary confluence tree, whose nodes are ordering-constrained equations, and whose root is cp. Children of a node are obtained by three possible steps: constrained rewriting , decomposition, and instantiation. These steps precisely generate the right ordering relations that have to be analyzed. Our main result is finally that (E; ?) is confluent if, and only if, all leaves of the trees are tautologies. The whole process of building the trees importantly relies on existing results for ordering constraint solving. This is also the case for our proof of finiteness of the trees. Here we adapt the constraint solving algorithms of [Nie93] with extended signature semantics (i.e., new symbols may appear in solutions) for the recursive path ordering with status (RPOS). In RPOS, every symbol is assigned a lexicographic or a multiset status. The lexicographic path ordering (LPO) or the multiset path ordering (MPO) are obtained as particular cases of RPOS by making all symbols lexicographic or multiset, respectively (see, e.g., [Der82]). More refined path orderings like KNS [KNS85] or RDO [Les90] are included as well, since all these orderings coincide on ground terms [Der87], and hence the same constraint solving algorithms apply. We emphasize that our decision procedure is not only of theoretical interest. Since Knuth and Bendix' paper in the late 60's, a lot of work has been devoted to the completion of standard TRS and to ordered (or unfailing) completion of ordered TRS (e.g., [BDH86, HR87, Pet90, MN90, BD94]). Ordered completion provably yields a confluent system after a (possibly infinite) number of iterations. It roughly amounts to a systematic closure of the TRS under inclusion of (simplifications of) its non-joinable critical pairs. In order to enhance the efficiency of completion and to find finite complete TRS whenever they exist, powerful methods for proving the joinability (and hence redundancy) of a critical pair are crucial. This is precisely what our method is able to do (automatically), making it now also possible to decide whether the completion has finished. In fact, in [NN93] we reported on the use of similar trees in the Saturate system [GNN95] as a successful method for proving the redundancy of critical pairs. Furthermore, in case of non-joinability, instead of adding the critical pair to E, one may choose to add the non-tautology leaves of the tree. Comparing our result with the undecidability of confluence for arbitrary finite term rewriting systems, it seems quite surprising (in favour of ordered rewriting), since extending the notion of reduction we go from undecidability to decidability. There is an obvious clue for this result: ordered rewriting is always terminating. However, the picture is not so simple. For instance, we also show that for finite sets of constrained equations, confluence is undecidable (while ordered rewriting is still terminating). This relativizes the scope of our decidability result and also shows its significance. Unfortunately, in completion with constraint inheritance [KKR90, NR95], constrained equations appear even if we start with only unconstrained ones. In such an equation e j c, the constraint c records the conditions under which e is derivable. This restricts the number of critical pairs that have to be considered, but arbitrary simplification by rewriting is not allowed any more. In this context, our problem is to decide joinability of the critical pairs by rewriting with a set of constrained equations. This is not easy, because simplification with an arbitrary constrained rule is undecidable [CT97]: given a term s and a rule l ! r j c, it is undecidable whether or not all instances of s can be reduced. Going further, we investigate the use of ordered rewriting in a classical application of rewrite systems: the proof-by-consistency approach to proving inductive theorems [KM87, JK86, Bac88]. Here again, the result is the opposite of what happens in the case of finite rewriting systems: we show that ground reducibility is undecidable for ordered rewriting. The paper is organized as follows. We mainly focus on our decidability result: the decidability of confluence. We first recall in Section 2 the basic notions of ordered rewriting, as well as some results on ordering constraints. In Section 3, we introduce our confluence trees and we show how to solve constraints over the set of normal forms and derive the decidability of confluence. In Section 4 we sketch the undecidability of confluence for a finite set of constrained equations. In Section 5, we show that ground reducibility is undecidable for ordered rewriting. Finally, in Section 6, we state some possible extensions and implications of our decidability result in other areas. Ordered Rewriting and RPOS Constraints We adopt the terminology and the notations of [DJ90]. T is the set of first-order terms built on alphabets F of function symbols and X of variable symbols. T (F) is the set of terms which do not contain any variables. A multiset over a set S is a function M The union and intersection of multisets are defined as usual by M 1 [M 2 and We also use a set-like notation: denotes a and x 6j b. A multiset M is empty An equation is a multiset of two terms, written s and t are in T Positions in a term are strings of positive integers, corresponding to paths in the tree representation of the term. The set of positions of a term t is written Pos(t). If p is a position of t, then tj p is the subterm of t at position p and t[u] p is the term obtained by replacing tj p with u at position p in t. The topmost symbol of a term . The size of a term t, denoted jtj, is 1 if t is a variable and is a term f(t between two terms (identity) will be written j in order to distinguish it from the equality symbol in equations. If ! is a binary relation on a set S, then / is its inverse, $ its symmetric closure, ! its reflexive-transitive closure and ! + its transitive closure. We write and there is no t 0 such that t ! t 0 . Then t is called a normal form of s. The relation ! is well-founded or terminating if there exists no infinite sequence s it is confluent if the relation / contained in the joinability relation ! ffi / . It is locally confluent if the relation / ffi ! is contained in the joinability relation ! ffi / . A relation ! on terms is monotonic if terms u and positions p. A (strict, partial) ordering is an irreflexive transitive binary relation. An ordering - on reduction ordering if it is well-founded, monotonic, and stable under substitutions implies soe - toe for all oe with range in T The word problem for a set of equations E is to check, given an equation or not it is a logical consequence of E (denoted as usual E We denote by $E the smallest monotonic relation on terms such that soe $E toe for all substitutions oe and t. 2.1 Ordered rewriting An ordered term rewrite system (TRS) is a pair (E; -), where E is a set of equations, and - is a reduction ordering. The ordered rewriting relation defined by (E; -) is the smallest binary relation !E;- on terms such that soe !E;- toe whenever soe - toe. Our aim is to apply ordered rewriting with (E; -) for solving word problems E built over T In general will be universally quantified, but it is well-known that it suffices to consider only ground a signature with sufficiently many new constant symbols. For our purposes, we need to go slightly beyond: we consider only one new symbol succ. In the following, let 0 be a constant symbol in F (if there is no constant in F , then 0 is added as usual), let succ be a new unary function symbol not in F , and let F e denote F [ fsuccg. Proposition 1 Let E be a set of equations and let be an equation, where s, t, and all terms in E are built over T oe be the substitution fx 1 7! only if, soe In standard rewriting, termination and confluence of !R suffice for solving word problems in the theory of a TRS R, since then s R t if, and only if, s ! R t, i.e., if the (unique) normal forms of s and t by !R coincide. In ordered rewriting this is no longer the case if the relation !E;- is restricted by a too ordering -. For example, if - is the empty ordering, then !E;- is empty as well (and hence confluent and terminating), but useless for our purpose. A necessary condition on - is clearly that there should be a unique minimal element w.r.t. - in each E-congruence class. But even this is insufficient: if E is is the smallest relation containing a - c and b - c, then !E;- is confluent and terminating but a and c are different E-equivalent normal forms. Since by proposition 1 it suffices to consider word problems where the equation be proved is built over T in the literature this problem is overcome by requiring - to be total on ground terms. Below we show that this can be weakened: it is sufficient that - orients all non-trivial instances of the equations, i.e., these instances have a one-step rewrite proof using !E;- . But in fact it suffices to consider rewrite proofs with an arbitrary number of steps. This leads to the following precise characterization of what is needed for deciding word problems: be an ordered term rewrite system such that !E;- is confluent and terminating on T The the following two statements are equivalent: 1. uoe ! E;- voe for all all oe with range in T 2. For all s, t in T hence the word problem for E is decidable). Proof: The second statement trivially implies the first one. Conversely, for all s; t 2 T clearly t, and, if s t, we have a derivation s and the monotonicity of -, each step can be decomposed into zero or more steps of $E;- , and, by confluence and termination of !E;- , this implies t. 2 This lemma shows the relevance of the following: be a set of equations built on T Given a well-founded monotonic ordering - on T (F), the ordered rewrite system (E; -) is ground confluent if !E;- is confluent on T (F). Given a well-founded monotonic ordering - on T confluent if !E;- is confluent on T Note that in classical term rewriting confluence is defined for arbitrary extensions of F with new symbols, but this makes no sense in ordered rewriting without extending - accordingly. But, as said, the extension to T practice, and hence our definition of confluence for ordered TRS is the adequate counterpart of confluence of classical TRS. As for classical term rewriting, in ordered rewriting there is a gap between confluence and ground confluence: given an ordering - on T confluence implies ground confluence, but the converse is false. An easy example if given by 0g. This rewrite system is not confluent. However, if F only consists of 0; f , then the system is ground confluent. This example also applies to ordered rewrite systems: introducing new symbols in F e allows to form critical peaks that cannot be reduced. For example, with the corresponding -, we would have f(succ(0)) !E;- succ(0) and f(succ(0)) !E;- 0, with distinct normal forms succ(0) and 0. In the next section, the new symbol succ will also be used to build solutions of ordering constraints, which is crucial in this respect. 2.2 The Recursive Path Ordering with Status (RPOS) Let - be an ordering on terms and let = be a congruence relation. The lexicographic (left to right) extension - lex of - w.r.t. = for n-tuples is defined: for some k in is well founded, so is - lex . The extension of = to multisets, denoted by = mul , is the smallest relation such that The extension of - to multisets w.r.t. = is defined as the smallest ordering - mul s.t. If - is well-founded on S, so is - mul on finite multisets over S [DM79]. Let ?F be a well-founded ordering on F (called the precedence), and let stat be the status function stat: F ! flex,mulg. Then the RPOS ordering is defined as follows: s ? rpos x if x is a variable that is a proper subterm of s or else s j at least one of the following conditions hold: t, for some (and hence n=m) and (and hence n=m) and rpos and ? mul rpos are defined w.r.t. = rpos , equality up to permutation of arguments of function symbols with mul (multiset) status. RPOS is a reduction ordering on terms that fulfills the subterm property (s ? rpos t if t is a proper subterm of s). Hence it also contains the (strict) tree embedding relation, the smallest transitive monotonic relation ? emb such that s ? emb t if t is a proper subterm of s. LPO is the particular case of an RPOS with only lex (lexicographic) status symbols. It is a simplification ordering that is total on T (F) if ?F is total on F . RPOS is total on is total on F . LPO with a total precedence is a standard choice for ordered TRS, since it fulfills the requirements of Lemma 1 if the precedence is total on F . For RPOS these requirements have to be ensured by making f lexicographic whenever there are "permuting" equations (possibly with some context) where - is a permutation, thus avoiding any non-orientable F e -instances. Hence in the following we will assume ? rpos to be such an RPOS on T linear precedence ?F e where 0 is the smallest constant symbol in F (if there is no constant in F we can add one w.l.o.g.) and the unary symbol succ is the smallest function symbol. Furthermore, we will consider ordered rewrite systems (E; ? rpos ), but all our results apply equivalently to ordered TRS (E; -) where - is any ordering such that s - t iff s ? rpos t for all ground terms s and t, which is in particular the case for the aforementioned path orderings KNS and RDO. The ordering ? lpo will be used several times to denote an RPOS where all symbols have lexicographic status. Example 1 Let E be the set fx zg. If s j t and hence s t +s. We also have (succ(0)+0)+0 !E;? lpo (0+succ(0))+0 !E;? lpo 0+(0+succ(0)), the latter term being irreducible. Example 2 Let E be the set ff(x; f(a; a) !E;? lpo g(a; a), but f(a; a) also rewrites into g(a; b) or g(a; 0) or into g(a; succ(0)), etc., since there is a choice on how to instantiate the so-called extra variable z, as long as the step is reductive w.r.t. ? lpo Of course, if !E;? lpo is confluent all choices lead to the same normal form. For the equivalent set is confluent and all terms of the form f(s; t) or g(s; t) have g(s; 0) as unique normal form. Clearly 0 is the most "efficient" choice for instantiating extra variables like z; in fact, to reach a normal form here, one is eventually forced to chose 0. 2.3 RPOS constraints Definitions and notations of this section are consistent with [Com90, Nie93, NR95], which refer to for more details and the main results. Here we restrict ourselves to RPOS-constraints with extended signature semantics, which is, as we will see, what is needed for our results on confluence. In the following, an RPOS constraint is a Boolean combination (using the connectives -; :) of atoms ordering constraint is interpreted on T the Boolean connectives have their usual meaning and an assignment oe of the variables of s ? t (resp. oe when the assignment oe satisfies the constraint c; then oe is called a solution for c. We sometimes write chains s and also s - t as a shorthand for s ? t. Example 3 Let oe be the assignment fx 7! succ(0); y 7! succ(succ(0))g. Then oe x. The constraint f(x; y) ? unsatisfiable independently of the (lexicographic or multiset) status of f . An interesting property of RPOS is that for non-variable terms s and t, the relation follows from at least one conjunction of relations of the form s are subterms of s and t respectively and jsj rise to the so-called RPOS decomposition of a relation s ? t: if s j f(s ffl for all are RPOS decompositions of s ? t is an RPOS decomposition of s ? t m) and of the form: i.e., all constraints implying hs are RPOS decompositions of s ? t. m) and implying are RPOS decompositions of s ? t. An RPOS constraint c without disjunctions is called RPOS-closed iff 0 ? x is not in c and for each relation s ? t in c where s and t are non-variable terms, c contains an RPOS-decomposition of s ? contained as well if s j t). Example 4 Suppose f ?F e g. The RPOS decomposition of f(x; y)?g(x; z) is f(x; y)?x - y)?z. The four RPOS decompositions of g(x; y)?f(y; z) are x?f(y; z), x=f(y; z), z). There are six RPOS decompositions of f(x; y) ? f(y; z) if namely x?f(y; z), y?f(y; z), x=f(y; z), y=f(y; z), x?y - f(x; y)?z and x=y - y?z. There is one RPOS decomposition of f(x; y)?f(z; x) if namely y?z. A simple system S is a particular constraint of the form s n # n s or ?, every strict subterm of an s i is some s j and i is the least equivalence relation on fs which contains all pairs (s such that # i is =. ? S is the least transitive relation on fs containing all pairs and such that In are respectively the equality and ordering constraints that can be deduced from S. In what follows, we will assume that all terms occurring in a simple system are written in a sorted way, that is, such that t i occurs in S for f with multiset status and 1 n. The equational part of a simple system S, which we write eqpart(S), is tg. The inequational part of S, denoted ineqpart(S), is fsoe ? oe is the most general simultaneous unifier of eqpart(S) and if eqpart(S) is not unifiable. S is called purely inequational if S j ineqpart(S). The satisfiability problem for RPOS constraints over extended signatures can be solved in NP time following the methods of [Nie93]. Key steps for these results are as follows: 1. Any constraint c is (effectively) equivalent to a finite disjunction of simple systems hence c is satisfiable if, and only if, S i is satisfiable for some 2. A simple system S is unsatisfiable if eqpart(S) is not unifiable. 3. A simple system S is equivalent to ineqpart(S) if eqpart(S) is unifiable. 4. A purely inequational simple system is satisfiable if, and only if, it is RPOS-closed. Proof: We only sketch the proof for the last statement, since it is less obvious and the construction will be used throughout the paper. First, note that if s ? S t and S contains no RPOS decomposition for s ? t, then it must be unsatisfiable since S is closed under subterms and hence S must be in contradiction with all RPOS decompositions of s ? t. This happens for example with the constraint f(y; For the reverse implication, if S is of the form s build a solution oe from right to left, i.e., by induction on the index i: if s i is a variable, then let s i oe be succ(0) To see that this oe is indeed a solution, we use the fact that S is RPOS-closed: using an induction argument on jsj + jtj for each relation s ? S t, it can be shown that the substitution oe satisfies S if, and only if, it satisfies all relations s or t is a variable, which in turn holds since succ is a new smallest symbol (see [Nie93] for details). 2 In the following, the previous kind of solution for S will be called the minimal solution for S. Note that it is alien: for every variable x, the solution xoe is headed by the new 3 Decidability of confluence of ordered rewriting In the following, (E; ? rpos ) will be an ordered TRS. According to the previous section, we assume that terms of E belong to T that substitutions, and the interpretation of constraints are in T constrained equation is a pair is an equation and c is a constraint. It denotes all its instances: the equations such that oe Hence it is a tautology if soe j toe for all such oe. A critical pair between two equations of E is a constrained equation u[t] for some position p such that uj p is not a variable. Newmann's lemma states that, for a terminating relation, confluence is equivalent to local confluence, which for term rewriting (resp. ordered rewriting) reduces to the joinability of critical pairs. The following result is essentially due to J. Hsiang and M. Rusinowitch [HR87] (see also [BDH86]): Lemma 2 !E;?rpos is confluent if, and only if, for every critical pair equations in E all its instances are joinable, i.e., there is a term u such that E;?rpos u / E;?rpos toe. A confluence tree for (E; ? rpos ) and a critical pair is a tree T where the nodes of T are constrained equations, the root of T is and the children of a node e j c in T are the constrained equations obtained by one of the following three kinds of steps: 1. By constrained rewriting , e j c can be rewritten with and into the complementary equation e j c - roe - loe iff loe ?roe is satisfiable for every variable x in r not occurring in l x+z-y?x?z x+z-y?z-x z ?y?x z ?x Figure 1: An example of a confluence tree 2. By decomposition, e j c can be rewritten into fe if c is satisfiable and not a simple system and fS is an equivalent set of simple systems for c. 3. By instantiation, e j c can be rewritten into eoe j ineqpart(c), if c is a satisfiable and not purely inequational simple system, and oe is the most general unifier of eqpart(c). Example 5 Consider again the set E Critical pairs are Other pairs yield unsatisfiable constraints or renamings of the above pairs. Then a confluence tree rooted with the first one, as it was automatically generated by the Saturate system [NN93], is depicted in Figure 1. Note that in a constrained rewrite step with the associativity axiom (like the one applied to the root) the complementary equation always has an unsatisfiable constraint (and is hence not shown). The three framed nodes are leaves. Only the leftmost one is a tautology and hence E is not confluent. The last step for the two rightmost framed nodes is by decomposition and instantiation. The three other nodes without descendants become leaves after one step of decomposition and instantiation followed in some cases by one rewrite step with associativity. Proof plan: Our decision procedure will be based on the construction of one (arbitrary) confluence tree for each critical pair. The main result will be that !E;?rpos is confluent if, and only if, all these trees have only tautology leaves. For this purpose, we first show that the trees are finite (Lemma 3), and that it is easy to decide whether a leaf is a tautology (Lemma 4). Then, in Lemma 5 we show that every instance of the critical pair at the root can be rewritten into some leaf, and hence !E;?rpos is confluent if all leaves are tautologies, since then all instances of the critical pairs are joinable. Finally, for the (harder) reverse implication (Lemma 6), from every non-tautology leaf c we can reconstruct a substitution oe (not necessarily a solution of c) such that soe and toe are distinct and in normal form, which contradicts confluence, since E Lemma 3 Every confluence tree is finite. Proof: The tree is finitely branching. Hence by K-onig's lemma it suffices to show that every path is finite. Assume the contrary. Only a finite number of instantiation steps can be applied on a branch since they reduce the number of variables of the descendant nodes, and no two consecutive decomposition steps can be applied to a node. Hence there must be an infinite branch with only constrained rewriting steps (each one followed by zero or one de- compositions). This branch has no infinite subsequence of only complementary steps, since the number of possible applications of equations to a finite e is finite, and no complementary steps can be applied twice at the same position (then the non-complementary constraint becomes unsatisfiable). Hence there must be an infinite number of non-complementary steps. By Kruskal's theorem, since all terms in the tree are built over a finite set of symbols, on such an infinite branch there must be a node e , such that by construction of the tree, for all oe such that oe c be a constrained equation where c is a purely inequational simple system. Then is a tautology if, and only if, either c is unsatisfiable or s j t. Proof: Clearly if c is unsatisfiable or s j t then is a tautology. For the reverse direction, suppose c is satisfiable and s 6j t. Then c has an alien solution oe (for every variable x, the solution xoe is headed by the new symbol succ), and it is easy to see that such alien oe cannot unify two different terms in T Hence soe 6j toe and not a tautology. 2 Lemma 5 Let T be a confluence tree rooted by all leaves of T are tautologies, then all instances of are joinable. Proof: Let soe = toe be an instance of with soe and toe in T show by induction on the depth of the tree that soe = toe is joinable. If is already a leaf, then it must be a tautology, and all instances of tautologies are trivially joinable. Otherwise the children of are obtained by one of the three different steps. By constrained rewriting with some the children are s[r'] and either an instance of one of the children or it rewrites into one of them. In each case joinability follows by induction hypothesis (each subtree has a smaller depth). By decomposition, the children are g. Since c is equivalent to a disjunction of the S i , toe is an instance of one of the children and joinability follows by the induction hypothesis. By instantiation, the only descendant is is still an instance of the child and joinability follows by the induction hypothesis. 2 Lemma 6 Let (E; ? rpos ) be an ordered TRS and let T be a confluence tree for some critical pair between two equations in E. If T has some non-tautology leaf then !E;?rpos is not confluent. Proof: From a non-tautology leaf c we can reconstruct a substitution oe (not necessarily a solution of c) such that soe and s 0 oe are distinct and in normal form w.r.t. !E;?rpos , which contradicts confluence, since E We first build a satisfiable RPOS-closed constraint G (for graph) expressing that s and s 0 are irreducible. Let ff be an alien solution of c. Then ff can be used to totally order the set of all = rpos -different subterms of s and s 0 , so there is a simple system s (the spine of G) containing all subterms of s and s 0 such that ff is a solution of the spine. This spine is the first part of G. Now we add to G all relations r' ? s i (the ribs of G) such that l' j s i for some i and some Hence r' does not contain any variables that are not in the spine, and all variables of G are in the spine of G. Since ff is a solution of c we have r'ff - rpos l'ff (otherwise would be further reducible and would not be a leaf). But impossible because ff is alien and l' 6= rpos r', so we have r'ff ? rpos l'ff. Hence ff satisfies G (both the spine and the ribs). Now we can close G under RPOS while keeping ff as a solution of G. Since the spine is already RPOS-closed, this only has to be done for the ribs r' ? s i . It only produces new ribs of the form t ? s j since equalities are again impossible because ff is alien. Note that here t is not a variable since all variables are already on the spine. We now complete the proof by showing that a) the minimal solution oe of the spine satisfies the whole G and are distinct and irreducible w.r.t. !E;?rpos . a) it suffices to show toe ? rpos soe for all pairs t ? s i in G where s i is in the spine and t is not (and hence t is not a variable). We proceed by induction on the ordering on pairs (s whose first component is i (the situation of s i in the spine) and whose second component is the subterm ordering on t. If s i is a variable and toe ? rpos s i oe since t contains at least one symbol g of F with g ?F e 0. If s i is a variable and by the induction hypothesis toe ? rpos s i\Gamma1 oe and hence since t is headed by a symbol of F . If s i is not a variable, then t ? s i follows by the induction hypothesis from relations that are smaller under the measure since G is RPOS-closed. oe satisfies the spine s are distinct. Now we prove that they are also irreducible w.r.t. !E;?rpos . We proceed by induction on the sub-indices i in s is succ(0) which is clearly irreducible. If s 1 is ground then it is also irreducible since s 1 is a subterm of in the leaf. For the induction step, if s i is a variable, then s i oe is succ(s i\Gamma1 oe) which is irreducible since s i\Gamma1 oe is irreducible by the induction hypothesis. If s i is not a variable, it is of the form f(t and all t j are some s k with i ? k and the t j oe are irreducible by the induction hypothesis and hence we only have to check reducibility at the topmost position. Suppose s i oe j l' for some We show that for all such it is the case that is alien, all variable positions of l must be positions in s i (otherwise some non-variable position of l would be succ). This means that s i j lae for some ae and that ' j aeae 0 for some ae 0 . If lae = rpos rae then and we are done. If lae 6= rpos rae then rae ? lae is a relation in G and hence raeoe ? rpos laeoe which implies r' - rpos l'. 2 Theorem 1 The confluence of ordered TRS (E; ? rpos Let us conclude this section by an example of application: we show how completion of associativity and commutativity axioms yields a confluent ordered rewrite system, making use of the above algorithm to check the confluence. Example 6 We continue Example 5: we consider the axioms of associativity and commutativity of the binary (lexicographic status) symbol +. These axioms cannot be handled by standard completion as commutativity cannot be oriented without loosing termination. The confluence tree of Example 5 shows that these two axioms alone are not confluent w.r.t. ordered rewriting since there are leaves of the confluence tree which are not tautologies. We may however add the equations which are leaves of the tree to the original set of axioms without modifying the original equational theory (this is a completion process) and check again for ordered confluence. For instance, following Figure 1, we may add the equation x the original set of equations. Then we have a 3 equations presentation which turns out to be confluent w.r.t. ordered rewriting. There are more than 10 critical pairs to be considered and hence the associated confluence trees with tautology leaves cannot be depicted here (but they can be automatically reproduced by the Saturate system). For this example, confluence can also be proved by means of the incomplete method given by Martin and Nipkow in [MN90]. Their method is based on the fact that every instance with some oe of a critical pair cp orders the variables of cp in some way, and sometimes one can prove confluence for each ordering. For example, one cp is and if the ordering is x information is needed to show that both sides of cpoe rewrite into x 1 oe (In fact, normalization in this rewrite system is simply sorting and associating to the right.) Note that in many cases (e.g., the example given in the introduction) Martin and Nipkow's analysis is too coarse. In general, even a case analysis on all possible orderings between all subterms of the critical pair does not suffice. 4 Undecidability of confluence of constrained equations If we use full constraints inheritance, then ordered completion generates constrained equations. Hence, it would be nice to be able to decide not only the confluence of an ordered rewrite system (E; ? rpos ), but also consider the case where E may contain constrained equations. Here, we show that this is impossible as going from unconstrained to constrained equations, confluence becomes undecidable. Given a constrained equation rewrites to v using e if, and only if, u rewrites to v using an instance soe = toe such that oe t. Confluence and ground confluence of sets of constrained equations are defined accordingly. Theorem 2 The problem of confluence of ordered rewriting for a finite set of constrained equations is undecidable. Proof: The main idea is that we can express, without any reference to s; 0 that a term cannot contain s; 0. Then we can reduce ground confluence of a terminating rewrite system to the confluence of ordered rewriting with respect to a set of constrained equations. On the other hand, ground confluence is undecidable, even for terminating rewrite systems. We reduce the ground confluence problem for an lpo-terminating string rewriting to the confluence of ordered rewriting of a finite set of constrained equations. The former is undecidable [KNO90]. We consider the system R u;v of [KNO90], section 5. It only involves unary function symbols. No right hand side is reduced to a variable. This system is terminating; its termination can be proved using an lpo extending a total precedence on a finite alphabet of unary function symbols, plus a constant $, which is the smallest constant in the signature. Then, we extend this signature F with 3 function symbols: m ? succ ? 0 which is at the lower end of the precedence. Let F Our set of equations contains R u;v plus the following additional and a copy of some rules in R u;v Basically, the first equation expresses what we want: the solutions for y of m(f(x)) ? y ? f(x) are the terms succ is the resulting set of constrained equations, we claim that for every term s 2 T which belongs to T According to the three last sets of rules, the only irreducible term in T (f$; m; succ; 0g) is 0 and every term in this set reduces to 0. The first set of rules eliminates all occurrences of succ which are above a confluent since all critical pairs are trivially joinable. Moreover, on T is the reduction relation with respect to E 0 until a normal form is reached. This can be shown by induction on the number of rewriting steps. This implies more generally that Now, we claim that ! ?;E is confluent iff R u;v is ground confluent, which proves undecidability First assume that R u;v is ground confluent (on T (F)). Then E 1 is ground confluent on only have to show the local confluence. Assume by the above commutation property, s 2 and by ground confluence of are joinable by , which shows the confluence. Conversely, assume that ! ?;E is confluent. Then ! ?;E 1 is confluent on T term in T only be rewritten by rules in E 1 . Replacing 0 with $ we get the confluence of R u;v on T 5 Undecidability of ground reducibility Let us recall that a term t is ground reducible w.r.t. a rewrite system R iff all instances of t are reducible by R. This definition extends to ordered rewriting, replacing R with !E;? when E is a finite set of (unconstrained) equations. Ground reducibility is decidable for arbitrary finite term rewriting systems [Pla85]. We show here that it is undecidable for finite sets of equations: Theorem 3 The problem: Input: A finite set of (unconstrained) equations E, a term t, a lexicographic path ordering. Question: Is t ground reducible w.r.t. !E;? ? is undecidable. Proof: We reduce the halting problem for a two-counters machine. First, let us recall this computation model. A (deterministic) two counter machines is a tuple (q a finite set of states, is the set of final states, q 0 is the initial state and \Delta is a transition function from Q to a finite set of actions A, consisting of 1. couples (1; 2. couples (2; 3. triples (1; q 4. triples (2; q We assume that \Delta is undefined on states q 2 Q f . A configuration of the machine consists in two non-negative integers n; m and a state q 2 Q. A move of the machine from configuration (n possible iff there is a transition \Delta(q) = a and 1. Either 1 . (Increase counter i and move to q 0 ). 2. Or 2 . (If counter i is zero, move to q 0 without changing the counters values). 3. Or a counter i is positive, decrement it and move to q 0 ). The input of such a machine is a non-negative integer n, corresponding to the initial configuration (n; 0; q 0 ). The machine halts on the input n iff there is a finite sequence of transitions yielding a configuration (n The following problem is undecidable [Min67]: Input : a two counter machine M and a non-negative integer n Question a @ @ @ @ a n k a m k 0 Figure 2: Representation of a sequence of configurations We may assume without loss of generality that q 0 6= q 00 whenever suffices to introduce two new states q 0 1 and q 0 In order to encode two-counters machines, we consider an alphabet where every symbol of Q (the set of states of the machine) is a ternary symbol, a; b are unary symbols and 0 is a constant. F is ordered according to q ? a and the states are ordered in an arbitrary way. We let t n be the term q 0 (a n (0); 0; x) and we are going to show that t n is not ground reducible (w.r.t. a set of equations which is defined below) iff M halts on n. Intuitively, we are going to design E in such a way that irreducible ground instances of t n encode (halting) sequences of successive configurations of the machine, as depicted on figure 2. Configurations of the machine are there (n We divide the set of equations into 2 parts: the first part is independent of \Delta and is designed in such a way that only sequences of possible configurations (not necessarily consecutive ones) are kept as irreducible terms. The second set (the main one) encodes the computations of the machine. The first set of equations 1. q(x; For every non final state q 2. q(x; for every state q 3. q(q 0 for every states q; q 0 4. for every states q; q 0 5. a(q(x; for every state q All these equations can actually be turned into rules from left to right. Irreducible ground terms w.r.t. these rules are the terms a k (0) and the terms of the form: a @ @ a n k a m k 0 is a final state. Let S 1 be this set of ground terms. In what follows, we only have to consider the applicability of the rules on S 1 . The second set of equations Equation (7) simply remove configurations which cannot be consecutive because of the successive states. 7. Now, we have to move the counters in the right way. The following array displays the equations in the case where summarizes the constraints which are imposed by each rule on a the terms of S 1 . equation condition on the transition constraint on resulting from the irreducibility 9 q(x; (8), when applied from left to right reduces a term q(a when a cannot be applied from right to left on terms of S 1 since b does not occur in any term of S 1 . when applied from left to right reduces a term q(a when a As before, (9) cannot be applied from right to left on terms from S 1 . (10) forces Putting together (8), (9) and (10), if we assume that there is a rule is irreducible (at the root) iff Note that the role of b is twofold: each time it appears in a right member of a rule, we have only to consider possible applications of the equation from left to right, since b does not occur in any term of S 1 . This forces to consider a particular orientation, which we will not recall in what follows. Then, because b is minimal in the precedence, it plays no role in the ordering constraint, except that it prevents some equalities. In a similar way, (11) and (12) force the second counter to be remain constant (i.e. rules. Now, we have similar equations as (8-12) for transitions equation condition on the transition constraint on resulting from the irreducibility 14 q(x; Finally, we design similar rules for the other transitions, which are displayed in the next array. equation condition on the transition constraint on resulting from the irreducibility 19 q(x; 22 q(0; 26 q(x; 28 q(x; 29 q(x; 34 q(x; For instance, if equations (18) and (22) force a transition to q 0 when the first counter is 0 and a transition to q 00 when the counter is not 0. Then the new values of the counters are forced by equations (19), (20), (21) (in case of a transition to q 0 ) and (23-26) in case of a transition to q 00 . In the end, we get what we were looking for: irreducible terms of S 1 are those in which every pattern q(a corresponds to a move (n of the machine. 2 6 Conclusion We have shown that the behaviour of ordered rewriting is exactly the opposite of classical term rewriting for two important problems: confluence and ground reducibility. Confluence becomes decidable (whereas it is undecidable for term rewriting) and ground reducibility becomes undecidable (whereas it is decidable for term rewriting). These results provide interesting insights into the theory of ordered rewriting. Regarding our proof of confluence of ordered TRS, in fact we show that confluence is equivalent to ground confluence over a signature with only the new symbol succ, which is what we finally show decidable. It is not difficult to show that for terminating TRS the same results hold. Regarding the applications to completion, apart from what has already been mentioned in the introduction, we also remark that our decision method works as well if, instead of building a tree for each critical pair e j c - uj p =s, we build it for eoe j ? starting with an empty ordering constraint. However, the initial constraint c increases the efficiency of the procedure in practice by reducing the size of the tree. Several questions remain open. For instance, our results heavily rely on a particular class of path orderings. Is there any other class of orderings that is useful in the context of ordered TRS for which confluence is also decidable? Acknowledgment We thank R. Treinen for his comments on an earlier version of the paper. --R Proof by consistency in equational theories. Equational inference Orderings for equational proofs. Solving symbolic ordering constraints. The first-order theory of lexicographic path orderings is undecidable Simulation of Turing machines by a left-linear rewrite rule Orderings for term-rewriting systems Termination of rewriting. Rewrite systems. More problems in rewriting. Proving termnation with multiset order- ings The Saturate System On word problems in equational theories. Automatic proofs by induction in equational theories without constructors. Simple word problems in universal algebras. Deduction with symbolic constraints. Proof by consistency. On ground confluence of term rewriting systems. A path ordering for proving termination for term rewriting systems. On the recursive decomposition ordering with lexicographical status and other related orderings. Ordered rewriting and confluence. Simple LPO constraint solving methods. Practical results on the saturation of full first-order clauses: Experiments with the saturate system Theorem Proving with Ordering and Equality Constrained Clauses. Complete sets of reductions with constraints. confluence tests and completion methods. --TR A path ordering for proving termination of term rewriting systems Proof by consistency On word problems in equational theories Termination of rewriting Simulation of turing machines by a left-linear rewrite rule On ground-confluence of term rewriting systems On the recursive decomposition ordering with lexicographical status and other related orderings Ordered rewriting and confluence Complete sets of reductions with constraints Simple LPO constraint solving methods Equational inference, canonical proofs, and proof orderings Theorem proving with ordering and equality constrained clauses The first-order theory of lexicographic path orderings is undecidable Proving termination with multiset orderings More Problems in Rewriting Saturation of First-Order (Constrained) Clauses with the Saturate System
confluence;rewrite systems;ordered rewriting;path orderings
601779
Fixed-parameter complexity of semantics for logic programs.
A decision problem is called parameterized if its input is a pair of strings. One of these strings is referred to as a parameter. The following problem is an example of a parameterized decision problem with k serving as a parameter: given a propositional logic program P and a nonnegative integer k, decide whether P has a stable model of size no more than k. Parameterized problems that are NP-complete often become solvable in polynomial time if the parameter is fixed. The problem to decide whether a program P has a stable model of size no more than k, where k is fixed and not a part of input, can be solved in time O(mnk), where m is the size of P and n is the number of atoms in P. Thus, this problem is in the class P. However, algorithms with the running time given by a polynomial of order k are not satisfactory even for relatively small values of k.The key question then is whether significantly better algorithms (with the degree of the polynomial not dependent on exist. To tackle it, we use the framework of fixed-parameter complexity. We establish the fixed-parameter complexity for several parameterized decision problems involving models, supported models, and stable models of logic programs. We also establish the fixed-parameter complexity for variants of these problems resulting from restricting attention to definite Horn programs and to purely negative programs. Most of the problems considered in the paper have high fixed-parameter complexity. Thus, it is unlikely that fixing bounds on models (supported models, stable models) will lead to fast algorithms to decide the existence of such models.
Introduction In this paper we study the complexity of parameterized decision problems concerning models, supported models and stable models of logic programs. In our investigations, we use the framework of the fixed-parameter complexity introduced by Downey and Fellows [DF97]. This framework was previously used to study the problem of the existence of stable models of logic programs in [Tru01]. Our present work extends results obtained there. First, in addition to the class of all finite propositional logic programs, we consider its two important subclasses: the class of Horn programs and the class of purely negative programs. Second, in addition to stable models of logic programs, we also study supported models and arbitrary models. A decision problem is parameterized if its inputs are pairs of items. The second item in a pair is referred to as a parameter. The problems to decide, given a logic program P and an integer k, whether P has a model, supported model or a stable model, respectively, with at most k atoms are examples of parameterized decision problems. These problems are NP-complete. However, fixing k (that is, k is no longer regarded as a part of input) makes each of the problems simpler. They become solvable in polynomial time. The following straightforward algorithm works: for every subset M ' At(P ) of cardinality at most k, check whether M On leave from Faculty of Mathematics and Information Science, Warsaw University of Technology. ?? The second author was partially supported by the NSF grants CDA-9502645, IRI- 9619233 and EPS-9874764. is a model, supported model or stable model, respectively, of P . The check can be implemented to run in linear time in the size of the program. Since there are sets to be tested, the overall running time of this algorithm is O(mn k ), where m is the size of the input program P and n is the number of atoms in P . The problem is that algorithms with running times given by O(mn k ) are not practical even for quite small values of k. The question then arises whether better algorithms can be found, for instance, algorithms whose running-time estimate would be given by a polynomial of the order that does not depend on k. Such algorithms, if they existed, could be practical for a wide range of values of k and could find applications in computing stable models of logic programs. This question is the subject of our work. We also consider similar questions concerning related problems of deciding the existence of models, supported models and stable models of cardinality exactly k and at least k. We refer to all these problems as small-bound problems since k, when fixed, can be regarded as "small". In addition, we study problems of existence of models, supported models and stable models of cardinality at most jAt(P )j \Gamma k, exactly jAt(P and at least jAt(P )j \Gamma k. We refer to these problems as large-bound problems, since jAt(P )j \Gamma k, for a fixed k, can be informally thought of as "large". We address these questions using the framework of fixed-parameter complexity [DF97]. Most of our results are negative. They provide strong evidence that for many parameterized problems considered in the paper there are no algorithms whose running time could be estimated by a polynomial of order independent of k. Formally, a parameterized decision problem is a set L ' \Sigma \Theta \Sigma , where \Sigma is a fixed alphabet. By selecting a concrete value ff 2 \Sigma of the parameter, a parameterized decision problem L gives rise to an associated fixed-parameter problem Lg. A parameterized problem L ' \Sigma \Theta \Sigma is fixed-parameter tractable if there exist a constant t, an integer function f and an algorithm A such that A determines whether (x; y) 2 L in time f(jyj)jxj t (jzj stands for the length of a string z 2 \Sigma ). We denote the class of fixed-parameter tractable problems by FPT. Clearly, if a parameterized problem L is in FPT, then each of the associated fixed-parameter problems L y is solvable in polynomial time by an algorithm whose exponent does not depend on the value of the parameter y. Parameterized problems that are not fixed-parameter tractable are called fixed-parameter intractable. To study and compare the complexity of parameterized problems Downey and Fellows proposed the following notion of fixed-parameter reducibility (or, simply, reducibility). Definition 1. A parameterized problem L can be reduced to a parameterized problem L 0 if there exist a constant p, an integer function q, and an algorithm A such that: 1. A assigns to each instance (x; y) of L an instance 2. A runs in time O(q(jyj)jxj p ), 3. x 0 depends upon x and y, and y 0 depends upon y only, 4. (x; y) 2 L if and only if We will use this notion of reducibility throughout the paper. If for two parameterized problems L 1 and L 2 , L 1 can be reduced to L 2 and conversely, we say that L 1 and L 2 are fixed-parameter equivalent or, simply, equivalent. Downey and Fellows [DF97] defined a hierarchy of complexity classes called the W hierarchy: The classes W[t] can be described in terms of problems that are complete for them (a problem D is complete for a complexity class E if D 2 E and every problem in this class can be reduced to D). Let us call a Boolean formula t- normalized if it is a conjunction-of-disjunctions-of-conjunctions . of literals, with t being the number of conjunctions-of, disjunctions-of expressions in this definition. For example, 2-normalized formulas are conjunctions of disjunctions of literals. Thus, the class of 2-normalized formulas is precisely the class of CNF formulas. We define the weighted t-normalized satisfiability problem as: Given a t-normalized formula \Phi and a non-negative integer k, decide whether there is a model of \Phi with exactly k atoms (or, alternatively, decide whether there is a satisfying valuation for \Phi which assigns the logical value true to exactly k atoms). Downey and Fellows show that for every t - 2, the problem WS(t) is complete for the class W[t]. They also show that a restricted version of the problem WS(2): Given a 2-normalized formula \Phi with each clause consisting of at most two literals, and an integer k, decide whether there is a model of \Phi with exactly k atoms is complete for the class W[1]. There is strong evidence suggesting that all the implications in (1) are proper. Thus, proving that a parameterized problem is complete for a class W[t], t - 1, is a strong indication that the problem is not fixed-parameter tractable. As we stated earlier, in the paper we study the complexity of parameterized problems related to logic programming. All these problems ask whether an input program P has a model, supported model or a stable model satisfying some cardinality constraints involving another input parameter, an integer k. They can be categorized into two general families: small-bound problems and large- bound problems. In the formal definitions given below, C denotes a class of logic programs, D represents a class of models of interest and \Delta stands for one of the three arithmetic relations: "-", "=" and "-". Given a logic program P from class C and an integer k, decide whether P has a model M from class D such that jM j \Delta k. Given a logic program P from class C and an integer k, decide whether P has a model M from class D such that (jAt(P )j \Gamma In the paper, we consider three classes of programs: the class of Horn programs H, the class of purely negative programs N , and the class of all programs A. We also consider three classes of models: the class of all models M, the class of supported models SP and the class of stable models ST . Thus, for example, the problem SP- (N ) asks whether a purely negative logic program P has a supported model M with no more than k atoms (jM j - k). The problem ST 0 asks whether a logic program P (with no syntactic restrictions) has a stable model M in which at most k atoms are false (jAt(P Similarly, the problem M 0 - (H) asks whether a Horn program P has a model M in which at least k atoms are false (jAt(P In the three examples given above and, in general, for all problems D \Delta (C) and D 0 (C), the input instance consists of a logic program P from the class C and of an integer k. We will regard these problems as parameterized with k. Fixing k (that is, k is no longer a part of input but an element of the problem description) leads to the fixed-parameter versions of these problems. We will denote them D \Delta (C; In the paper, for all but three problems D \Delta (C) and D 0 (C), we establish their fixed-parameter complexities. Our results are summarized in Tables 1 - 3. Table 1. The complexities of the problems D- (C) and D 0 (C). In Table 1, we list the complexities of all problems in which bound problems of this type ask about the existence of models of a program P that contain at least k atoms. Large-bound problems in this group are concerned with the existence of models that contain at most jAt(P )j \Gamma k atoms (the number of false atoms in these models is at least k). From the point of view of the fixed- parameter complexity, these problems are not very interesting. Several of them remain NP-complete even when k is fixed. In other words, fixing k does not simplify them enough to make them tractable. For this reason, all the entries in Table 1, listing the complexity as NP-complete (denoted by NP-c in the table), refer to fixed-parameter versions D- (C; of problems D- (C) and (C). The problem M 0 is NP-complete for every fixed k - 1. All other fixed-parameter problems in Table 1 that are marked NP-complete are NP-complete for every value k - 0. On the other hand, many problems D- (C) and D 0 - (C) are "easy". They are fixed-parameter tractable in a strong sense. They can be solved in polynomial time even without fixing k. This is indicated by marking the corresponding entries in Table (for the class P) rather than with FPT. There is only one exception, the problem M 0 (N ), which is W[1]-complete. Small-bound problems for the cases when or "-" can be viewed as problems of deciding the existence of "small" models (that is, models containing exactly k or at most k atoms). The fixed-parameter complexities of these problems are summarized in Table 2. in W[2] Table 2. The complexities of the problem of computing small models (small-bound problems, the cases of The problems involving the class of all purely negative programs and the class of all programs are W[2]-complete. This is a strong indication that they are fixed-parameter intractable. All problems of the form D- (H) are fixed-parameter tractable. In fact, they are solvable in polynomial time even without fixing the parameter k. We indicate this by marking the corresponding entries with P. Similarly, the problem ST = (H) of deciding whether a Horn logic program P has a stable model of size exactly k is in P. However, perhaps somewhat surprisingly, the remaining two problems involving Horn logic programs and are harder. We proved that the problem M= (H) is W[1]-complete and that the problem SP= (H) is W[1]-hard. Thus, they most likely are not fixed-parameter tractable. We also showed that the problem SP= (H) is in the class W[2]. The exact fixed-parameter complexity of SP= (H) remains unresolved. Large-bound problems for the cases when or "-" can be viewed as problems of deciding the existence of "large" models, that is, models with a small number of false atoms - equal to k or less than or equal to k. The fixed-parameter complexities of these problems are summarized in Table 3. Table 3. The complexities of the problems of computing large models (large-bound problems, the cases of The problems specified by concerning the existence of models are in P. Similarly, the problems specified by involving Horn programs are solvable in polynomial time. Lastly, the problem ST 0 = (H) is in as well. These problems are in P even without fixing k and eliminating it from input. All other problems in this group have higher complexity and, in all likelihood, are fixed-parameter intractable. One of the problems, M 0 W[1]-complete. Most of the remaining problems are W[2]-complete. Surprisingly, some problems are even harder. Three problems concerning supported models are W[3]-complete. For two problems involving stable models, ST 0 we could only prove that they are W[3]-hard. For these two problems we did not succeed in establishing any upper bound on their fixed-parameter complexities. The study of fixed-parameter tractability of problems occurring in the area of nonmonotonic reasoning is a relatively new research topic. The only two other papers we are aware of are [Tru01] and [GSS99]. The first of these two papers provided a direct motivation for our work here (we discussed it earlier). In the second one, the authors focused on parameters describing structural properties of programs. They showed that under some choices of the parameters decision problems for nonmonotonic reasoning become fixed-parameter tractable. Our results concerning computing stable and supported models for logic programs are mostly negative. Parameterizing basic decision problems by constraining the size of models of interest does not lead (in most cases) to fixed-parameter tractability. There are, however, several interesting aspects to our work. First, we identified some problems that are W[3]-complete or W[3]-hard. Relatively few problems from these classes were known up to now [DF97]. Second, in the context of the polynomial hierarchy, there is no distinction between the problem of existence of models of specified sizes of clausal propositional theories and similar problems concerning models, supported models and stable models of logic programs. All these problems are NP-complete. However, when we look at the complexity of these problems in a more detailed way, from the perspective of fixed-parameter complexity, the equivalence is lost. Some problems are W[3]-hard, while problems concerning existence of models of 2-normalized formulas are W[2]-complete or easier. Third, our results show that in the context of fixed-parameter tractability, several problems involving models and supported models are hard even for the class of Horn programs. Finally, our work leaves three problems unresolved. While we obtained some bounds for the problems (A), we did not succeed in establishing their precise fixed-parameter complexities. The rest of our paper is organized as follows. In the next section, we review relevant concepts in logic programming. After that, we present several useful fixed-parameter complexity results for problems of the existence of models for propositional theories of certain special types. In the last section we give proofs of some of our complexity results. Preliminaries In the paper, we consider only the propositional case. A logic program clause (or rule) is any expression r of the form where are propositional atoms. We call the atom p the head of r and we denote it by h(r). Further, we call the set of atoms fq the body of r and we denote it by b(r). We distinguish the positive body of r, in symbols), and the negative body of r, fs in symbols). A logic program is a collection of clauses. For a logic program P , by At(P ) we denote the set of atoms that appear in P . If every clause in a logic program P has an empty negative body, we call P a Horn program. If every clause in P has an empty positive body, we call P a purely negative program. A clause r, given by (2), has a propositional interpretation as an implication Given a logic program P , by a propositional interpretation of P we mean the propositional formula We say that a set of atoms M is a model of a clause (2) if M is a (propositional) model of the clause pr(r). As usual, atoms in M are interpreted as true, all other atoms are interpreted as false. A set of atoms M ' At(P ) is a model of a program P if it is a model of the formula pr(P ). We emphasize the requirement In this paper, given a program P , we are interested only in the truth values of atoms that actually occur in P . It is well known that every Horn program P has a least model (with respect to set inclusion). We will denote this model by lm(P ). Let P be a logic program. Following [Cla78], for every atom p 2 At(P ) we define a propositional formula comp(p) by where f:s: If for an atom p 2 At(P ) there are no rules with p in the head, we get an empty disjunction in the definition of comp(p), which we interpret as a contradiction. We define the program completion [Cla78] of P as the propositional theory A set of atoms M ' At(P ) is a supported model of P if it is a model of the completion of P . It is easy to see that if p does not appear as the head of a rule in P , p is false in every supported model of P . It is also easy to see that each supported model of a program P is a model of P (the converse is not true in general). Given a logic program P and a set of atoms M , we define the reduct of P with respect to M (P M , in symbols) to be the logic program obtained from P by 1. removing from P each clause r such that call such clauses blocked by M ), 2. removing all negated atoms from the bodies of all the rules that remain (that is, those rules that are not blocked by M ). The reduct P M is a Horn program. Thus, it has a least model. We say that is a stable model of P if Both the notion of the reduct and that of a stable model were introduced in [GL88]. It is known that every stable model of a program P is a supported model of P . The converse does not hold in general. However, if a program P is purely negative, then stable and supported models of P coincide [Fag94]. In our arguments we use fixed-parameter complexity results on problems to decide the existence of models of prescribed sizes for propositional formulas from some special classes. To describe these problems we introduce additional terminology. First, given a propositional theory \Phi, by At(\Phi) we denote the set of atoms occurring in \Phi. As in the case of logic programming, we consider as models of a propositional theory \Phi only those sets of atoms that are subsets of At(\Phi). Next, we define the following classes of formulas: tN: the class of t-normalized formulas (if are simply CNF formulas) the class of all 2-normalized formulas whose every clause is a disjunction of at most three literals (clearly, 2N 3 is a subclass of the class 2N) tNM: the class of monotone t-normalized formulas, that is, t-normalized formulas in which there are no occurrences of the negation operator tNA: the class of antimonotone t-normalized formulas, that is, t-normalized formulas in which every atom is directly preceded by the negation operator. Finally, we extend the notation M \Delta (C) and M 0 \Delta (C), to the case when C stands for a class of propositional formulas. In this terminology, M 0 (3NM) denotes the problem to decide whether a monotone 3-normalized formula \Phi has a model in which exactly k atoms are false. Similarly, M= (tN) is simply another notation for the problem WS[t] that we discussed above. The following theorem establishes several complexity results that we will use later in the paper. Theorem 1. (i) The problems M= (2N) and M= (2NM) are W[2]-complete. (ii) The problems M= (2N 3 ) and M= (2NA) are W[1]-complete. (iii) The problem M 0 - (3N) is W [3]-complete. Proof: The statements (i) and (ii) are proved in [DF97]. To prove the statement (iii), we use the fact that the problem M- (3N) is W [3]-complete [DF97]. We reduce M- (3N) to M 0 - (3N) and conversely. Let us consider a 3-normalized are literals. We observe that \Phi has a model of cardinality at most k if and only if a related formula obtained from \Phi by replacing every negative literal :x by a new atom - x and every positive literal x by a negated atom :-x, has a model of cardinality at least jAt( - construction defines a reduction of M- (3N) to M 0 - (3N). It is easy to see that this reduction satisfies all the requirements of the definition of fixed-parameter reducibility. A reduction of M 0 - (3N) to M- (3N) can be constructed in a similar way. Since the problem M- (3N) is W[3]-complete, so is the problem M 0 (3N). 2 In the proof of part (iii) of Theorem 1, we observed that the reduction we described there satisfies all the requirements specified in Definition 1 of fixed- parameter reducibility. Throughout the paper we prove our complexity results by constructing reductions from one problem to another. In most cases, we only verify the condition (4) of the definition which, usually, is the only non-trivial part of the proof. Checking that the remaining conditions hold is straightforward and we leave these details out. 3 Some proofs In this section we present some typical proofs of fixed-parameter complexity results for problems involving existence of models, supported models and stable models of logic programs. Our goal is to introduce key proof techniques that we used when proving the results discussed in the introduction. Theorem 2. The problems M 0 are W[2]-complete. Proof: Both problems are clearly in W[2] (models of a logic program P are models of the corresponding 2-normalized formula pr(P )). Since H ' A, to complete the proof it is enough to show that the problem M 0 = (H) is W[2]-hard. To this end, we will reduce the problem M= (2NM) to M 0 (H). Let \Phi be a monotone 2-normalized formula and let k - 0. Let fx be the set of atoms of \Phi. We define a Horn program P \Phi corresponding to \Phi as follows. We choose an atom a not occurring in \Phi and include in P \Phi all rules of the form x i / a, Next, for each clause of \Phi we include in P \Phi the rule We will show that \Phi has a model of size k if and only if P \Phi has a model of size Let M be a model of \Phi of size k. We define M . The set M 0 has us consider any clause r C 2 P \Phi of the form given above. Since M satisfies C, there is is a model of r C . Since a = clauses x i / a. Hence, M 0 is a model of P \Phi . Conversely, let M 0 be a model of P \Phi of size exactly n \Gamma k. If a 2 M 0 then Consequently, we obtain that a = all clauses in \Phi. Indeed, let us assume that there is a clause C such that no atom of C is in M . Then, all atoms of C are in M 0 . contradiction. Now, the assertion follows by Theorem 1. 2 Theorem 3. The problem M= (H) is W[1]-complete. Proof: We will first prove the hardness part. To this end, we will reduce the problem M= (2NA) to the problem M= (H). Let \Phi be an antimonotone 2-normalized formula and let k be a non-negative integer. Let a different atoms not occurring in \Phi. For each clause of \Phi we define a logic program rule r C by We then define P \Phi by Let us assume that M is a model of size k of the program P \Phi . If for some i, consequently, contradiction. Thus, M does not contain any of the atoms a i . Since M satisfies all rules r C and since it consists of atoms of \Phi only, M is a model of \Phi (indeed, the body of each rule r C must be false so, consequently, each clause C must be true). Similarly, one can show that if M is a model of \Phi then it is a model of P \Phi . Thus, W[1]-hardness follows by Theorem 1. To prove that the problem M= (H) is in the class W[1], we will reduce it to the problem M= (2N 3 ). To this end, for every Horn program P we will describe a 2-normalized formula \Phi P , with each clause consisting of no more than three literals, and such that P has a model of size k if and only if \Phi P has a model of k. Moreover, we will show that \Phi P can be constructed in time bounded by a polynomial in the size of P (with the degree not depending on k). First, let us observe that without loss of generality we may restrict our attention to Horn programs whose rules do not contain multiple occurrences of the same atom in the body. Such occurrences can be eliminated in time linear in the size of the program. Next, let us note that under this restriction, a Horn program P has a model of size k if and only if the program P 0 , obtained from P by removing all clauses with bodies consisting of more than k atoms, has a model of size k. The program P 0 can be constructed in time linear in the size of P and k. Thus, we will describe the construction of the formula \Phi P only for Horn programs P in which the body of every rule consists of no more than k atoms. Let P be such a program. We define For every set B 2 B we introduce a new variable u[B]. Further, for every atom x in P we introduce 2 k new atoms x[i], We will now define several families of formulas. First, for every x 2 At(P ) and, for each set B 2 B and for each x 2 B, we define Next, for each set B 2 B and for each x 2 B we define Finally, for each rule r in P we introduce a formula We define \Phi P to be the conjunction of all these formulas (more precisely, of their 2-normalized representations given in the parentheses) and of the formula u[;]. Clearly, \Phi P is a formula from the class 2N 3 . Further, since the body of each rule in P has at most k elements, the set B has no more than jP j2 k elements, each of them of size at most k (jP j denotes the cardinality of P , that is, the number of rules in P ). Thus, \Phi P can be constructed in time bounded by a polynomial in the size of P , whose degree does not depend on k. Let us consider a model M of P such that jM k. We define The set M 0 satisfies all formulas D(x; i), x 2 At(P In addition, the formula u[;] is also satisfied by M 0 Let us consider a formula E(B;x), for some us assume that x - u[B n fxg] is true in M 0 . Then, Moreover, since u[B n It follows that B ' M and, consequently, that u[B] 2 M 0 . Thus, M 0 satisfies all "E-formulas" in \Phi P . Next, let us consider a formula F (B; x), where us assume that M 0 satisfies u[B]. It follows that B ' M . Consequently, x 2 M . Lastly, let us look at a formula G(r), where r 2 P . Let us assume that Since r is a Horn clause and since M is a model of P , it follows that h(r) 2 M . Consequently, h(r) 2 M 0 . Thus, M 0 is a model of G(r). We proved that M 0 is a model of \Phi P . Moreover, it is easy to see that jM Conversely, let us assume that M 0 is a model of \Phi P and that jM 0 k. We set First, we will show that M is a model of P . Let us consider an arbitrary clause r 2 P , say where h and b i , are atoms. Let us assume that fb We need to show that h 2 M . b(r), the set fb and all its subsets belong to B. Thus, \Phi P contains formulas these formulas are satisfied by M 0 . We also have u[;] 2 \Phi P . Consequently, u[;] is satisfied by M 0 , as well. Since all atoms b i , are also satisfied by M 0 (since by M 0 . The formula belongs to \Phi P . Thus, it is satisfied by M 0 . It follows that Thus, M is a model of r and, consequently, of the program P . To complete the proof we have to show that jM is a model of contains all atoms x[i], 1 then So, we will assume that jM j ! k. Let us consider an atom u[B], where B 2 B, such that u[B] 2 M 0 . For every x 2 B, \Phi P contains the rule F (B; x). The set M 0 is a model of F (B; x). Thus, x 2 M 0 and, since x 2 At(P ), we have that x 2 M . It follows that B ' M . It is now easy to see that the number of atoms of the form u[B] that are true in M 0 is smaller than 2 k . Thus, jM again a contradiction. Consequently, jM It follows that the problem M= (H) can be reduced to the problem M= (2N 3 ). Thus, by Theorem 1, the problem M= (H) is in the class W[1]. This completes our argument. 2 Theorem 4. The problem SP= (A) is in W [2]. Proof: We will show a reduction of SP= (A) to M= (2N), which is in W [2] by Theorem 1. Let P be a logic program with atoms x . We can identify supported models of P with models of its completion comp(P ). The completion is of the form comp(P are literals. It can be constructed in linear time in the size of the program P . We will use comp(P ) to define a formula \Phi P . The atoms of \Phi P are x and u[i; j], I The formula \Phi P is a conjunction of the formulas written above (of the formulas given in the parentheses, to be precise). Clearly, \Phi P is a 2-normalized formula. We will show that comp(P ) has a model of size k (or equivalently, that P has a supported model of size if and only if \Phi P has a model of size 2k. be a model of comp(P ). Then, for each there is is a model of Vm ij (this is because M is a model of every formula \Phi i ). We denote one such j (an arbitrary one) by We claim that is a model of \Phi P . Clearly, G i is true in M 0 for every i is satisfied by M 0 . Since for each i, there is at most one j such that u[i; j] 2 M 0 , it follows that every . By the definition of j i , if u[i; M 0 is a model of Vm ij I i is satisfied by M 0 . Finally, all formulas clearly true in M 0 . Thus, M 0 is a model of \Phi P of size 2k. Conversely, let M 0 be a model of \Phi P such that jM us assume that contains exactly s atoms u[i; j]. The clauses H i ensure that for each i, M 0 contains at most one atom u[i; j]. Therefore, the set M 0 "fu[i; j]: is of the form fu[p ps Since the conjunction of G i and G 0 i is equivalent to x i follows that exactly s atoms x i belong to M 0 . Thus, jM It is now easy to see that M 0 is of the form fx We will now prove that for every is true in M 0 . To this end, let us assume that x i is true in M 0 . Then, there is , for some t, k). Since the formula I i is true in M 0 , the formula in M 0 . Thus, the formula is true in M 0 , too. Since for every i, 1 - i - n, the formula J i is true in M 0 , it follows that all formulas \Phi i are true in M 0 . Since the only atoms of M 0 that appear in the are the atoms x is a model of comp(P Thus, the problem SP= (A) can be reduced to the problem M= (2N), which completes the proof. 2 For the problem SP= (A) we also established the hardness result - we proved that it is W[2]-hard (we omit the proof due to space restrictions). Thus, we found the exact location of this problem in the W-hierarchy. For the problem ST 0 that we are about to consider now, we only succeeded in establishing the lower bound on its complexity. We proved it to be W[3]-hard. We did not succeed in obtaining any non-trivial upper estimate on its complexity. Theorem 5. The problem ST 0 Proof: We will reduce the problem M 0 - (3N) to the problem ST 0 (A). Let be a 3-normalized formula, where x[i; j; '] are literals. Let v[2k+1] be new atoms not occurring in \Phi. For each atom x 2 At(\Phi), we introduce new atoms x[s], Let P \Phi be a logic program with the following rules: where ae Clearly, jAt(P \Phi We will show that \Phi has a model of cardinality at least n \Gamma k if and only if P \Phi has a stable model of cardinality at least jAt(P \Phi be a model of \Phi, where x are some atoms from At(\Phi) that are not necessarily distinct. We claim that M is a stable model of P \Phi . Let us notice that a rule A(x; y; s) is not blocked by M 0 if and only if Hence, the program P M 0 \Phi consists of the rules: and of some of the rules with heads u[i]. Let us suppose that every rule of P \Phi with head u[i] contains either a negated atom x 2 M or a non-negated atom . Then, for every either x[i; j; Thus, M is not a model of the formula consequently, M is not a model of \Phi, a contradiction. Hence, for every there is a rule with head u[i] containing neither a negated atom x 2 M nor a non-negated atom x 62 M . These rules also contribute to the reduct P M 0 \Phi . All atoms x[s] are facts in P M 0 \Phi . Thus, they belong to lm(P M 0 Conversely, if x[s] 2 lm(P M 0 Moreover, it is evident by rules B(x) that x 2 lm(P M 0 only if x 6= Hence, by the observations in the previous paragraph, u[i] 2 \Phi ), for each Finally, v[q] 2 lm(P M 0 because the rules D(q) belong to the reduct P M 0 \Phi . Hence, M is a stable model of P \Phi and its cardinality is at least n(k Conversely, let M 0 be a stable model of P \Phi of size at least jAt(P \Phi )j \Gamma 2k. all atoms v[q], must be members of M 0 and, conse- quently, m. Hence, for each there is a rule in P \Phi such that x 0 [i; Thus, M 0 is a model of the formula Therefore is a model of \Phi. It is a routine task to check that rules A(x; imply that all stable models of P \Phi are of the form are not necessarily distinct). Hence, jM We have reduced the problem M 0 - (3N) to the problem ST 0 (A). Thus, the assertion follows by Theorem 1. 2 --R Negation as failure. Parameterized Complexity. Consistency of Clark's completion and existence of stable models. The stable semantics for logic programs. Fixed parameter complexity in AI and nonmonotonic reasoning. Computing large and small stable models. --TR Foundations of logic programming Logic programming Autoepistemic logic Contributions to the Theory of Logic Programming Fixed-Parameter Complexity in AI and Nonmonotonic Reasoning --CTR Zbigniew Lonc , Mirosaw Truszczyski, Computing stable models: worst-case performance estimates, Theory and Practice of Logic Programming, v.4 n.2, p.193-231, January 2004
stable models;normal logic programs;fixed-parameter complexity;supported models
601780
A complete characterization of complete intersection-type preorders.
We characterize those type preorders which yield complete intersection-type assignment systems for -calculi, with respect to the three canonical set-theoretical semantics for intersection-types: the inference semantics, the simple semantics, and the F-semantics. These semantics arise by taking as interpretation of types subsets of applicative structures, as interpretation of the preorder relation, &leq;, set-theoretic inclusion, as interpretation of the intersection constructor, , set-theoretic intersection, and by taking the interpretation of the arrow constructor, &rightarrow; la Scott, with respect to either any possible functionality set, or the largest one, or the least one.These results strengthen and generalize significantly all earlier results in the literature, to our knowledge, in at least three respects. First of all the inference semantics had not been considered before. Second, the characterizations are all given just in terms of simple closure conditions on the preorder relation, &leq;, on the types, rather than on the typing judgments themselves. The task of checking the condition is made therefore considerably more tractable. Last, we do not restrict attention just to -models, but to arbitrary applicative structures which admit an interpretation function. Thus we allow also for the treatment of models of restricted -calculi. Nevertheless the characterizations we give can be tailored just to the case of -models.
INTRODUCTION Intersection-types disciplines originated in [Coppo and Dezani-Ciancaglini 1980] to overcome the limitations of Curry's type assignment system and to provide a char- Author addresses: M. Dezani-Ciancaglini, Dipartimento di Informatica, Universita di Torino, Italy [email protected]. F. Honsell and F.Alessi, Dipartimento di Matematica ed Informatica, Universita di Udine, Via delle Scienze 208, 33100 Udine, Italy honsell, [email protected] Partially supported by MURST Con '99 TOSCA Project, FGV '99 and CNR-GNSAGA. Permission to make digital/hard copy of all or part of this material without fee for personal or classroom use provided that the copies are not made or distributed for prot or commercial advantage, the ACM copyright/server notice, the title of the publication, and its date appear, and notice is given that copying is by permission of the ACM, Inc. To copy otherwise, to republish, to post on servers, or to redistribute to lists requires prior specic permission and/or a fee. c ACM Transactions on Computational Logic, Vol. TBD, No. TBD, TBD TBD, Pages 1{27. M. Dezani et al. acterization of strongly normalizing terms of the -calculus [Pottinger 1980]. But very early on, the issue of completeness became crucial. Intersection-type preorders and lter -models have been introduced, in [Barendregt et al. 1983], precisely to achieve the completeness for the type assignment system ' , with respect to Scott's simple semantics. And this result, together with the conservativity of ' with respect to Curry's simple types, was used in [Barendregt et al. 1983] to prove Scott's conjecture concerning the completeness of the set-theoretic semantics for simple types. The number of type preorders of interest in the literature has grown considerably over the years (e.g. [Coppo et al. 1984; Coppo et al. 1987; Honsell and Ronchi della Rocca 1992; Egidi et al. 1992; Abramsky and Ong 1993; Plotkin 1993; Honsell and Lenisa 1999], etc.), especially in connection with the study of domain models for -calculi in the perspective of Abramsky's \domain theory in logical form" 1991]. Furthermore new semantics have been proposed for intersection- types [Hindley 1983a]. The problem of characterizing syntactically the sound and adequate (complete) type preorders, with respect to the various set-theoretic semantics, appears therefore rather natural. Moreover, we feel that the very existence of completeness results with respect to set-theoretic semantics, such as the one in [Barendregt et al. 1983], is probably one of the most signicant features of intersection-types. In this paper we solve completely the characterization problem as far as the three canonical set-theoretical semantics for intersection-types: the inference semantics, the simple semantics [Scott 1975] and the F-semantics [Scott 1980b]. These are the semantics which arise by interpreting types as subsets of applicative structures, and by taking as interpretation of the preorder relation, , set-theoretic inclusion, as interpretation of the intersection constructor, \, set-theoretic intersection, and by taking the interpretation of the arrow constructor, ! a la Scott, as a logical predicate, with respect to either any possible functionality set, or the largest one, or the least one. More precisely, the simple semantics of types associates to each arrow type A ! B the set of elements which applied to an arbitrary element in the interpretation of A return an element in the interpretation of B. As Scott has pointed out in [Scott 1980b], however, the key to a lambda model is the set of elements in the domain which are canonical representatives of functions, i.e. the elements which are meanings of terms starting with an initial abstraction. The F-semantics of types takes therefore as meaning of an arrow type only those elements which behave as expected with respect to application and which are also canonical representatives of functions. The inference semantics is the counterpart of the inference semantics for polymorphic types introduced in [Mitchell 1988], generalized to suitable applicative structures with an interpretation function, called -applicative structures. Here the interpretation of arrows is taken with respect to an arbitrary set which includes the canonical representatives of functions. The results in this paper strengthen and generalize signicantly all earlier results in the literature, to our knowledge, in at least four respects. First of all we consider a general denition of type preorders which allow to represent not only all inverse limit models [Coppo et al. 1984], but also all graph models [Berline 2000]. Secondly the A Complete Characterization of Complete Intersection-Type Preorders 3 inference semantics had not been considered before. Thirdly the characterizations are all given just in terms of simple closure conditions on the preorder relation , , on the types, rather than on the typing judgments themselves, as had been done earlier [Dezani-Ciancaglini and Margaria 1986]. The task of checking the condition is made therefore considerably more tractable. Lastly we do not restrict attention just to -models, but to the more general class of -applicative structures. Thus we allow also for the treatment of models of restricted -calculi, and most notably models of Plotkin's call-by-value v -calculus [Plotkin 1975], and models of the -I- N-calculus of [Honsell and Lenisa 1999]. Nevertheless the characterizations we give can be tailored just to the case of -models. The paper is organized as follows. In Section 2 we introduce type preorders, various kinds of type assignment systems, and we prove Generation Lemmata for these systems. In Section 3 we introduce the basic semantical structures, with respect to which we shall discuss soundness and completeness of type preorders. In Section 4 we study lter structures and prove the crucial property satised by the interpretation function over them. Section 5 is the main section of the paper. After introducing the notions of type interpretation domain and semantic satisability for the three semantics under consideration, we give the characterization results. Finally in Section 6 we discuss related results and give some nal remarks. 2. INTERSECTION-TYPE PREORDERS AND TYPE ASSIGNMENT SYSTEMS Intersection-types are syntactical objects which are built inductively by closing a given set C of type atoms (constants) under the function type constructor ! and the intersection type constructor \. Denition 2.1 Intersection-type Languages. An intersection-type language, over C, denoted by dened by the following abstract syntax: Notice that in the denition above the cardinality of C is the only varying parameter Notation 2.2. Upper case Roman letters arbitrary types. In writing intersection-types we shall use the following convention: the constructor \ takes precedence over the constructor ! and it associates to the right. Moreover be short for A ! ! A | {z } Much of the expressive power of intersection-type disciplines comes from the fact that types can be endowed with a preorder relation, , which induces the structure of a meet semi-lattice with respect to \. This appears natural especially in the semantical setting of the present paper, where the intended meaning of types are sets of denotations, \ is interpreted as set-theoretic intersection, and is interpreted as set inclusion. Moreover sometimes we want the maximal element of all types or the maximal element of all arrow types to be atoms: we call these atoms respectively and . The corresponding axioms are ( and (). is particularly meaningful when used in combination with the e ype assignment system, which essentially treats as the universal type of all -terms 4 M. Dezani et al. (see Denition 2.9). Axiom () states that includes any arrow type. This axiom agrees with the -type assignment system, which treats as the universal type of all -abstractions (see Denition 2.10). Denition 2.3 Intersection-type Preorders. An (intersection)-type preorder (C; ) is a binary relation on the intersection-type language T(C) satisfying the following set of axioms and rules: A A (re if A C Notation 2.4. We will write A B for A B and B A. Notice that associativity and commutativity of \ (modulo ) follow easily from the above axioms and rules. Notation 2.5. Being \ commutative and associative, we will write in A i for An . Similarly we will write \ i2I A i where we convene that I denotes always a nite non-empty set. All the type preorders considered so far in the literature are dened for languages over nite or countable sets of atoms and they are generated by recursive sets 5 of atoms and rules of the shape A B. \Generation" is in the sense that A B is true if and only if it can be derived from the axioms and rules of 5 together with those in Denition 2.3. Such preorders will be denoted by (C 5 ; 5 ). Note that there are only countably many possible 5; hence, there are uncountably many preorders which cannot be represented this way. Note also that the correspondence 5 7!5 is not lazy) Fig. 1. Some special purpose axioms and rules concerning . Figure 1 gives examples of some special purpose axioms and rules, and Figure 2 presents the most traditional sets 5. The names 5 are the initials of the authors who have rst considered the -model induced by the preorder (C 5 ; 5 ). The A Complete Characterization of Complete Intersection-Type Preorders 5 f lazy)g f Fig. 2. Examples of nitely generated preorders: atoms, axioms and rules. order is logical, rather than historical: Ba [van Bakel 1992], EHR [Egidi et al. 1992], AO [Abramsky and Ong 1993], BCD [Barendregt et al. 1983]. The symbol C1 denotes an innite set of fresh atoms, i.e. dierent from . The meaning of the axioms and rules of Figure 1 can be grasped easily if we consider the intended set-theoretic semantics, whereby types denote subsets of a domain of discourse, and we interpret A ! B as the set of functions which map each element of A into an element of B. For instance, in combination with the fact that all the objects in our domain of discourse are total functions, i.e. that is equal to [Barendregt et al. 1983]. However, if we want to capture only those terms which truly represent as it is necessary, for instance, in discussing the lazy -calculus [Abramsky and Ong 1993], we cannot assume ) in order to ensure that all functions are total. To this end we can postulate instead the weaker property( lazy). According to the set theoretic semantics, this axiom states, in eect, simply that an element which is a function, (since it maps A into B) maps also the whole universe into itself. Notice that, when the type denoting the whole universe, is in C, the role of could be played also by the type provided that lazy) is in 5. For this reason it is of no use to have at the same time in the language both and Hence we impose that the two constants do not occur together in any C. The set-theoretic meaning of Axiom (!-\) is immediate: if a function maps A into B, and also A into C, then, actually, it maps the whole A into the intersection of B and C (i.e. into B \ C), see [Barendregt et al. 1983]. Rule () is also very natural set-theoretically: it asserts the arrow constructor is contravariant in the rst argument and covariant in the second one. Namely, if a function maps A into B, and we take a subset A 0 of A and a superset B 0 of B, then this function will map also A 0 into B 0 , see [Barendregt et al. 1983]. Now that we have introduced type preorders we have to explain how to capitalize eectively on their expressive power. This is achieved via the crucial notion of intersection type assignment system. This is a natural extension of Curry's type assignment type to intersection types. First we need some preliminary denitions and notations. Notation 2.6. will be short for (C; ) and 5 for (C 5 ; 5 ). Denition 2.7. (1) A basis over C is a set of statements of the shape x:B, where whose variables are distinct. (2) An intersection-type assignment system relative to denoted by \ , 6 M. Dezani et al. is a formal system for deriving judgments of the form ' M : A, where the subject M is an untyped -term, the predicate A is in T(C), and is a basis over C. (3) We will write x 2 as short for 9A: occurs as the subject of an assertion in . We say that a term M is typable in \ , for a given basis , if there is a type A 2 T(C) such that the judgment ' M : A is derivable. We dene three kinds of type assignment systems, which correspond to the presence or the absence of the atoms . The rst ones, the Basic Type Assignment Systems, deal with sets of atoms not including . Denition 2.8 Basic Type Assignment Systems. preorder with C. The basic type assignment system for , denoted by \ B , is a formal system for deriving judgments of the shape A. Its rules are the following: (! E) If 2 C, in line with the intended set-theoretic interpretation of as the universe, we extend the Basic Type Assignment System with a suitable axiom for Denition-type Assignment Systems. preorder with C. The axioms and rules of the -type assignment system (denoted \ deriving judgments of the shape ' are those of the Basic type Assignment System, together with the further axiom (Ax- M: :Similarly, if 2 C, in line with the intended interpretation of as the universe of abstractions, we dene: Denition 2.10 -type Assignment Systems. preorder with 2 C. The axioms and rules of the -type assignment system (denoted \ ), for deriving judgments of the shape ' are those of the Basic Type Assignment System, together with the further axiom A Complete Characterization of Complete Intersection-Type Preorders 7 Notation 2.11. In the following \ will range over \ and \ . More precisely we assume that \ stands for \ whenever whenever otherwise. Similarly for ' . We refer to [Barendregt and al. 200X] for a detailed account on the interest and dierences of the three kinds of intersection-type assignment systems introduced above. Here we just recall a few suggestive facts. Thanks to the intersection- type constructor, general self-application can be typed in the systems \ this was not the case in Curry's type assignment. In fact it is easy to prove that whilst x:xx cannot receive any type in the Curry system. Actually, all strongly normalizing terms are typeable in \ B for all . All solvable terms can be typed in \ for all with some type not equivalent to For instance, using 2 the term (yx:x)(), where x:xx, can be A. The systems \ are appropriate for dealing with Plotkin's call- by-value v -calculus [Plotkin 1975]. Also these systems allow to type non-strongly normalizing terms. For instance, one can prove that the term (yx:x)(z:) may receive type A ! A for all A. Anyway, notice that, as proved in [Egidi et al. 1992], (yx:x)() cannot be typed in \ EHR . Notice that the structural rules of (weakening) and (strengthening) are admissible in all \ s: (weakening) Notice also that the intersection elimination rules can be proved immediately to be derivable in all \ s. Moreover, by a straightforward induction on the structure of derivations, one can prove that the rule is admissible in all \ s. We conclude this section by proving a crucial technical result concerning type preorders, which will be useful in Section 5. It is a form of generation (or which provides conditions for \reversing" some of the rules of the type assignment systems \ . Notation 2.12. When we write \.assume 33 we mean that this condition is always true when we deal with ' , while it must be checked for ' . Similarly, the condition 6A must be checked just for ' . Moreover we write \the type preorder validates 5" to mean that Theorem 2.13 Generation Lemma. Let preorder. . Then the following conditions are equivalent: 8 M. Dezani et al. (a) ' x : A . Then the following conditions are equivalent: (a) ' MN : A i2I C i A for some I and (3 and let validate Ba. Then the following conditions are equivalent (a) ' MN : A (4 ) Assume 6A. Then the following conditions are equivalent: (a) ' x:M : A Proof. The proof of each (b) ) (a) is easy. So we only treat (a) ) (b). (1) Easy by induction on derivations, since only the axioms (Ax),(Ax- 8 and the rules (\I), () can be applied. Notice that the condition implies that cannot be obtained just using axioms (Ax- (2) By induction on derivations. The only interesting case is when A A 1 \ A 2 and the last rule applied is (\I): The condition implies that we cannot have A 1 A 2 We do the proof for 6 and A 2 6 the other cases can be treated similarly. By induction there are and moreover . So we are done since ( be as in (2). Applying rule (\I) to ' derive since by rule () and axiom (!-\). We can choose since A we can choose B C Otherwise and 6A. The proof is by induction on derivations. Notice that ' x:M : A cannot be obtained just using axioms (Ax- or (Ax-). The only interesting case is again when A A 1 \ A 2 and the last rule applied is (\I): As in the proof of (2) we only consider the case A 1 6 and 6A 2 . A Complete Characterization of Complete Intersection-Type Preorders 9 By induction there are I So we are done since ( Special cases of this theorem have already appeared in the literature, see [Baren- dregt et al. 1983; Coppo et al. 1984; Coppo et al. 1987; Honsell and Ronchi della Rocca 1992; Egidi et al. 1992]. 3. APPLICATIVE STRUCTURES SUITABLE FOR LAMBDA CALCULUS In this section we introduce the semantical structures which we will consider in our investigation of soundness and completeness of intersection-type assignment systems. Denition 3.1 -applicative structure. A -applicative structure is a triple is an applicative structure; (2) D], is a mapping (interpretation function for -terms) which satises the following properties (a) (b) if y 62 FV(M ); (c) (8d 2 D: [[M . If we compare our denition of -applicative structures with that of -models (rst given in [Hindley and Longo 1980], see also Denition 5.3.1 of [Barendregt 1984] and Denition 11.3 of [Hindley and Seldin 1986]) three conditions are missed: (1) [x:=d] . The absence of conditions (1) and (2) allows us to dene the interpretation function on lter structures in such a way it coincides with the set of derivable types (see proposition 4.5 and Theorem 4.6). We omit conditions (3) for considering also models of restricted -calculus (Denition 3.2). One can easily see that Plotkin's -structures, as dened in [Plotkin 1993], are - applicative structures. In the next section we will introduce lter structures, which are again -applicative structures. Models of, possibly restricted, -calculi, as we commonly know them, can be viewed as special -applicative structures. First we need to give the denition of restricted -calculus. Denition 3.2 Restricted -calculus. Let The restricted -calculus R is the calculus obtained from the standard -calculus, by restricting the rule to the redexes in R. M. Dezani et al. is the standard -calculus. The main examples of truly restricted -calculi are Plotkin's call-by-value v -calculus [Plotkin 1975] and the -I-N-calculus of [Honsell and Lenisa 1999]. Finally we give the crucial denition Denition 3.3 (Restricted) -model. A (restricted) -model for the (restricted) -calculus R , is a -applicative structure, hD; ; which moreover satises for h(x:M)N; M [x := N ]i 2 R: It is easy to see that all notions of models for, possibly restricted, -calculi, based on applicative structures, can be cast in the above setting. 4. FILTER STRUCTURES AND INTERPRETATION OF LAMBDA TERMS In this section we introduce lter structures. These are the basic tool for building -applicative structures, in eect -models, which realize completeness for type preorders. Filter structures arise naturally in the context of those generalizations of Stone duality that are used in discussing domain theory in logical form (see [Abramsky 1991], [Coppo et al. 1984], [Vickers 1989]). This approach provides a conceptually independent semantics to intersection- types, the lattice semantics. Types are viewed as compact elements of domains. The type denotes the least element, intersections denote joins of compact ele- ments, and arrow types allow to internalize the space of continuous endomorphisms. Following the paradigm of Stone duality, type preorders give rise to lter structures , where the interpretation of -terms can be given through a nitary logical description We start by introducing the notion of lter of types. Then we show how to associate to each type preorder its lter structure. This is a -applicative structure where the interpretation of a -term is given by the lter of the types which can be assigned to it. Denition 4.1. Let preorder. (1) A -lter (or simply lter) is a set X T(C) such that (a) if then (b) if A B and A 2 X , then (c) if denotes the set of -lters; denotes the lter generated by X ; (4) a lter is principal if it is of the shape " fAg, for some type A. We shall denote " fAg simply by " A. Notice that " ; is the lter " if It is not di-cult to prove that F , ordered by subset inclusion, is a complete lattice, whose bottom element is " ; and whose top element is T(C). Moreover if . The sup of a directed set of lters is the set-theoretic union of lters. The nite 1 elements are exactly the lters 1 An element X is nite i for any directed subset Y, X v F Y implies that there exists Y 2 Y such that X v Y . A Complete Characterization of Complete Intersection-Type Preorders 11 generated by nite sets of types. Actually F is !-algebraic, i.e. its set of nite elements is denumerable, and moreover for each lter X , the set K(X) of nite elements below X is directed, with sup X itself: The next step is to dene application over sets of lters. Denition 4.2 Filter structure. Let preorder. (1) Application : F F ! F is dened as (2) The maps F are dened by 2 G The triple hF ; F ; G i is called the lter structure over . Notice that if fA is non-empty and 2 C then it follows The denition of G , above, appears natural once we recall that axiom (Ax-) entails that is the universal type of functions. Arrow types correspond to step functions, and they allow to describe the functional behaviour of lters, in the following sense: proposition 4.3. Let preorder. For all X 2 F we get G is the step function X: if A 2 X then " Proof. We show G Let D6 otherwise the thesis is trivial. by denition of application and of lter by denition of step function since " C )" D is compact and the right-hand side is directed The next proposition provides a useful tool for relating arrow types to application. 2 is an informal -notation used to dene functions, see [Barendregt 1984] page xiii and [Hindley and Seldin 1986] page 130. 12 M. Dezani et al. proposition 4.4. Let preorder which validates Ba, and let if Proof. ()) If then Otherwise, by denition of application (Denition 4.2(1)), Then there is I and C i ; D i such that A T by denition of lter (Denition 4.1). So we get A rule (). Trivial. Filter structures induce immediately -applicative structures. proposition 4.5. Let hF ; F ; G i be a lter structure. Let range over the set of term environments the interpretation function: |if there exists x 2 Var such that |otherwise put inductively: The triple hF is a -applicative structure. The interpretation function of a term coincides with the set of types which are derivable for it. This will be a crucial property in showing completeness using lter structures. Theorem 4.6. Let preorder and T(C). For any -term M and environment where only if for all x 2 Var, (x) 6= ;, and moreover implies Proof. The thesis is trivial if some x. In such a case since for no it holds Otherwise we prove the thesis by induction on M . Dene if else ;; A Complete Characterization of Complete Intersection-Type Preorders 13 If M x, then Ag by Theorem 2.13(1) If M NL, then by denition of application A by induction, (weakening) and ( L) by Theorem 2.13(2) and 3 rule (): If M x:N , then by denition of G by induction, (weakening) and ( L) by Theorem 2.13(4), axiom (Ax-), and rule (): 5. SET-THEORETIC SEMANTICS OF INTERSECTION-TYPES This is the main section of the paper. Here, we discuss completeness for the three set-theoretic semantics of intersection-types mentioned in the introduction. In par- ticular, we characterize those type preorders which induce complete type assignment systems for the inference, the simple and the F-semantics, over -applicative struc- tures. As we will see these conditions apply also to the preorders which induce complete systems with respect to the three semantics, over -models. We recall that according to these semantics the meaning of types are subsets of the universe of discourse, i.e. the applicative structure. The \intersection" type constructor is always interpreted as the set-theoretic intersection. While, the \arrow" is interpreted as the set of those points, which belong to a suitable distinguished set, and whose applicative behavior is that of mapping the antecedent of the arrow into the consequent. As we remarked earlier, the very existence of complete type assignment systems for such semantics over applicative structures is one of the strongest motivations for the whole enterprise of developing a theory of intersection-types. In discussing completeness, soundness is not really an issue, since all type preorders are sound. To achieve adequacy and hence completeness we have to restrict 14 M. Dezani et al. to two disjoint classes of type preorders, namely the natural preorders and the strict preorders. Filter structures are essential to showing adequacy. In such structures, in fact, the set-theoretic interpretation of a type, as an appropriate subset, is in one-to-one correspondence with the principal lter generated by that type. Denition 5.1. if 2 C and it validates AO as dened in Figure 2. if 2 C and it validates Ba as dened in Figure 2. Notice that a strict type preorder containing the constant validates EHR. All the preorders appearing in Figure 2 are natural, if they contain and strict otherwise. Type interpretations can be given on -applicative structures once we have xed a distinguished set of functional objects, . There are various choices for this set. Amongst these there is a maximal one and a minimal one. The former determines the simple semantics, the latter the F-semantics. Denition 5.2 Type Interpretation Domain. interpretation domain is a quadruple I | is a -applicative structure; | is a subset of D, called the functionality set, such that [[x:M all x; M; . is a simple interpretation domain is an F-interpretation domain g. Denition 5.3 Type Interpretation. Let I domain. The type interpretation induced by the type environment (1) I This denition is the counterpart for intersection-types of the inference semantics for polymorphic types of [Mitchell 1988], generalized by allowing hD; ; to be just a -applicative structure instead of a -model. Once we x an applicative structure hD; i, and an interpretation function the above denition depends on the choice of the functionality set and the type environment V . The interpretation of the constants f takes into account the corresponding axioms of the type assignment systems. As we remarked above (see page 9), in the denition of -applicative structure, we do not postulate, in general, that Nevertheless the class of environments which have this property will be of particular signicance (provided that A Complete Characterization of Complete Intersection-Type Preorders 15 they do not induce trivial interpretations, i.e. interpretations in which all terms are equated). Hence we put Denition 5.4 Good environments. Let hD; ; be a -applicative structure. The term environment : Var ! D is good if for all x 2 Var, we have and moreover there exist two terms M;N such that [[M In discussing sound type assignment systems we consider only type interpretation domains and type environments which are good (the notion of goodness will depend on the current type preorder and on which kind of semantics we are considering) and which agree with the inclusion relation between types in the following sense: Denition 5.5. Let preorder. A type interpretation domain (1) are -good if for all (a) for all good environments and d 2 (b) for all good environments , terms M and variables x, (2) are F -good if they are -good and moreover for all good environments , variables x, and A 2 T(C) (3) agree with i for all Condition (2) of Denition 5.5 is true in particular when I is an F-interpretation domain such that for all good we get that (x) 2 implies Remark that the conditions (1) and (2) of Denition 5.5 are true for all known models of (restricted) -calculus ([Hindley and Longo 1980], [Plotkin 1975], [Egidi et al. 1992], [Honsell and Lenisa 1999]). One can easily see that the following holds: proposition 5.6. domains and all type environments agree with AO and with EHR. simple interpretation domains and all type environments agree with BCD. We now introduce formally the three semantics. The denitions follow in a natural way from how we have argued informally so far, but for the restriction (in the denition of those type interpretation domains and type environments which are -good (F-good in the case of F-semantics) and which agree with . Denition 5.7. Let I Denition 5.8 Semantic Satisability. M. Dezani et al. interpretation domains I and type environments V which moreover agree with , and for all good term environments ; (2) A for all -good simple interpretations domains I and type environments V which moreover agree with , and for all good term environments ; interpretations domains I and type environments V which moreover agree with , and for all good term environments . For example 6j= and 6j= In view of the above denition, we can say that the inference semantics is given by i , the simple semantics by s , and the F-semantics by F . The following proposition is immediate: proposition 5.9. If then we have both F A. Notation 5.10. We shall denote with any of the three s , and F . Derivability in the type system implies semantic satisability, as shown in the next theorem. Its proof by induction on derivations is straightforward. Theorem 5.11 Soundness. ' M : A implies A. Proof. By induction on the derivation of ' M : A using the denition of type interpretation (Denition 5.3). Rule (! E) is sound by denition of -applicative structure (Denition 3.1). The soundness of rule (! I) follows from the restriction to -good type interpretation domains and type environments (Denition 5.5(1)) and from the denition of functionality set (Denition 5.2(1)). Rule () is sound since we consider only type interpretation domains and type environments which agree with (Denition 5.5(3)). The soundness of the other rules is immediate. As regards to adequacy, rst we observe that only natural or strict type preorders can be adequate. In particular the model P! [Scott 1976], Engeler models [Engeler 1981] and those graph models which do not satisfy rule () (see [Berline 2000] for a description of these models as webbed models and [Barendregt and al. 200X] for their presentation via type preorders), cannot be adequate. Remark 5.12. Following a referee's suggestion, we conjecture that all graph models would be complete when using more general notions of type interpretation domain and of type interpretation. More precisely the following extensions are worthy |dening the fourth components of type interpretation domains as functions from arrow types to subsets of D such that [[x:M |replacing condition (4) of Denition 5.3 with A Complete Characterization of Complete Intersection-Type Preorders 17 proposition 5.13. (Adequacy implies naturality or strictness) If implies then is a natural or a strict type preorder. Proof. It is easy to verify that the hypothesis forces a type preorder to validate rule () and axiom (!-\), and also lazy) when when 2 C. For instance, as regards to axiom (!-\), consider the basis C)g. From Denition 5.3 we get Hence, by hypothesis, we have ' B\C. From Theorem 2.13(1) it must hold must hold. Now we shall discuss adequacy for each of the three semantics separately. First we consider the inference semantics. Our goal is to show that all natural and all strict type preorders are adequate for the inference semantics. For this proof, we focus on the applicative structure induced by the lter structure and we put: Denition 5.14. Let be a natural or strict type preorder. Let: (1) be the functionality set dened by =< if F otherwise. (2) I be the type interpretation domain hF be the type environment dened by be the mapping Because of (4) of previous denition, the symbol is overloaded, since it refers both to the term interpretation in a lter structure (see proposition 4.5) and to the type interpretation induced by a type preorder . Anyway no confusion may arise, since the arguments select the interpretation. Notice that | when 2 C we get and | when 2 C we get The mapping has the property of associating to each type A the set of lters which contain A (thus preserving the property through which in the basic case of type constants). Lemma 5.15. Let be a natural or strict type preorder then Proof. By induction on A. The only interesting case is when A is an arrow type. Remark that if X 2 F but 2 then all types in X are intersections of constant types. In fact if X contains an arrow type, then it contains also M. Dezani et al. when lazy)), or when 2 C (by rule ()), so X belongs to . If A by denition by induction proposition 4.4 and the denition of above. Lemma 5.16. Let be a natural or strict type preorder. Then I , V are -good and they agree with . Proof. I , V satisfy condition (1a) of Denition 5.5 since For condition (1b) of Denition 5.5 let X 2 be such that [[M Then, by Lemma 5.15, B 2 [[M [x:=X] . Notice that: proposition 4.3 by denition of G by denition of step function. We are done since F (G Lastly notice that as an immediate consequence of the Lemma 5.15 we get and therefore I ; V agree with . Finally we can prove the desired adequacy result. Theorem 5.17. (Naturality or strictness imply adequacy) Let natural or a strict type preorder. Then A. Proof. We consider the type interpretation domain I . Let be the term environment dened by Ag. It is easy to verify that I and that for all 0 A. Hence we have: by Lemma 5.15 A by Theorem 4.6 and the above property. Hence, by proposition 5.13 and Theorem 5.17, all and only the natural or strict type preorders turn out to be complete with respect the inference semantics. There are of course many preorders of interest which do not belong to these classes. For instance the type preorder which induces the lter structure isomorphic to Scott's P! [Scott 1976] is such a preorder. The reader can see [Barendregt and al. 200X] for more examples. Notice that the preorders AO , BCD induce lter structures which are -models [Barendregt et al. 1983], the preorder EHR induces a model for the v -calculus A Complete Characterization of Complete Intersection-Type Preorders 19 [Egidi et al. 1992], and the preorder Ba induces a model for the -I-N-calculus [Honsell and Lenisa 1999]. Hence we have that natural preorders, which induce -models, are complete also for the class of -models, and strict preorders, which induce models of the other two restricted -calculi, are complete for the corresponding classes of models. Now we characterize those preorders which are complete with respect to the simple semantics. Theorem 5.18. (Adequacy for the simple semantics) Let preorder. is a natural type preorder which validates -) or a strict type preorder such that Proof. ()) From proposition 5.13 it follows that is natural or strict. It is easy to check that if 6 then simple adequacy fails for \ . We have since D. By Theorem 2.13(1) we can deduce ' x only if Let 2 C. We have, for any type interpretation domain I type environment: Hence never holds ' Theorem 2.13(1), hence simple adequacy fails if 2 C. This proves ()). To prove that under the given conditions we use the simple type interpretation domain hF which is just I as dened in Denition 5.14, with being either or By Lemma 5.15 it follows Xg. So we have that implies A 2 [[M and we conclude ' M : A as in the last step of the proof of Theorem 5.17. Among the type preorders of Figure 2, those adequate for the simple semantics are Ba and BCD . Other adequate type preorders in the literature are those of [Honsell and Lenisa 1999; Scott 1972; Park 1976; Coppo et al. 1987; Honsell and Ronchi della Rocca 1992]. Non adequate type preorders are all those inducing computationally adequate models for the lazy -calculus, e.g. AO , or for the call-by-value -calculus, e.g. EHR . The same argument used for the inference semantics allows to show that the natural preorders mentioned in Theorem 5.18, which induce -models, are precisely those which are complete also for the class of -models, and the strict preorders, which induce v -models and -I-N-models, are complete for the corresponding classes of models. The completeness for the simple semantics of \ whenever validates BCD and hF was proved in [Coppo et al. 1984] using lter models and in [Coppo et al. 1987] using the term model of -equality. Finally we turn to the F-semantics. The following denition singles out the type preorders which are adequate for the F-semantics as proved in Theorem 5.28. Denition 5.19. A type preorder is an F-preorder i (1) either is a natural or a strict type preorder such that 2 C and for all 2 C, there are I ; A M. Dezani et al. (2) or is a strict type preorder such that 2 C and for all 2 C either or there are I ; A For example Ba , EHR , and AO are F-preorders. Notice that a natural type preorder which validates ) is an F-preorder i for all 2 C we get Next lemma shows that all types of an F-preorder satisfy the conditions of previous denition. Lemma 5.20. Let either C or C \ Proof. We just prove the more di-cult case, namely (2). We reason by induction on the structure of C. If C 2 C the thesis is trivial. If C D ! E, then C , hence C\D ! E. If C D\E and C then the thesis is immediate. Otherwise we cannot have both D and E. Let us suppose 6 D. Then, by induction, it follows D \ I and A Now, if E, we get C \ D \ and we are done by above. If 6 E, then, by induction, it follows E \ Therefore C \ ( T(C), we easily get: Corollary 5.21. Let To discuss F-semantics it is useful to characterize the subset of types which are functional. Denition 5.22. We dene the predicate fun on T(C) by induction on the structure of types: The following proposition gives an alternative characterization of functional types for F-preorders. proposition 5.23. If is an F-preorder then or A Proof. (() is trivial. We reason by induction on the structure of A. If A 2 C, or A or A, the thesis follows by denition of fun(A). Otherwise we have A B \ C A Complete Characterization of Complete Intersection-Type Preorders 21 and either fun(B) or fun(C). We assume fun(B), the case fun(C) being similar. By induction either B or B I and A In the rst case - either C and AC \ , - or AC \ In the second case it follows AC \ T choosing an arbitrary i 2 I we get for some J and A 0 by Corollary 5.21. So we conclude To prove adequacy we will again use the lter structure hF ; F ; G i for dening, as in the previous cases, the type interpretation domain hF F i. The de- nition below diers from Denition 5.14 in that we choose a dierent functionality set. Denition 5.24. Let be an F-preorder. Let: (1) F be the functionality set dened by for some x; M; (2) I F be the type interpretation domain hF F be the type environment dened by be the mapping F F When restricting to F-preorders, all lters which contain a functional type belong to the functionality set. Lemma 5.25. Let be an F-preorder and X 2 F . Then A 2 X and imply F . Proof. We show that under the given conditions Proof of X . Take an arbitrary B 2 X . Notice that if 2 C then implies A by proposition 5.23. Moreover fun(A) implies by Denition 5.22. Then either A \ B or A \ B i2I again by proposition 5.23. In the rst case we get B and then ' rule (). In the second case we can derive using axiom (Ax) and rules (), (! E), (! I), and (\I). This implies fx:A \ Bg ' y:xy : B by rules () and ( L). In both cases we conclude B 2 0 by Theorem 4.6, since ; (case A \ B) and fx:A \ Bg Proof of By Theorem 4.6, 22 M. Dezani et al. If since A by proposition 5.23. Otherwise we get fx:C; y:D i some I ; D Theorem 2.13(4). This implies Theorem 2.13(3). Using Theorem 2.13(1) we have C F so we get C D rule (), and we can conclude C B, i.e. Lemma 5.26. Let be a F-preorder then Proof. The proof by induction on A is similar to that of Lemma 5.15. All cases are trivial but for and arrow types. If A let X be any lter in F , that is for some x; M; . Then, by Theorem 4.6, we have 2 X . Vice versa, if 2 X , then by Denition 5.22 fun(), and so by F . We have proved, when 2 C, that Hence Xg. If A as in the proof of Lemma 5.15 proposition 4.4 since, when 2 C, Theorem 4.6 imply Lemma 5.27. Let be an F-preorder. Then I F are F-good and they agree with . Proof. We can mimic the proof of Lemma 5.16, using Lemma 5.26 instead of Lemma 5.15, for all points of Denition 5.5 but for (2). So we are left to prove that this last condition holds. The key observation is that by Lemma 5.26 and Theorem 4.6 some basis such that Let F \ F . Then 0 for some z; M; 0 . By () there exists a basis 0 such that 0 A. By Theorem 2.13(4) there are I ; A Hence by () [[z:M F . Since 0 by () there exists a basis j= , such that ' x : applying rules (), (!E), (!I) and (\I), we get ' y:xy : have by () F . Since I F agree with , we get F F , so we conclude F . Theorem 5.28. (Adequacy for the F-semantics) A i is an F-preorder. A Complete Characterization of Complete Intersection-Type Preorders 23 Proof. First we check that the given conditions are necessary. Let which are F-good, agree with , and some good . Then Denition 5.5(2) it follows By a similar argument we can obtain x: \ when 2 C. Therefore we have F-adequacy of \ only if we can prove for some I ; A by Theorem 2.13(4) and x: \ for some C i 2 T(C) by Theorem 2.13(3) and A i C i by Theorem 2.13(1) by rule (). This last judgment along with (y) implies \ Similarly from x: \ we can show that either or For the vice versa, we consider the F-interpretation domain I F and the type environment F of Denition 5.24. They are F-good and agree with by Lemma 5.27. By Lemma 5.26 Xg. So we have that implies mimicking the proof of Theorem 5.17. The preorders Ba , EHR , and AO , as well as the type preorders of [Honsell and Lenisa 1999; Scott 1972; Park 1976; Coppo et al. 1987; Honsell and Ronchi della Rocca 1992] are adequate for the F-semantics. Moreover for the last ve the simple semantics coincides with the F-semantics. The preorder BCD is an example of a preorder which is not adequate with respect to the F-semantics. The remark concerning -models and restricted -models made for the inference and the simple semantics, applies also to the F-semantics. 6. RELATED WORK AND FINAL REMARKS In the literature there are essentially ve ways of interpreting Curry's types in a model of the untyped -calculus. They dier in the interpretation of the arrow type constructor. In what follows we shall mainly follow the terminology of [Hindley 1983a]. M. Dezani et al. The simple and the F-semantics are dened as expected. Following [Scott 1980a], the quotient set semantics takes into account that we want to consider equivalent two functions i they give equivalent results when applied to equivalent arguments. So types are interpreted as partial equivalence relations of the domain rather than simply as subsets. The arrow constructor is dened as for logical relations: d A!B d 0 i for all c; c 0 such that c A c 0 it holds The F-quotient set semantics [Scott 1976], modies the quotient set semantics, in the same way as the F-semantics modies the simple semantics. Namely it requires that all elements of the domain which are equivalent with respect to an arrow must be canonical representatives of functions. Finally, Mitchell in [Mitchell 1988] introduces another semantics, which he calls inference semantics, in which the interpretation of the arrow must at least contain the canonical representatives of functions which behave correctly with respect to the application. All the above semantics easily extend to intersection-types [Dezani-Ciancaglini and Margaria 1986] and to polymorphic types [Mitchell 1988]. The crucial question in the semantics of types is the completeness of type assignment systems. Hindley proved in [Hindley 1983a] that Curry's type assignment system is complete for all the mentioned semantics. More specically [Hindley 1983a] and [Hindley 1983b] show the completeness for the simple semantics and moreover that: if and only if when A is a Curry type; (2) the simple semantics is a particular case of the quotient set semantics; (3) the F-semantics is a particular case of the F-quotient set semantics. The argument showing points (2) and (3) easily extends to intersection and polymorphic types, so for these type disciplines it is enough to discuss only completeness for the simple and the F-semantics to get completeness results for the quotiented versions. One could dene also a quotient version of the inference semantics, but this would be treated similarly. The completeness with respect to the simple semantics, of various intersection- type assignment systems, over -models, has been proved in [Barendregt et al. 1983; Hindley 1982; Coppo et al. 1984; Coppo et al. 1987; van Bakel 1992]. As far as the completeness with respect to the F-semantics of intersection-type assignment systems over -models, we can cite [Dezani-Ciancaglini and Margaria 1986], [Yokouchi 1994], [Abramsky and Ong 1993]. In [Dezani-Ciancaglini and Margaria 1986] the type preorders which give -models where some lters are never interpretations of -abstractions and which are complete for the F-semantics are characterized. More specically it is shown that a type preorder satises the previous conditions if and only if 6 types are invariant under -equality of subjects, and moreover the following rule (due to R.Hindley): (Hindley rule) for all 2 C, is a derived rule. A Complete Characterization of Complete Intersection-Type Preorders 25 Yokouchi in [Yokouchi 1994] shows that if we add two suitable rules (quite similar to Hindley rule) to the intersection-type assignment system of [Coppo et al. 1981] we obtain completeness for the F-semantics. Abramsky and Ong, in [Abramsky and Ong 1993], prove the completeness of the preorder AO , with respect to the F-semantics, over applicative structures with convergence. We conclude the paper with three nal remarks. If is a natural type preorder which is adequate for the F-semantics, then Hind- ley's rule is admissible in \ . This follows from the observation that under the given conditions for all n 0 and for all 2 C we can nd I ; A (1) such that i2I We could have used the syntactic approach based on term models introduced in [Hindley 1982] for showing all our adequacy results concerning the simple semantics, but not as far as the inference or the F-semantics. To this end, notice that if reduces to an abstraction then a fortiori M1 reduces to an abstraction, where I x:x and 1 xy:xy. Therefore is the representative of a function whenever is the representative of a function. Now consider the F-preorder Ciancaglini and Margaria 1986]. We have DM xI which implies, by soundness, F xI By the above we get F x1 but it is easy to check, using the Generation Lemma, that we cannot deduce x1 : from As a matter of fact, the proof of completeness for the F-semantics in [Yokouchi 1994] uses a clever variant of the term model for a -calculus with constants. It is not clear to us if this could be adapted to the general case treated here. It would be nice to investigate independent set-theoretic conditions which imply that a type interpretation and a type environment agree with a type preorder. The canonical example in this sense is the one given by partial applicative structures and the preorder EHR . [Dezani-Ciancaglini et al. 2000] is an extended abstract of the present paper. ACKNOWLEDGMENT The authors are grateful to Wil Dekkers, Yoko Motohama, and to the referees of ITRS submission and of the present submission for their useful comments and suggestions. In particular the present general denition of type preorder which 26 M. Dezani et al. allows to represent all graph models was worked out under the crucial guide of a referee of TOCL submission. --R Domain theory in logical form. Full abstraction in the lazy lambda calculus. The Lambda Calculus: its Syntax and Semantics From computation to foundations via functions and application: The An extension of the basic functionality theory for the Extended type structures and Functional characters of solvable terms. Type theories A complete characterization of the complete intersection-type theories A characterization of F Algebras and combinators. Introduction to Combinators and The simple semantics for Coppo-Dezani-Salle types The completeness theorem for typing Curry's type-rules are complete with respect to F-semantics too Semantical analysis of perpetual strategies in type inference and containment. A type assignment for the strongly normalizable Continuous lattices. Open problem. Data types as lattices. Lambda calculus: Some models Letter to Albert Meyer. Complete restrictions of the intersection type discipline. Topology via logic. --TR Introduction to combinators and MYAMPERSANDlgr;-calculus A characterization of <italic>F</>-complete assignments Type theories, normal forms, and <italic>D</><subscrpt><inline-equation><f>MYAMPERSANDinfin;</f></inline-equation>0E-lambda-models type inference and containment Topology via logic Complete restrictions of the intersection type discipline Operational, denotational and logical descriptions Set-theoretical and other elementary models of the MYAMPERSANDlgr;-calculus An approximation theorem for topological lambda models and the topological incompleteness of lambda calculus Full abstraction in the lazy lambda calculus F-semantics for type assignment systems Semantical analysis of perpetual strategies in MYAMPERSANDlgr;-calculus From computation to foundations via functions and application The simple semantics for Coppe-Dezani-SallMYAMPERSANDeacute; types The Y-combinator in Scott''''s Lambda-calculus Models --CTR M. Dezani-Ciancaglini , F. Honsell , Y. Motohama, Compositional characterisations of -terms using intersection types, Theoretical Computer Science, v.340 n.3, p.459-495, 31 August 2005 Fabio Alessi , Franco Barbanera , Mariangiola Dezani-Ciancaglini, Intersection types and lambda models, Theoretical Computer Science, v.355 n.2, p.108-126, 11 April 2006
lambda models;lambda calculus;completeness;intersection types
602414
Architecture and algorithms for scalable mobile QoS.
Supporting Quality of Service (QoS) is an important objective for future mobile systems, and requires resource reservation and admission control to achieve. In this paper, we introduce an admission control scheme termed Virtual Bottleneck Cell, an approach designed to scale to many users and handoffs, while simultaneously controlling "hot spots". The key technique is to hierarchically control an aggregated virtual system, ensuring QoS objectives are satisfied in the underlying system without per-user resource management such as advanced reservations of bandwidth in a user's predicted future locations. We develop a simple analytical model to study the system and illustrate several key components of the approach, such as balancing the conflicting design objectives of high utilization, scalability, and ensured QoS. We formulate the problem of clustering cells into virtual system as an optimization problem and propose a heuristic adaptive clustering algorithm as a practical solution. Finally, we evaluate the scheme by developing a simple analytical model, devising an optimal off-line algorithm, and performing simulations of a two-dimensional network.
Introduction Next generation wireless and mobile devices will support applications ranging from traditional cellular voice to web browsing and interactive multimedia applications. Concurrently, packet networks are evolving from the best effort model of the past to networks which support multiple service classes [25]. An important challenge is to incorporate user mobility into future network service models and resource management algorithms [23]. To satisfy the performance demands of such future mobile users, the network must limit the severity, frequency, and duration of overload due to hand-offs and user mobility. While special-purpose scheduling algorithms can mitigate the effects of error prone wireless links [7, 19, 20], admission control and resource reservation must ultimately be employed to pro-actively ensure that mobile users' quality-of-service requirements can be satisfied. In cellular voice systems, guard channels provide a simple but effective mechanism for controlling QoS by statistically allocating capacity in each cell exclusively for users handing off [22]. In contrast, the expected diversity of future applications, traffic types, QoS requirements, and mobility patterns has prompted a significant research effort for alternate solutions [1, 5, 6, 8, 13, 17, 21, 23, 24]. For example, capacity can be reserved for a particular user at future times in nearby cells as dictated by the mobile unit's current location and velocity, past mobility behavior, and/or other model-based prediction techniques. While such reservation schemes have demonstrated significant performance advantages over even well-engineered guard channels, they incur two limitations when applied to future networks. First, per-user prediction and dynamic resource reservation place computation and communication burdens on the network's infrastructure which increase polynomially with the number of users and hand-offs [10]. Hence, the scalability and applicability of such solutions to future micro- and pico-cellular networks is not well established. Second, as illustrated in Figure 1, quality of service is assured only with the proper mechanisms at all time scales, ranging from channel access at the "bit" time scale, to admission control at the session time scale. A difficulty encountered with location prediction is that it must bridge two fundamentally different time scales, and extend location estimations at the hand-off time scale to session QoS measures at the session time scale. Unfortunately, this gap can widen in pico-cellular environments in which cell residence times decrease while session lifetimes do not. Finally, we have experimentally found that advance reservation schemes require accurate prediction of both location and time, namely even if a user's future locations are precisely known a priori, admission control can still be conservative if the hand-off times corresponding with those locations are not also known. Channel Scheduling Lifetime Packet Handoff Session Rate -sec msec secs mins Access Figure 1: Time Scales of System Control In this paper, we develop a new admission control algorithm which achieves scalable QoS control of mobile users. Our key technique is to aggregate users and a cluster of cells into a Virtual Bottleneck Cell (VBC) in such a way that by controlling parameters of the virtual cells we ensure that QoS is satisfied in the underlying system. We develop an approach to characterize and control system QoS via two parameters. The first, which we refer to simply as "overload", is the mean fraction of capacity that is over-booked: it reflects the extent to which bandwidth demand exceeds available capacity and consequently the severity and frequency that users must adapt to lower bandwidths. The second parameter is the "outage time scale": when a cell is overloaded, this refers to the mean time until the cell returns to a non-overloaded state. Our approach is motivated by two key design objectives. First, by managing resources in an aggregated virtual system, we control system QoS without requiring accurate predictions of the times and locations of each user's future hand-offs. In this way, we ensure that our solution is scalable to a large number of users and hand-offs, such as in micro- and pico-cellular environments with a potentially large number of hand-offs per user. Second, we ensure that when parameters of the aggregated VBC are properly controlled, QoS levels in cells of the actual systems are also guaranteed to be satisfied, even in environments with heterogeneous spatial demands. In other words, our approach manages "hot spots" and system bottlenecks to simultaneously achieve scalability and efficient and accurate resource control. As VBC is an aggregate QoS scheme, an important issue is the mechanism for aggregation and de- aggregation of cells, i.e., the cell clustering policy. To address this issue, we formulate the clustering policy as a constrained optimization which seeks to maximize system utilization subject to a limit on inter-cluster hand-offs. This formulation has the effect of achieving a balance of scalability, strong QoS assurance, and efficient resource utilization. We show that a closed form solution for the optimal clustering policy cannot be obtained without strong assumptions on user mobility patterns, namely, a detailed and accurate stochastic model of user mobility. As such models are not available, we propose a heuristic adaptive clustering algo- rithm, with the goal of accurately approximating the ideal solution while responsively adapting to changes in user mobility behavior and system conditions. The algorithm's key technique is to discover the correlations among occupancies of neighboring cells, and form clusters based on these correlations only as resources become overloaded. To analyze the performance of the VBC algorithm and illustrate several important design issues, we analyze the system in three ways: theoretical analysis, comparison with optimal off-line benchmarks, and simulation. First, we develop a simple analytical model to study this system. We illustrate our approach's ability to control system bottlenecks, and explore the implications of heterogeneous user demands on system performance. Second, we develop a technique based on [4, 10], which we term Perfect Knowledge Algorithm (PKA). PKA serves as a benchmark for evaluating algorithms which manage mobile QoS. We show that it is the optimal off-line admission control algorithm in that it obtains the maximal admissible region subject to the empirical QoS constraints and system rules. In particular, PKA considers a set of users' admission requests in which each user has an associated bandwidth demand and mobility pattern (i.e., times and locations of hand-offs over the duration of the session), and the goal is to select the optimal subset of users for admission which maximizes the system's utilization while satisfying the required QoS. We show that the general problem can be formulated as a non-linear constrained optimization problem. Moreover, for the special case of zero probability of hand-off drop, we show that the solution can be expressed as a linear constrained optimization problem, and computed efficiently using standard tools. Finally, we perform an extensive set of simulations and admission control experiments using a two-dimensional 64-cell network. We first study the performance and characteristics of the adaptive clustering algorithm. Then we utilize PKA to assess the performance of our approach in more realistic scenarios. We find that the VBC algorithm with the adaptive clustering policy is able to control the admissible region within a narrow region. The remainder of this paper is organized as follows. In Section 2 we describe the system model and role of admission control. In Section 3 we develop the VBC approach and in Section 4, we define the clustering problem and propose an adaptive clustering algorithm. To analyze the system, in Section 5, we introduce an analytical model to study the problem. In Section 6 we describe an optimal off-line benchmark which we apply to simulation experiments in Section 7. Finally, in Section 8, we conclude. System Model The system model that we consider is depicted in Figure 2. It consists of a collection of base stations connected to routers or switches which are in turn inter-connected over a backbone network. Multiple service classes are provided over the backbone network via a mechanism such as [3] and extended to the wireless network via a wireless/mobile QoS architecture (e.g., [15, 23]). We focus on traffic classes requiring higher priority than "best-effort" service, including not only users of interactive multimedia applications, but also users of traditional applications such as web browsing that wish to subscribe to a premium service with bounded outage times. In such a mobile-QoS network, admission control is employed to ensure that each traffic class is allocated sufficient system resources to meet its quality of service demands. Moreover, for efficient resource utilization, such reservations and hence all QoS measures are statistical in nature; consequently, demanded bandwidth will at times exceed the available capacity due to overbooking of system resources. The goal of the admission control algorithm is to limit the frequency, severity, and durations of such overload periods to within pre-specified limits defined by the service. Indeed, the extent to which demand overloads the system capacity and the time scales of the overload will be the key quality of service metrics that we consider. Below, we formally define these QoS metrics and develop an approach to provision resources to meet these objectives in a coarse-grained manner. Finally, we note that during the overload periods, some established sessions will obtain a reduced ser- vice, and be forced to temporarily adapt to a lower bandwidth. Mechanisms and policies for adapting to such overload situations are developed in [9, 14, 18] for example, and are beyond the scope of this paper. Backbone Network Router Router Router Mobile Unit Base Station Figure 2: System Model Throughout, we focus on a single QoS-controlled class, and denote the available capacity or bandwidth of cell j to the users in the QoS class by C j , and the demanded bandwidth or occupancy at time t of this same group of users 3 Virtual Bottleneck Cell (VBC) In this section, we first overview our design goals for scalable system control. We then introduce Virtual Bottleneck Cell (VBC) as our approach towards achieving these design goals and sketch a particular algorithm as an example of controlling QoS in the VBC, and hence in the system itself. We describe the key QoS metrics that we use to manage a cluster of cells and show how they can be empirically measured for an on-line admission control algorithm. 3.1 Scalable Control To control QoS in mobile networks in a scalable way, we propose a novel approach termed Virtual Bottleneck Cell. With VBC, a network of virtual cells is managed to aggregate not only the behavior of individual users within the cells, but also of individual cells within a cluster. We will show that system-wide QoS can be effectively control by managing resources in the virtual system, rather than by allocating capacity on a per-user or per-cell basis. As illustrated in Figure 3, we aggregate the state of clusters of cells into VBCs with the following objectives: ffl Scalable, low overhead QoS control: For many mobile users with a potentially large number of hand-offs in micro/pico-cellular environments, our approach manages QoS by controlling aggregated system parameters rather than tracking individual users through the system. We provide a concise representation of the virtual system to significantly reduce communication and computational overheads. ffl QoS assurance in "hot spots" and system bottlenecks: We ensure that by controlling parameters in the virtual system, we guarantee certain QoS levels in cells of the actual systems, even in environments with heterogeneous spatial demands. Figure 3: VBC Illustration 3.2 Sketch VBC Algorithm Here, we outline a particular algorithm towards achieving the objectives above. We consider two quality of service measures: overload, and the time scale of overload. Consider a set of cells C which form a cluster, and a group of K clusters which QoS is to be provisioned. We construct a Virtual Bottleneck Cell for each cluster and characterize the overload of cluster C k by (1) This measure reflects the frequency and severity of overflow, i.e., how often overload occurs, and the extent to which the system is overloaded. Throughout this paper, we will refer to fl as simply "overload". Second, we define the overflow time scale of VBC k by which denotes the maximum mean duration of overflow of any cell in the VBC. (See also [2] for a related measure of a user's ``degradation period ratio''.) Notice that aggregation of the cells' behavior into the virtual cells via the ``max'' in Equations (1) and (2) ensures that by controlling parameters of the VBC, the QoS condition is also satisfied in each constituent cell of the cluster. Thus, describes the severity of VBC k's overload, whereas T k describes the durations over which demand exceeds capacity. We provision resources according to these QoS measures rather than the more traditional probability of hand-off drop in order to generalize our solution to systems in which users adapt to overflow situations rather than having their session dropped all together. For example, rather than dropping sessions upon overflow, users may prefer to temporarily renegotiate to lower reserved bandwidths or even incur temporary service outages. To maintain quality of service to within pre-specified levels set by the class requirements, we employ admission control and resource reservation as follows. First, a new user is assigned a bandwidth\Omega new according to its traffic characteristics and the underlying medium access scheme (see [12] for example). Next, the router managing the cluster for which the new user is requesting access (see Figure 2) only admits the user to the requested class if the predictions of the two aforementioned QoS measures are within the class' requirements. Hence, for a particular cluster k, the empirical overload of the VBC, after incorporating the impact of the new user, is adaptively computed using measurements at the base stations constituting the cluster as where W denotes the measurement window and denotes the measured occupancy of cell j at time s. Similarly, denote O as an indicator function of overload in cell j at time s, including resources that would be demanded by the new user if it visits cell j. Then the VBC's mean outage time scale is given by Thus, when a new user requests a QoS-controlled session in a particular cell, the network admits the session at the requested QoS level only if the predicted service levels as given by Equations (3) and (4) are satisfied in the corresponding virtual cell. Consequently, the user will have limited durations and severity of outages while moving within the boundaries of the cluster. Notice that the admission test ensures that if the new user had been active for the past W slots, the empirical QoS measures would have been satisfied in every cell of the VBC for that duration. If in the future, users move in such a way that the empirical QoS measures go above their target values, future sessions will be blocked based on the updated measurements of the network conditions. Similarly, as users exit the system, the measured parameters of Equations (3) and (4) decrease over time allowing new users to be admitted to the system. This adaptiveness of the admission control algorithm reveals the importance of the measurement window: proper setting of W is required for any measurement-based algorithm, as it must strike a balance between system responsiveness and stability. In this case, it should be set to be larger than the mean cell residence time but smaller than the mean session lifetime. Specifically, setting it smaller than the residence time will not incorporate the key system feature that is being controlled, viz., outages due to hand-offs; moreover, setting W larger than the session lifetime will skew the QoS predictions by including the effects of sessions that no longer exist. In the previous sections we showed that for a given cluster configuration, VBC admission control provisions resources based on aggregated information of users' and cells' empirical characteristics. Here, we address the algorithm by which cells are clustered into virtual cells. An efficient clustering policy must achieve a balance in cluster size: networks divided into smaller clusters will have aggregated VBCs that accurately represent the conditions throughout the cluster. However, smaller clusters also increase the number of inter-cluster hand-offs, which are undesirable since no resources are reserved outside of a user's initial cluster. 1 On the other hand, larger clusters will reduce the number of inter-cluster hand-offs, yet will also reduce the correlation among loads in a cluster's cells. In particular, users will not be admitted if there is overload anywhere in the VBC. Thus, if the VBC is too large (consists of too many cells), users will be unnecessarily rejected. We therefore consider the probability of inter-cluster hand-off as a general measure of system QoS. 4.1 Optimal Static Clustering Standard clustering techniques seek to find similarities in a set of objects and group them such that objects within a cluster are similar to one another, and dissimilar from objects in other clusters. For example, a distance measure among objects can be defined so that objects are grouped in different clusters to minimize the total distance between objects in each cluster [16]. In contrast, the cell clustering problem must not only cluster cells with similar workloads, but must also account for user mobility among cells, i.e., the extent to which neighboring cells impact each other's overload behavior. More importantly, the ideal clustering policy is clearly dependent on the system inputs (user mobility behavior and demand), and hence, clustering must be dynamic in practice. Thus, we first devise the optimal static clustering policy, and then develop a heuristic adaptive algorithm to approximate this behavior. We formulate the clustering problem as follows. Given a subnetwork of M cells along with their empirical overload and outage time scale measures, find the combination of groups of cells (clusters) such that first, each cluster is connected, i.e., it consists of neighboring cells, and second, applying the VBC admission control in the network (which ensures overload and time scale measures requirements are satisfied), minimizes the probability of inter-cluster hand-off (which as defined below is a measure of the service certainty) and at the same time maximizes the network utilization. Let K denote any possible clustering policy of a system of size M during the observation period of T time units. Then K can be written as a T by M matrix, where row t, t - T , is the cluster configuration of the M cells at time t. Consider a set of users S requesting admission to the network. For each user x 2 S , let its mobility pattern be defined by the matrix A x of indicator functions [10], such that A x where L(x; t) is the number of the cell in which user x is located at time t. Moreover let F K (x; t) denote the cluster number, L(x; t) belongs to at time t. Also C j , and\Omega A (j; t) respectively denote the capacity of cell j, and the occupancy of cell j at time t for a set of admitted users A 2 S . For the observation period T , given a clustering policy K and a set of admitted users A the system utilization can be expressed as U K;A t=1\Omega A (j; t) with the empirical probability of inter-cluster hand-off given by which is the ratio of inter-cluster hand-offs to the total hand-off attempts. Let P K (HO) denote the probability of inter-cluster hand-off for clustering policy K, optimized in sense of minimizing the probability of inter-cluster hand-off in the network. An example of K for a stationary off-line clustering is having all cells in the sub-network in one cluster. Note that even in that case, the probability of inter-cluster hand-off is greater than zero, since users can still leave the sub-network. We also denote the probability of inter-cluster hand-off for any given clustering algorithm K, by PK (HO). We then define the Cluster Isolation Factor (CIF) as: so that with no clustering (i.e., when each cell forms a cluster by itself) the probability of inter cluster hand-off in the network is 1 and hence CIF equals 0; on the other hand, having the cluster configuration which minimizes the inter-cluster hand-offs in the network, we have the maximum possible isolation among the clusters and CIF equals 1. An optimal clustering policy K is the one that applied to the network along with the VBC admission control algorithm, maximizes utilization U , defined in Equation (6), subject to the empirical QoS requirement PHO or equivalently d CIF . An analytical solution to this optimization problem would require a model of the cell occupancies as in Equation (6), which is a function of behavior of all users' mobility characteristics as in Equation (5). However due to the complex nature of a group of users' natural behavior, there is currently no suitable model available for the users' mobility pattern and hence the cell occupancies. More- over, even in the simple case of static clustering with fixed sized clusters, the complexity of the problem for a one-dimensional array of M cells is In general, the clusters can have different sizes and shapes varying with time and the only constraint on the shape of the clusters is connectivity, i.e., starting from any cell in the cluster, one should be able to go to all the other cells of the cluster without leaving the cluster, thus further increasing the complexity of the solution. 4.2 Adaptive Clustering Algorithm Motivated by the intractability and dynamic nature of an ideal clustering algorithm, we now develop a heuristic adaptive clustering algorithm as an approximation to the above optimization problem. In designing this algorithm, we exploit the mobility patterns of users' movements in order to form the clusters. A F G Figure 4: Clustering in Neighborhood of a Hot Spot Figure 4 illustrates the design objectives by depicting the neighboring cells of a congested cell A. In order to make an accurate decision regarding admission of new calls in this group of cells, we measure the aggregated amount of hand-offs between cell A and each of its neighbors. If for example, there are excessive hand-offs from cell B to cell A, then admission of new users in cell B affects the QoS metrics in cell A, since the users of cell B hand-off to cell A with high probability. Hence, these two cells must be annexed to form a cluster. On the other hand, if cell F is annexed with A to form a cluster, and the aggregated amount of hand-offs from cell F to cell A is too low, then in making decision on admission of any user in cell F we are considering the load of cell A. But, given that cell A is overloaded and there are not many hand-offs from cell F to cell A, it results in unnecessary rejection of admission requests in cell F, which reduces the system utilization. More formally, the adaptive clustering algorithm is presented in pseudo-code in Figure 5 and described as follows. Initial state. The algorithm starts from the initial state where each individual cell in the sub-network forms a cluster of size one. Clusters annexation. Consider cell j in Figure 6 (a) which belongs to cluster B. Whenever the occupancy of cell j exceeds some multiple of the capacity of cell fiC j , fi - 0, the handed-in bandwidth from the neighboring cells of cell j, cells i and k in Figure 6 (a), during the past W time slots is measured, where W is a pre-specified fixed window size. As soon as the measured value of handed-in bandwidth for any of the neighbors of cell j, cell i in our example, exceeds ff h C j , ff h ? 0, the original cluster of the neighboring cell will join the cluster of cell j to form a new cluster. Adaptive Clustering Algorithm 1. Initial Clustering: M Clusters of Size 2. for (j 3. if (\Omega\Gamma 4. for (all-neighbors-of-cell 5. if ([ W BW in - ff h C 6. Add-Cluster-of-Neighbor-to-Cluster-of-Cell j; 7. g 8. g 8. else if (\Omega\Gamma 9. for (all-neighbors-of-cell W BW in ! ff l C 11. if ( neighbor-not-connected-to-any-other-cell-in-cluster) 12. Separate-Neighbor-of-Cluster-of-Cell j; 13. else if (neighbor-connected-to-cluster) 14. return; 15. g 17. g Figure 5: Adaptive Clustering Algorithm Cell separation. If the occupancy of cell j in Figure 6 (b) becomes lower than fiC j , then the handed-in bandwidth of those neighbors of cell j which are in the same cluster with cell j, cells i and k in Figure 6 (b), will be measured for the past W time slots. If this value is less than ff l C j , 0 - ff l - ff h , and the neighboring cell is not connected to any other cells of the cluster, it will separate from the cluster to form a cluster by itself. In the case that the neighboring cell is connected to some other cell in the cluster, it will remain a part of the cluster until the condition for separation holds for all its neighboring cells which belong to the same cluster. In Figure 6 (b) we see that in state (2), considering only cell i, cell j can leave the cluster, but since cell k is in overload status, it does not let any of its neighboring cells separate from the cluster. In state (3), cell k is no more overloaded and hence cell j can leave the cluster and form a cluster by itself (state (4)). If when one cell leaves its original cluster, it results in separation of two or more parts of the original cluster, each separated part will form a new cluster as well as the separated cell itself. By applying this algorithm to the network, the clusters will be formed around the hot spots and bottle-neck cells in the network, and as the time passes and the congested areas change (e.g., from downtown in the morning to the suburb in the afternoon) then the clusters will also change the location and follow the area of congestion. The clustering algorithm has several parameters. The first, fi, controls the level of sensitivity to overload. (a) Clusters Annexation (1) (2) (b) Cell Separation Figure Process of Clusters Annexation and Cell Separation The smaller fi is, the sooner the clusters form. Hence, in average there will be larger clusters in the network, reducing utilization but increasing CIF. The remaining parameters, ff h and ff l , control the adaptivity of the algorithm. Larger values of ff h increase the time for two clusters to annex and smaller values of ff l increase the time for a cell to separate from a cluster. Thus, when ff h and ff l are larger, clusters are smaller in size so that utilization is higher and CIF is lower. 4.3 Example1 48 48 a) Figure 7: An Example of Adaptive Clustering Figure 7 depicts an example of the adaptive clustering algorithm. Considering the sub-network of 64 cells as shown in the picture, the system starts at time 0, from the initial state where each cell forms a cluster by itself. The users are introduced to the network with Downtown Mobility Model as discussed in Section 7.1, therefore the four cells 1, 7, 56, and 63 are with high probability the destination of the users, assigned to each user upon origination of the call. Figure 7 (a) shows the configuration of the clusters in the network at time 25. The cells with white color are clusters of size one, where the ones with the same shade which are connected to each other, form clusters of higher sizes. For example, the cells 6 and 7 form a cluster and cells 13, 14, and 15 form another cluster. As shown, the formation of clusters is concentrated around the hot spots (cells 1, 7, 56, and 63) of the system. The adaptive clustering algorithm implies that those two neighboring cells join each other to form a cluster, that the moving average of the amount of handed bandwidth between them exceeds a pre-specified value. As time passes and the users' mobility patterns change, the moving average of the handed-off bandwidth between cells also varies. The adaptive clustering algorithm follows these variations and reforms the clusters. Comparing Figure 7 (a) and (b), we see the changes in clusters at time compared to time 25. The changes in clustering configuration is due to the existing randomness in the movements of the users. For example consider cell number 49; the occupancy of this cell both at than 80% of its capacity, which is the threshold for starting clustering process in this example. But at cluster by itself, whereas at has annexed to its neighbors to form a bigger cluster. The reason is that the aggregated handed-in bandwidth from cell 49 to cell 48 (which is a congested cell), measured during the past exceeds the threshold of 30% of the capacity of cell 48 (for this example). The figures show that although the clusters adaptively change in shape and size, their concentration is around those cells that are highly occupied and are considered the bottlenecks of the system. Hence the adaptive clustering algorithm is successful in finding such cells and forming clusters around them. Finally, we note that in practice, the underlying physical architecture of the network is another factor that affects the efficiency of the clustering policy. Having cells which are connected to different sub-networks or routers in one cluster increases communication overhead and may not be desirable. We have focused on the clustering problem within the set of cells connected to the same router. 5 Analytical and Numerical Investigation In this section, we introduce a simple analytical model to study several aspects of admission control using virtual bottleneck cells. Our model consists of a one-dimensional cellular array similar to one which might be used in modeling highways. . r r l r Figure 8: Network Model As shown in Figure 8, the array consists of N cells with the same length L, and cell j having capacity . The arrival of users and their speed of movement is deterministic. We consider time to be slotted and denote the rate of new call arrivals by -. Further, let ae r be the fraction of users that move to the right and ae l be the fraction of users that move to the left such that ae r establishing a new session, a user immediately begins moving with constant velocity v. Thus, each cell can be viewed as being divided into regions. Moreover, new users arrive in a cell so that the number of new arrivals in any time slot is the same in all regions of the cell. Finally, we assume that the duration of a session's lifetime is exponentially distributed with mean 1=-, so that - is the rate at which users depart from the system. 5.1 Overload To calculate the overload fl defined in Equation (1), we first compute the severity of the overload in each cell j by calculating the expected value of the amount of resources demanded beyond the available capacity as Note that is the fraction of time that i +C j users are active, is the sum of occupancies beyond the available capacity weighted by the fraction of time spent in that occupancy. Thus, to calculate fl, we first compute the probability that a cell is overloaded (i.e., its demanded capacity exceeds where n hj denotes the total number of hand-in calls, and n gj denotes the number of calls that originated in cell j. Note that there exists an n max gj which is the maximum possible number of calls originated in cell j, and is obtained when all sessions that originated in cell j have a call holding time long enough to leave the cell before being terminated. We observe that only the calls that originated in the last (R \Gamma 1) time units may still be in the same cell (due to the users' constant velocity), and that in each time unit, -=R users leave the cell, so that Let T h denote the call holding time for a specific session so that its distribution is given by Then, to compute Equation (10), we define the function y and the vectors and where R (R and each element of j (n; R \Gamma 1), n jl , represents the number of active users in region l of cell j. The probability that (n j0 ; :::; n j(R\Gamma1) ) sessions are still active in the R regions of cell j is calculated by multiplying the individual probabilities of n jl users being active in region l of cell j, for The different combinations of the number of users in various regions such that the total number of users is less than or equal to i must then be considered. The summation over these different combinations yields which is the probability that the number of users originally admitted in cell j is less than or equal to i, and is given by R Y \Theta Similarly, n hj is the sum of all active users that initiated their calls in cell in the last units and are moving to the left, and also those that initiated their calls in the last time units in cell k, 1 are moving to the right. Therefore, defining the vectors with elements R ae r ); and with elements (j \Gamma1)R R ae l ); we can then express Pr(n hj - i) as are expressed as functions of \Theta as (j \Gamma1)R Y \Theta R d Y \Theta Thus, combining Equations (9)-(12), we have an expression for cluster k's overload measure. 5.2 Overflow Timescale We next turn to the overflow time scale of the virtual bottleneck cell defined in Equation (2). We begin by computing the distribution of the overflow time in a constituent cell under the same assumptions of the model above. Let h denote the call hand-off rate. The probability that the overflow time in cell j with capacity C j is greater than s time units, P r(- j ? s), is the probability that more than C j users remain in cell j for at least time units given that the cell is overloaded. Hence, where Z js is defined as Thus, the overflow time scale of the VBC can be easily computed as the maximum E- j of all cells in the cluster. 5.3 Numerical Examples Measure cell#1 cell#2 cell#3 cell#4 cell#5 Figure 9: Overload Measure vs. Call Departure Rate We now perform numerical investigations applying the analysis above. In Figure 9, we show the results for 5. The figure depicts the measure of overload for each of the five cells, i.e., E(\Omega different call departure rates and hence different mean call holding times. The plot indicates that as 1=- increases, the overload measure increases since users stay longer in the network and hence hand-off a larger number of times. Since the number of users who move to the right is twice the number of those who move to the left, we observe that the overload measure and the probability of overload in various cells is different. Across a wide range of call departure rates -, cells 5, 4, and 3 have the highest overload measure, whereas cell 1 has the lowest. It is clear that most of the users that originate their session in cell 1 will eventually end up in cells 3, 4 or 5, which form bottlenecks in this case. However, observe that no single cell is the bottleneck in all cases, and thus performing admission control according to overload in the VBC ensures that the underlying QoS requirement is satisfied in all cells of the cluster even in the worst case. Mean Overflow Time cell#1 cell#2 cell#3 cell#4 cell#5 Figure 10: Mean Overflow Time vs. Utilization In Figure we show the mean overflow time (in time units) for the virtual bottleneck cell as well as all five cells of the underlying system. This overflow time is plotted versus the utilization of the system with - set to 0.8 in all cases. We define the VBC's mean overflow time as the maximum mean overflow times of all underlying cells as given by Equation (2), whereas utilization is the successfully utilized system capacity averaged over all cells of the network. We observe that as the utilization increases, the mean overflow time also increases and hence, admission control must be employed to limit its value. The plot also shows that there are not significant differences among the mean overflow times of the five cells for a given utilization. In addition, the mean overflow time of the VBC closely follows those of the underlying cells in the network, staying less than 0:5 time units above the mean overflow time of any cell. This illustrates that an admission decision based on the behavior of the VBC ensures that the QoS requirement is satisfied in all underlying cells without resulting in a significant decrease in the system's utilization. In summary, we presented an analysis of a simple system in which user mobility patterns result in spatially heterogeneous resource demands. We showed that the quality of service parameters in the virtual bottleneck cell closely envelop those in the underlying system, demonstrating VBC's potential to accurately control system bottlenecks in a coarse-grained way, with little cost in system utilization. 6 Perfect Knowledge Algorithm Admission control algorithms make a sequence of admission/rejection decisions in which resources are reserved for each admitted user. The performance of a particular algorithm can be assessed by evaluating the accuracy of its admission decisions, that is, whether the algorithm properly limits the hand-off dropping probability to below the target P drop , (and more generally, whether it limits the overload and outage time scale) and whether it does so while maximally utilizing the system's resources, admitting as many users as possible subject to the QoS constraint. In this section, we utilize the framework of [4, 10] to develop a benchmarking algorithm for evaluating admission control schemes in mobile multi-service networks. We term our approach Perfect Knowledge Algorithm (PKA) as it exploits knowledge of future hand-off events to ensure that the maximal admissible region is obtained while satisfying the empirical P drop constraint. Consequently, PKA, while unrealizable in practice, serves its benchmarking purpose by enabling us to evaluate the performance and effectiveness of a practical on-line admission control algorithm by comparing utilization and QoS values obtained by a certain algorithm with those obtained using the idealized PKA. 6.1 General P drop PKA considers a collection of call requests and target QoS values and outputs the set of accept/reject decisions that results in the highest mean utilization of resources subject to the required P drop . We first consider the general case of 0 - P drop - 1. In particular, consider a set of users S requesting admission to the network, and let user x 2 S be described by its required capacity c x , and let its mobility pattern be defined by the matrix A x of indicator functions such that A x ae after the h th hand-off; For a set of admitted users A 2 S , the system utilization can be expressed as U A t=1\Omega A (j; t) with the empirical dropping probability through time T given by "\Omega A (L(x; s); s) - C L(x;s) ) x which is the ratio of failed hand-offs to hand-off attempts, with 1(\Delta) denoting an indicator function. Our goal is to find the set of users A to admit which maximizes U subject to the empirical QoS requirement b P drop . We formulate the problem as a nonlinear constrained optimization problem as follows. We describe user x's success in utilizing the system via a vector defined as ff x 1(hand-off h is successful). For example, if user x hands off to cell j at time t, ff x Further, if user x is admitted and successfully hands off three times, ~ PKA selects the optimum set A by maximizing the utilization, expressed (without normalizing) as U A c x ff x h A x where H(x) denotes the number of hand-offs made by user x. Equation (16) must be maximized subject to both the system constraints c x ff x h A x and satisfaction of the empirical dropping probability Thus, describing each user by a mobility matrix of indicator functions and a vector of hand-off indicator functions, allows us to determine the optimal set of admissible users A using standard methods for solving non-linear constrained optimization problems such as multi-start gradient-search. However, as the number of state variables is quite large (the total number of hand-off attempts over all time and all users), we now turn to the special case of P which we show has a more manageable solution. 6.2 For the special case of P 0, we can formulate the optimal solution with a simpler mobility matrix and a per-user admittance indicator, rather than the above hand-off vector. Consequently, the optimal admissible region will be solvable via a constrained linear optimization problem. In particular, let user x 2 S be described by its required capacity c x , and let its mobility pattern be defined by the matrix A x of indicator functions such that A x Moreover, we reduce ff x to a (scalar) indicator function of admittance, i.e., ff . With this for- mulation, PKA for P can be expressed as a linear constrained optimization problem, maximizing utilization c x ff x A x subject to the system and QoS rules, which are concisely described as c x ff x A x In practice, the optimal solution A can be computed quite efficiently, due to the reduction in the number of state variables, the linear nature of the problem, and the fact that matrices A x are extremely sparse. We show experimental results for our implementation of PKA with P 7. 7 Experimental Results Here, we use an extensive set of simulation experiments to investigate the performance of the VBC admission control algorithm and the adaptive clustering policy and to study the characteristics of different parameters involved. 7.1 Simulation Environment The simulation environment we use in our simulations is identical to the one introduced in [11], consisting of a two dimensional 64 cell network as shown in Figure 11. Hand-offs occur between each cell and its four neighbors which share an edge with the cell. The network wraps around so that for example any user leaving the bottom edge of cell number 63 will enter the upper edge of cell 7. The 64 cell area represents a set of cells connected to the same router; so a hand-off between cell 63 and cell 7 will be considered an 48 Y cell boundary Figure 11: Cellular Topology Users follow the Downtown Mobility Model, and the four cells 0, 7, 56, and 63 are considered as downtown areas; the users are highly likely to choose one of these cells as their destination as they are initiated. The movement is through a random path toward the destination with a probability distribution in favor of the shortest path. The time is slotted to 1 minute intervals and both the call holding time and the cell residence time have geometric distribution with means 10 and 7, respectively, if not mentioned otherwise. Simulation time for all the results presented is 6 hours; during which, a large number of users were introduced to the network. The capacity of each cell is 10 Bandwidth Units (BU) and each user requires 1 BU. The traces of the users' movements were produced using the simulator of [10] with extensions for the adaptive clustering and VBC admission control algorithms. 7.2 Design Issues for Clustering Figure depicts network utilization and CIF vs. the ratio of window size over average cell residence time for 0:1. The CIF reference clustering policy K, for the simulation results shown in this section, has been chosen to be the adaptive policy which minimizes the number of inter-cluster hand-offs, achieved by setting the three parameters fi, ff h , and ff l equal to zero, since means that the network is continuously measuring the amount of transferred bandwidth among cells for new clusters to forces two clusters to annex as soon as any hand-off happens between them, and ff indicates that no cell in the network separates from any cluster. As shown in Figure 12(a) for different values of average cell residence time, utilization decreases as window size over mean residence time increases. Also illustrated in Figure 12(b), CIF increases as window Utilization Window Size / Cell Residence Time Ave. Cell T Res. =5 Ave. Cell T Res. =7 Ave. Cell T Res. =10 (a) Utilization Isolation Factor Window Size / Cell Residence Time Ave. Cell T Res. =5 Ave. Cell T Res. =7 Ave. Cell T Res. =10 (b) Cluster Isolation Factor Figure 12: Impact of Measurement Window Size on System Performance size increases. The reason for this is that larger measurement windows tend to increase cluster size, and as ensures QoS over the entire cluster, this correspondingly increases CIF and decreases utilization. Thus, we conclude that an ideal value of the window size is 1 to 2 times larger than the average cell residence time, as larger values decrease utilization and smaller window sizes than the average cell residence time would not capture the true amount of capacity transfered among the cells. Utilization CIF Figure 13: Impact of fi on System Performance Figure 13 illustrates the impact of the clustering threshold fi on system performance for ff The figure indicates that choosing fi to be less than 1 has the best effect on the isolation of the clusters, as clusters will form preemptively before overload occurs. As an example, with 0:8, the system will have a utilization of approximately 60% where the clusters are 80% isolated compared to the reference clustering algorithm K. Figure 14(a) shows the impact of the clustering annexation threshold ff h on utilization and CIF for size equal to the average cell residence time (7 time units). Observe that CIF rapidly decreases for lower values of ff h indicating that smaller values for ff h (and lower-load, or preemptive cluster annexation) are preferable. For ff l , which denotes the threshold for separating cells from clusters, observe from Figure 14(b), that changes of ff l in the valid range of [0; ff h ] result in moderate changes in utilization and CIF, with lower values (and lower-load cluster separation) being slightly preferable. Thus, it is clear from the above experiments that the parameters are best set so that clusters form rapidly as the system approaches overload, and are not quickly separated as the load reduces. While ideal parameters are Utilization CIF (a) Clusters Annexation Threshold a Utilization CIF (b) Cell Separation Threshold Figure 14: Impact of ff h and ff l on System Performance clearly dependent on the system workload, suggested initial settings based on our experiments are 7.3 Performance of VBC Admission Control and Adaptive Clustering In Figure 15 we present the results of the simulation experiments showing the performance of the VBC admission control algorithm with adaptive clustering policy along with comparisons with two different benchmarks as well as performance of the VBC admission control with a semi-optimal clustering. Utilization PKA Opt Static Figure 15: Performance of the VBC Admission Control The first benchmark is PKA, the optimal off-line admission control algorithm described in Section 6. The PKA curve depicts the average system utilization achieved for the optimal off-line admissible region for the case of no overload, i.e. (hence the curve is flat). As shown, PKA obtains a utilization of approximately 91:54%. As a second baseline case, we compare VBC admission control to a "location specification" algorithm [10] in which users pre-specify the set of cells that they will visit during the duration of their session, and resources are reserved in each of the corresponding cells for the entire lifetime of the call. The network admits a new user only if overload will not occur at any time in any cell. Note that this algorithm is considerably more conservative than PKA as the times are not pre-specified: hence the capacity in each cell is reserved for the entire session duration. The middle curve labeled VBC represents the admissible region obtained by our implementation of the VBC algorithm with the adaptive clustering policy. While no on-line algorithm can obtain utilization greater than PKA while satisfying the QoS constraints, we observe that the VBC algorithm performs quite well. In particular, over the entire range of overload values, VBC admission control is able to outperform the location specification approach. Moreover, despite our use of scalable coarse-grained system control and assurance that QoS is satisfied even in bottleneck cells, the VBC algorithm along with adaptive clustering is able to efficiently utilize system resources, obtaining average utilization in the range of 48% to 84% for the range of overload shown. Finally we compare the performance of our adaptive clustering algorithm with another method, which we call optimal static clustering. For the particular simulation scenario discussed in Section 7.1, the optimal static clustering policy would form fixed clusters around the hot spots (cells 1, 7, 56, and 63). To obtain the utilization of the network, for a given overload value, we found the optimal clustering size for the mentioned policy, which maximizes the utilized bandwidth while satisfying the QoS requirements. As the figure shows, the adaptive clustering outperforms the optimal static scheme over a large range of overload and slightly underestimates the admissible region in high overload. Thus, these results indicate that the VBC admission control algorithm with adaptive clustering algorithm is a scalable scheme for wireless networks that can effectively and accurately control the system's admissible region. Conclusions As mobile and wireless communication becomes increasingly ubiquitous, techniques for quality of service provisioning will encounter fundamental challenges in scaling to many users and many hand-offs, especially in future micro- and pico-cellular systems. In this paper, we developed a new framework for scalable QoS control based on Virtual Bottleneck Cell Admission Control. VBC provides a mechanism to characterize and control an aggregate virtual system while closely enveloping the behavior of the underlying cells, enabling efficient provisioning of system resources, even under heterogeneous spatial demands and "hot spots". A fundamental problem for spatial resource aggregation is cell clustering. We formulated the clustering problem as an optimization problem and designed a heuristic adaptive clustering algorithm as a practical approximate solution. To evaluate the performance of the scheme, we developed a simple one-dimensional analytical model, an optimal off-line algorithm for benchmarking, and performed extensive simulation experiments. Our findings indicate that scalability need not be achieved at the expense of efficient resource utilization and strong quality of service guarantees. 9 Acknowledgments The authors are grateful to Rahul Jain and members of the Rice Networks Group for their insightful comments and discussions. --R A framework for call admission control and QoS support in wireless envi- ronments Call admission control for adaptive multimedia in wireless/mobile networks. An architecture for differentiated services Online Computation and Competitive Analysis. Connection admission control for mobile multiple-class personal communications networks Predictive and adaptive bandwidth reservation for hand-offs in qos-sensitive cellular networks Effort limited fair scheduling for wireless networks. Predictive QoS-based admission control for multiclass traffic in cellular wireless networks A systems approach to prediction A framework for design and evaluation of admission control algorithms in multi-service mobile networks Towards coarse-grained mobile QoS Quality of service over wireless ATM links. A resource estimation and call admission algorithm for wireless multimedia networks using the shadow cluster concept. Adaptive resource management for indoor mobile computing environments. An architecture for QoS guarantees and routing in wireless/mobile networks. Mathematical Classification and clustering. Distributed call admission control in mobile/wireless networks. Achieving mac layer fairness in wireless packet networks. Packet fair queueing algorithms for wireless networks with location-dependent errors On optimal call admission control in cellular networks. Communications: Principles and Practice. Quality of service guarantees in mobile computing. Integrated services packet networks with mobile hosts: Architecture and performance. QBone: Building a testbed for differentiated services. --TR A resource estimation and call admission algorithm for wireless multimedia networks using the shadow cluster concept Adaptive resource management algorithms for indoor mobile computing environments Predictive and adaptive bandwidth reservation for hand-offs in QoS-sensitive cellular networks An architecture for QoS guarantees and routing in wireless/mobile networks A systems approach to prediction, compensation and adaptation in wireless networks Call admission control or adaptive multimedia in wireless/mobile networks Online computation and competitive analysis Integrated services packet networks with mobile hosts Towards coarse-grained mobile QoS Achieving MAC layer fairness in wireless packet networks A modified distributed call admission control scheme and its performance Communications --CTR Punit Ahluwalia , Upkar Varshney, Managing end-to-end quality of service in multiple heterogeneous wireless networks, International Journal of Network Management, v.17 n.3, p.243-260, June 2007
admission control;mobile networks;adaptive clustering
603086
Efficient approximate planning in continuous space Markovian decision problems.
Monte-Carlo planning algorithms for planning in continuous state-space, discounted Markovian Decision Problems (MDPs) having a smooth transition law and a finite action space are considered. We prove various polynomial complexity results for the considered algorithms, improving upon several known bounds.
Introduction MDPs provide a clean and simple, yet fairly rich framework for studying various aspects of intelligence, such as, e.g., planning. A well-known practical limitation planning in MDPs is called the curse of dimensionality [1], referring to the exponential rise in the resources required to compute (even approximate) solutions to an MDP as the size of the MDP (the number of state variables) increases. For example, conventional dynamic programming (DP) algorithms, such as value- or policy-iteration scale exponentially with the size even if they are used as subroutines to sophisticated multigrid algorithms [4]. Moreover, the curse of dimensionality is not akin to any kind of special algorithm as shown by a result of Chow and Tsitsiklis [3]. Recently, Kearns et al. have shown that a certain on-line, tree building algorithm avoids the curse of dimensionality in discounted MDPs [8]. Recently, this result has also been extended to partially observable MDPs (POMDPs) by the same authors [7]. The bounds Homepage http://victoria.mindmaker.hu/~szepes in these two papers are independent of the size of the state space, but scale exponentially with 1 , the eective horizon-time, where is the discount factor of the MDP. In this paper we consider another on-line planning algorithm that will be shown to scale polynomially with the horizon-time, as well. The price of this is that we have to assume more regularity on the class of models in which the new results will be true. In particular, we will restrict ourselves to stochastic MDPs with nite action spaces and state space assume that the transition probability kernel of the MDPs are subject to the Lipschitz-condition jp(x for any states action a 2 A. Here L p > 0 is a given xed number (our upper bounds will be poly-logarithmic in L p ) and kk 1 denotes the ' 1 norm of vectors. Another restriction (quite common in the literature) that we will assume is the uniform boundedness of the transition probabilities (the bound shall be denoted by K p ) and of the immediate rewards (bound denoted by K r ). Further, our bounds will depend on the dimension of the state space, d. 1 The idea of the considered algorithms largely originates in the algorithm considered by Rust [12], who studied an even more restricted class of problems for which he proved the following result: Fix an MDP. Call a random, real-valued function ^ V with domain "-optimal in the mean if E ", where V is the optimal value function underlying the MDP and kk is the maximum-norm and the expectation is taken over the random function ^ . Given any " > 0, the algorithm builds up a (random) cache C " and then, given any x 2 X and using the cache C " , the algorithm draws samples from a being "-optimal in the mean. Rust has shown that both phases of the algorithm are polynomial in jAj, K r =", L p , L r , d, K r , K p , 1=(1 the Lipschitz factor of the immediate rewards. Note that Rust's bound scales polynomialy with the eective horizon-time, so all we need to do is to extend his algorithm to planning in such a way that this property is kept. The following algorithm , yielding almost optimal policies with high probability, is such an algorithm: Fix the random sample N and consider ^ V and a state x. Using Markov's inequality we get that P(k ^ if we could compute R dy then a contraction argument would show that drawing samples is sucient for ensuring the "-optimality of with probability at least 1 . Note that in this bound the number of samples depends polynomially on 1=, { ideally one would like to have a poly-logarithmic dependence on 1=. Furthermore, carrying out the above calculations requires the evaluation of jAj integrals over the state space, that must themselves be approximated. 2 Clearly, the bound that follows in this way will majorize the bound obtained above by Markov's inequality, and will still depend polynomially on 1=. One can also obtain a uniformly optimal policy by re-drawing the random samples 1 The bounds developed by Kearns et. al do not exhibit any dependence on the state space. One might either want to reuse the samples drawn earlier or draw new samples. The second approach is easier to analyze, whilst the rst one may appear more elegant for some. for each query (this algorithm does not have an o-line phase). Bounds on the number of samples and the number of steps of the computation can be computed by some tedious calculations for this case as well in the above manner. The main result of this article is the sharpening of the estimates sketched above by the application of maximal inequalities. In particular, our estimate will be poly-logarithmic in 1= and L p (instead of being polynomial in them) and we drop the Lipschitz continuity restriction of the immediate rewards. Further, our bound for the number of samples will be poly-logarithmic in the size of the action space, as well. We will also derive novel bounds for the complexity of calculating uniformly optimal policies using the algorithm outlined above. The organization of the paper is as follows: In Section 2 we provide the necessary background. The algorithm is given in Section 3, the main result of the paper is formulated in Section 4. The proof of the main result is given in Section 5, and conclusions are drawn in Section 6. Preliminaries We assume that the reader is familiar with the basics of the theory of MDPs. Readers who lack the necessary background are referred to the book of Dynkin and Yuskevich [6] or the more recent books [2] and [10]. 2.1 Notation refers to the ' p norm of vectors and the L p norm of functions, depending on the type of its argument. Lip p denotes the set of mappings that are Lipschitz-continuous in the norm kk means that there exists a positive constant L > 0 s.t. kf(x) f(y)k p L kx yk p (domains of the mappings are suppressed). L is called the k k p -Lipschitz constant of f . Lip p ( denotes the set of mappings whose kk p Lipschitz constant is not larger than . A mapping T is called a contraction in the norm kk p < 1. For brevity, the maximum-norm kk 1 will be denoted by kk. Let V be any set, T : V!V and S : V!V. Then the mapping by V. The set of natural numbers will be denoted by N , the set of reals by R. If t 2 N then T t denotes the map that is the product of T with itself t-times. We say that holds for all v 2 V. ! will in general denote an elementary event of the probability space under consideration, lhs means \left-hand-side", and rhs means \right-hand-side". We dene B(X for K > 0, BK (X g. 2.2 The Model Let us consider the continuous space discounted MDP given by (X ; A; p; is the state space, A is the action space, p is a measurable transition Table 1: Pseudo-code of the algorithm (model parameters). 1. Compute t and N as dened in Theorem 5.18. 2. Draw independent samples uniformly distributed over X . 3. Compute according to (2). 4. Let v 5. Repeat t times: v i := g. 6. Let a g. 7. Return a . law: is a measurable function, called the reward function and 0 < < 1 is the discount factor. We further assume the followings: Assumption 2.1. A is nite. Assumption 2.2. There exist constants K A. Assumption 2.3. There exists some constant K r > 0 s.t. krk 1 < K r . 3 The Algorithm First, we give the pseudo-code of the on-line planning algorithm that yields uniformly optimal policies and then we introduce the formalism required to present the main results and the sketches of the proofs. The pseudo-code of the algorithm can be seen in Table 1. Note that at the expense of increasing the computation time one may downscale the storage requirement of the algorithm from O(N 2 ) to O(N) if Step 3 of the algorithm is omitted. Then Equation (2) must be used in Steps 5 and 6. Note that one may still precompute the normalizing factor of (2) for speeding up the computations since the storage requirements for these normalizing factors depend only linearly on N . Now, we introduce the notation necessary to state the main results. Let T a B(X ) be dened by Z Here a 2 A is arbitrary and the integral should be understood here and in what follows over X . For a stationary policy dened by Finally, let the Bellman-operator dened by a2A Under our assumptions, T is known to have a unique xed-point, V , called the optimal- value function. V is known to be uniformly bounded. It is also known that any (sta- is optimal in the sense that for any given initial state the total expected discounted return resulting from the execution of is maximal. (The execution of a policy means the execution of action (x) whenever the actual state is x.) A policy is called myopic or greedy w.r.t. the function our case the action set A is nite, the existence of a myopic policy is guaranteed for any given uniformly bounded function V . Now let x us denote be dened by where 0; otherwise: (2) Similarly, a2A be dened by Throughout the paper we are going to work with independent random variables being uniformly distributed over X . 3 X 1:N will be used to denote (X the random operators ^ TN a , ^ TN and ^ TN by the respective equations TN TN is called the random Bellman-operator and is intended to approximate the true Bellman-operator T . 3 The uniform distribution is used for simplicity only. Any other sampling distribution with support covering X could be used if the algorithm is modied appropriately (importance sampling). The form of the ideal sampling distribution is far from being clear since a single sample-set is used to estimate an innite number of integrals. The form of the ideal distribution should be the subject of future research. dened by dened by dened by a2A and, nally, let ^ dened by a2A The following proposition is at the heart of the proposed computational mechanism: Proposition 3.1. For any integer t > 0, x 1:N x 1:N and in particular, Proof. By inspection. Remark 3.2. According to Proposition 3.1, one can compute in two phases, the rst of which we could call the o-line phase and the second of which we could call the on-line phase. In the o-line phase one computes the N dimensional vector v (t) time,whilst in the second phase one computes the value of evaluating N )(x). This second step takes thus the whole procedure takes O((t time. Further, it is easy to see that the procedure takes O(N Now the algorithm whose pseudocode was given above can be formulated as follows: Assume that we are given a xed " > 0. On the basis of " and L we compute some integer t > 0 and another integer N > 0. Each time we need to compute an action of the randomized policy for some state x, we rst draw a random sample 4 Here we assume that the basic algebraic operations over reals take O(1) time and that the storage of a real-number takes up O(1) storage-space. We also assume that ^ 1:N is not stored. X 1:N and compute v (t) random action of (x) is computed by evaluating The resulting policy will be shown to be "-optimal. Another, computationally less expensive method is to hold the random sample X 1:N xed and, accordingly, compute v (t) only once. Then the computation of (x) using (4) costs only O(jAjN 2 ) steps. This policy will be shown to be "-optimal with high probability in Theorem 5.13. The rst result shows that the algorithm just described yields a uniformly approximately optimal policy with high probability and has polynomial complexity: Theorem 4.1. Let log(1= and let log d log let the stationary policy be dened by ^ It is easy to see that the complexity of the algorithm meets indeed what we said before. The next result shows that the modied, fully on-line algorithm given in Table 1 yields a uniformly approximately optimal policy and has also polynomial complexity: Theorem 4.2. Let and let N be the smallest integer larger than d log let the stochastic stationary policy : X A ! [0; 1] be dened by 1:N is the policy dened by ^ is "-optimal and given a state x, a random action of can be computed in time and space polynomial in K r =", d, K r , K p , log L p , jAj and 1=(1 The rough outline of the proof is as follows: Under our assumptions, Pollard's maximal inequality (cf. [9]) ensures that for any given xed function V 0 , is small with high probability. 5 Using the triangle inequality one then reduces the comparison of to those of ^ varies from zero to n 1. More precisely, one shows that if the dierences between ^ are small for all will be small, as well. Using this proposition it is then easy to prove a maximal inequality for Now, one can use standard contraction arguments to prove an inequality that bounds the dierence of the value of a policy that is \approximately" greedy w.r.t. some function in terms of the Bellman-residuals (see e.g. [14]). The plan is to use this inequality for TN . Some more calculations yield Theorem 4.1. Then, it is proven that if a policy selects only \good actions" (i.e., actions from A " f a for a suitable ") then it is itself \good" (close to optimal). Next, we relax the condition of \selecting good actions" to \selecting good actions with high probability". Such policies can be shown to be \good", as well (cf. Lemma 5 of [8]). Finally, it is shown that if a policy is good with high probability then it selects good actions with high probability and thus, in turn, it must be \good". This will nish the proof of Theorem 5.18. 5 Proof We prove the theorem in the next three sections. First, we prove some maximal inequalities for the random Bellman-operators ^ TN a . Next we show how these can be extended to powers of TN and, nally, we apply all these to prove the main results. 5 We must rely on Pollard's maximal inequality instead of the simpler Cherno-bounds because the state space is continuous and the sup-norm above involves a supremum over the state space. Further, this result is derived in two steps, using an idea of Rust [12]. 5.1 Maximal Inequalities for Random Bellman Operators We shall need some auxilliary operators which are easier to approach by maximal inequal- ities. Let ~ TN a V ~ a2A TN a V )(x)g: We need some denitions and results from the theory of empirical processes (cf. [9]). ~ TN a V ~ a2A TN a V )(x)g: We need some denitions and results from the theory of uniform deviations (cf. [9]). Denition 5.1. Let A R d . The set S A is an epsilon-cover of A if for all t 2 A there exists an element s of S s.t. 1 d ". The set of "-covers of A will be denoted "). Denition 5.2. The "-covering number of a set A is dened by The number log N ("; A) is called the \metric entropy" of A. Let z (R d ) n and let F R R d . We dene The following theorem is due to Pollard (see [9]): Theorem 5.3 (Pollard, 1984). Let n > 0 be an integer, " be a set of measurable functions. Let X d be i.i.d. random variables. Then sup n 8E e An elegant proof of this theorem can be found in [5][pp. 492]. In general, some further assumptions are needed to make the result of the above sup measurable. Measurability problems, however, are now well understood so we shall not worry about this detail. Readers who keep worrying should understood all the probability bounds except for the main result as outer/inner-probability bounds (whichever is appropriate). Note that in the nal result we work with measurable sets and therefore there is no need to refer to outer/inner probability measures. Firstly, we extend this theorem to functions mapping R d into [ M;M ]. Corollary 5.3.1. Let n > 0 be an integer, " d be a set of measurable functions. Let X d be i.i.d. random variables. Then sup n 8E Proof. Let denote the positive and negativ parts of f , respectively (f . By Theorem 5.3 it is sucient to prove that where Denote the lhs of (8) by A and let ! 2 A. Then since D n (f proving the corollary. Denition 5.4. Let d 2 N , d > 0 and let > 0. Let and let Grid() be dened by where ties are broken in favor of points having smaller coordinates. Remark 5.5. kx P xk 1 d and jGrid()j ( Lemma 5.6. Let K > log log and N a2A ~ TN a V T a V Proof. We shall make use of Corollary 5.3.1. Let F(x 1:N z N (V; Easily, z N (V; x; a) [ In order to estimate N ("; F(X 1:N )) from above, we construct an "-cover of F(X 1:N ). We claim that is an "-cover of F(X 1:N ) if is chosen appropriately. In order to prove this let us pick up an arbitrary element z N (V; x; a) of F(X 1:N ). ThenN Therefore, if d) then S is an "-cover of F(X 1:N ). By Remark 5.5, N ("; F(X 1:N d By Corollary 5.3.1, if log log then (10) holds. Now, we shall prove a similar result for ^ TN a using ideas from the proof of Corollary to Theorem 3.4 of [12]. Lemma 5.7. Let K > log d log log a2A TN a V T a V Proof. Let us pick up some . By the triangle inequality TN a V T a V TN a V ~ TN a V ~ TN a V T a V Let If TN a V )(x) ( ~ TN a V )(x) then by simple algebraic manipulations we get TN a V )(x) ( ~ TN a V )(x) Since, by assumption jV (X i )j K, we have TN a V )(x) ( ~ TN a V )(x) R be dened by observe that TN a e)(x) and therefore by (14) we have TN a V )(x) ( ~ TN a V )(x) K (T a e)(x) ( ~ TN a e)(x) Note that this inequality holds also when p N (x; a) = 0. Taking the supremum over X yields TN a V ~ TN a V K T a e ~ TN a e By (13) we have TN a V T a V K ~ TN a e T a e ~ TN a V T a V ~ Therefore a2A TN a V T a V a2A ~ TN a V T a V Now, the statement of the lemma follows using Lemma 5.6 if one lets N 5.2 Maximal Inequalities for Powers of Random Bellman Operator First we need a proposition that relates the xed point of a contraction operator and an operator that is "approximating" the contraction. Proposition 5.8. Let B be a Banach-space and x some be operators of B such that T 1 for some > 0. Then Proof. We prove the statement by induction; namely, we prove that holds for all 0 s t. The statement is obvious for Assume that we have already proven (17) for s 1. By the triangle inequality, kT s ), the rst term of the rhs can be bounded by , which in turn can be bounded by ), by the induction hypothesis. The second term, on the other hand, can be bounded by , by (15). Since inequality (17) holds for s as well, thus proving the proposition. We cite the next proposition without proof, as the proof is both elementary and is well known. Proposition 5.9. Let ). Then the Bellman-operator T maps BK (X ) into Now, follows the main result of this section. Lemma 5.10. Let t > 0 be an integer, " > 0, > 0, log d log log If N p 3 (d; a2A Proof. Let g. By Proposition 5.9, B 0 BK (X ). By Lemma 5.7, if N p 2 (d; "(1 a2A TN a V T a V "(1 Let the elementary event ! be such that a2A TN a (!)V T a V "(1 If we show that a2A TN a (!)T t then the proof is nished. Obviously, a2A TN a (!)T t by the construction of B 0 and since 1 1. Now, note that a2A TN a (!)V T a V holds for all V 2 B(X ). Since by the choice of ! and N , a2A TN a (!)T s "(1 we also have "(1 Moreover, since ^ Proposition 5.8 can be applied with the choice ": This together with (20) yields (19), thus proving the theorem. 5.3 Proving the "-optimality of the Algorithm First, we prove an inequality similar to that of [14], but here we use both approximate value functions and approximate operators. be such that Then Note that since A is nite, the policy dened in the lemma exists. Proof. We compare T k since these are known to converge to V and V , re- spectively. Firstly, we write the dierence T k in the form of a telescoping sum: Using the triangle inequality, T; T 2 Lip 1 ( Using the and thus a2A On the other hand, kT therefore by (22), which combined with (23) yields a2A Taking the limes superior of both sides when k !1 yields the lemma. Note that if ^ a then we get back the tight bounds of [14]. 6 The next lemma exploits that if V then the Bellman- error can be related to the quality of approximation of T a by ^ 6 Note that the lemma still holds if we replace the special operators ^ by operators Lemma 5.12. Let log(1= assume that a2A Further, Proof. We use Lemma 5.11. Let us bound the Bellman-error rst: a2A ), the second term is bounded by where we have used that ^ Therefore, by Lemma 5.11 we have a2A Using the denition of t and (24) we get kV V k ", proving the lemma. Now, we are in the position to prove the following theorem: Theorem 5.13. Let and let log d log log let the stationary policy dened Proof. The proof combines Lemmas 5.12 and 5.10. Firstly, we bound a2A TN a Let ~ be dened by ~ TN a (~ does not depend on x). Then TN ~ TN ~ a2A a2A Therefore if then by Lemma 5.10 and Lemma 5.12, kV V k " with probability at least 1 . In order to nish the proof of the main theorem we will prove that in discounted problems stochastic policies that generate "-optimal actions with high probability are uniformly good. This result appears in the context of nite models in [8], though due to space limits, without a proof. For completeness, we Since our model has an innite state space and also for the sake of completeness, here we present the proof. We start with the denition of "-optimal actions and then prove three simple lemmas. Denition 5.14. Let " > 0, and consider a discounted MDP (X ; A; p; We call the set the set of "-optimal actions. Elements of this set are called "-optimal. Lemma 5.15. Let : X A ! [0; 1] be a stationary stochastic policy that selects only "-optimal actions: for all x 2 X and a 2 A from (x; a) > 0 it follows that a 2 A " (x). Proof. From the denition of it is immediate that kT and a2A Now, consider the telescopicing sum Therefore, The next lemma will be applied to show if two policies are \close to each other" then so are their evaluation functions. Both the lemma and its proof are very similar to those of Proposition 5.8. Lemma 5.16. Let B be a Banach-space, BK f g. Assume that are such that for some > 0 kT holds for all V 2 BK and < 1. Then kT s the xed points of T 1 and T 2 also satisfy kV Proof. The proof is almost identical to that of Proposition 5.8. One proves by induction that kT s holds for all s 0. Here V 2 BK is xed. Indeed, the inequality holds for Assuming that it holds for s 1 with s 1 one gets showing the rst part of the statement. The second part is proven by taking the limes superior of both sides when s !1. Now, we are ready to prove the lemma showing that policies that choose "-optimal actions with high probability are uniformly good. be a stochastic policy that selects "-optimal actions with probability at least 1 . Then kV V k Proof. Let a) denote the probability of selecting non-optimal actions in state x be the policy dened by 0; otherwise. We claim that T and T 0 are \close" to each other. For, let a2A and since kT a V k K, a2A Further, a2A a) a) 2: Therefore, and BK (X ) satisfy the assumptions of Lemma 5.16, and the xed point of T and T 0 are V and V 0 , respectively, we have Further, by construction 0 selects only "-optimal actions and thus by Lemma 5.15, Combining this with (27), we get that kV V k (" nishing the proof. We are ready to prove the main result of the paper: Theorem 5.18. Let log(1= and let log log Choose and let Further, let the stochastic stationary policy : X A! [0; 1] be dened by where X 1:N is the policy dened by ^ TN V . Then is "-optimal and given a state x, a random action of can be computed in time and space polynomial in 1=", d, K, log L p , jAj and 1=(1 Proof. The second part of the statement is immediate (cf. Remark 3.2). The bound on the time of computation is and the space requirement of the algorithm is 7 For the rst part, x X 1:N . By Theorem 5.13, if We claim that if ! is such that kV (!) V k " 0 then X 1:N (!)(a) 2 us pick up such an !, let (!); note that Therefore, using the denition of " (x), we get that X 1:N (!)(a) 2 A " 0 (1+ This shows that Now, by Lemma 5.17, the policy dened by (31) is ((" ))-optimal, i.e., Substituting the denitions of " 0 and yields the result. 6 Conclusions and Further Work In this article we have considered an on-line planning algorithm that was shown to avoid the curse of dimensionality. Bounds following from Rust's original result by Markov's inequality were improved on in several ways: our bounds depend poly-logarithmically on the Lipschitz constant of the transition probabilities, they do not depend on the Lipschitz constant of the immediate rewards (we dropped the assumption of having Lipschitz-continuous immediate 7 Assuming that only the normalization factors of the transition probabilities are stored. reward functions), and the number of samples depends on the cardinality of the action set in a poly-logarithmic way, as well. It is interesting to note that although our bounds depend poly-logarithmically on the Lipschitz constant of the transition probabilities (characterizing how \fast" is the dynam- ics), they depend polynomially on the bound of the transition probabilities (characterizing the randomness of the MDP). Therefore, perhaps not surprisingly, for these kind of Monte-Carlo algorithms faster dynamics are easier to cope with than less random dynamics (with transition probability functions). As a consequence of our result, many interesting questions arise. For example, dierent variants of the proposed algorithm could be compared, such as multigrid versions, versions using quasi-random numbers, or versions that use importance sampling. Further, in prac- tice, one would of course work with truncated probabilities to save some computational resources. The eect of this truncation needs to be explored, as well. Note that the Lipschitz condition on p can be replaced by an appropriate condition on the metric-entropy of p(xj; a) and the proofs will still go through. Therefore the proofs can be extended to Holder-classes of transition laws or local Lipschitz classes (e.g. ) (in this case one would need to use bracketing smooth functions, Sobolev classes, etc. One of the most interesting problems is to extend the results to innite action spaces. Such an extension surely needs some regularity assumptions put on the dependence of the transition probability law and the reward function on the actions. It would also be interesting to prove similar results for discrete MDPs having a factorized representation. The presented algorithm may nd applications in economic problems without any mod- ications [11]. We also work on applications on deterministic continuous state-space, nite- action space control problems and partially observable MDPs over discrete spaces. Also, a combination with look-a-head search can be interesting from the practical point of view. The algorithm was tried in practice on some standard problems (car-on-the-hill, acrobot) and it was observed to yield quite a good performance even if the number of samples was quite law. It was also observed that boundary eects can interfere negatively with the algorithm. The details of these experiments, however, will be described elsewhere. --R Dynamic Programming. Dynamic Programming: Deterministic and Stochastic Models. The complexity of dynamic programming. An optimal multigrid algorithm for continuous state discrete time stochastic control. Controlled Markov Processes. Approximate planning in large POMDPs via reusable trajectories. A sparse sampling algorithm for near-optimal planning in large Markovian decision processes Convergence of Stochastic Processes. Markov Decision Processes Structural estimation of Markov decision processes. Using randomization to break the curse of dimensionality. --TR Dynamic programming: deterministic and stochastic models The complexity of dynamic programming Markov Decision Processes A Sparse Sampling Algorithm for Near-Optimal Planning in Large Markov Decision Processes Dynamic Programming --CTR Jared Go , Thuc Vu , James J. Kuffner, Autonomous behaviors for interactive vehicle animations, Proceedings of the 2004 ACM SIGGRAPH/Eurographics symposium on Computer animation, August 27-29, 2004, Grenoble, France Jared Go , Thuc D. Vu , James J. Kuffner, Autonomous behaviors for interactive vehicle animations, Graphical Models, v.68 n.2, p.90-112, March 2006
monte-carlo algorithms;markovian decision problems;value iteration;planning
603300
On-demand multicast routing protocol in multihop wireless mobile networks.
An ad hoc network is a dynamically reconfigurable wireless network with no fixed infrastructure or central administration. Each host is mobile and must act as a router. Routing and multicasting protocols in ad hoc networks are faced with the challenge of delivering data to destinations through multihop routes in the presence of node movements and topology changes. This paper presents the On-Demand Multicast Routing Protocol (ODMRP) for wireless mobile and hoc networks. ODMRP is a mesh-based, rather than a conventional tree-based, multicast scheme and uses a forwarding group concept; only a subset of nodes forwards the multicast packets via scoped flooding. It applies on-demand procedures to dynamically build routes and maintain multicast group membership. ODMRP is well suited for ad hoc wireless networks with mobile hosts where bandwidth is limited, topology changes frequently, and power is constrained. We evaluate ODMRP performance with other multicast protocols proposed for ad hoc networks via extensive and detailed simulation.
Introduction Multipoint communications [13] have emerged as one of the most researched areas in the field of network- ing. As the technology and popularity of Internet grow, applications, such as video conferencing, that require multicast support are becoming more widespread. Another interesting recent development has been the emergence of dynamically reconfigurable wireless ad hoc networks [19,21] to interconnect mobile users. Ad hoc networks have no fixed infrastructure or central adminis- tration, and each host must communicate one another via packet radios. Due to the limited radio propagation range of wireless devices, routes are often "multihop." Applications such as disaster recovery, crowd control, search and rescue, and automated battlefields are typical examples of where ad hoc networks are deployed. Nodes in these networks move arbitrarily, thus making the network topology to change frequently and unpre- This work was funded in part by the Defense Advanced Re-search Projects Agency (DARPA) under contract DAAB07- 97-C-D321, as a part of the Global Mobile Information Systems (GloMo) program. Now with Hewlett-Packard Laboratories, Palo Alto, CA. Now with eWings Technologies, Plano, TX. dictably. Moreover, bandwidth and battery power are limited. Hence, efficient utilization of routing packets and immediate recovery of route breaks are critical in routing and multicasting protocols for ad hoc networks. In a typical ad hoc environment, network hosts work in groups to carry out a given task. Therefore, multicast plays an important role in ad hoc networks. Multicast protocols used in static networks (e.g., Distance Vector Multicast Routing Protocol (DVMRP) [11], Multicast Open Shortest Path First (MOSPF) [31], Core Based Trees (CBT) [4], and Protocol Independent Multicast (PIM) [12]) do not perform well in wireless ad hoc networks because multicast tree structures are fragile and must be readjusted as connectivity changes. Further- more, multicast trees usually require a global routing substructure such as link state or distance vector. The frequent exchange of routing vectors or link state ta- bles, triggered by continuous topology changes, yields excessive channel and processing overhead. To overcome these limitations, the On-Demand Multicast Routing Protocol (ODMRP) [25] has been de- veloped. ODMRP is a mesh-based, instead of a tree- based, multicast protocol that provides richer connectivity among multicast members. By building a mesh s and supplying multiple routes, multicast packets can be delivered to destinations in the face of node movements and topology changes. In addition, the drawbacks of multicast trees in mobile wireless networks (e.g., intermittent connectivity, traffic concentration, frequent tree reconfiguration, non-shortest path in a shared tree, etc.) are avoided. To establish a mesh for each multicast group, ODMRP uses the concept of forwarding group [7]. The forwarding group is a set of nodes responsible for forwarding multicast data on shortest paths between any member pairs. ODMRP also applies on-demand [9,29] routing techniques to avoid channel overhead and improve scalability. A soft-state approach is taken to maintain multicast group members. No explicit control message is required to leave the group. We believe the reduction of channel/storage overhead and the richer connectivity make ODMRP more attractive in mobile wireless networks. A few other multicast routing protocols have been recently proposed for ad hoc networks [6-8,14,17,20,34,38, 39,42]. The Reservation-Based Multicast (RBM) routing protocol [8] builds a core (or a Rendezvous Point) based tree for each multicast group. RBM is a combination of multicast, resource reservation, and admission control protocol where users specify requirements and constraints. The Lightweight Adaptive Multicast (LAM) algorithm [20] is a group shared tree protocol that does not require timer-based messaging. Similar to other core-based protocols, it suffers from disadvantages of traffic concentration and vulnerability of the core. The Adhoc Multicast Routing Protocol (AM- Route) [6] is also a shared-tree protocol which allows dynamic core migration based on group membership and network configuration. The Ad hoc Multicast Routing protocol utilizing Increasing id-numberS (AMRIS) [42] builds a shared-tree to deliver multicast data. Each node in the multicast session is assigned an ID number and it adapts to connectivity changes by utilizing the ID numbers. A multicast extension of Ad Hoc On Demand Distance Vector (AODV) routing protocol has been proposed in [38]. Its uniqueness stems from the use of a destination sequence number for each multicast entry. The sequence number is generated by the multicast grouphead to prevent loops and to discard stale routes. Similar to ODMRP, the Core-Assisted Mesh Protocol (CAMP) [14] uses a mesh. However, a conventional routing infrastructure based on enhanced disJoin RRRRRReply Join Query Figure 1. On-demand procedure for membership setup and maintenance tance vector algorithm (e.g., Wireless Routing Protocol (WRP) [32]) or link state algorithm (e.g., Adaptive Link-State Protocol (ALP) [16] or Source Tree Adaptive Routing (STAR) [15]) is required for CAMP to operate. Core nodes are used to limit the traffic required when a node joins a multicast group. The remainder of the paper is organized as follows. Section 2 illustrates the protocol in detail. Protocol performance improvements using mobility prediction are introduced in Section 3. Then, by extensive simulation, we evaluate and compare the performance of ODMRP with some of the above mentioned ad hoc multicast pro- tocols. Section 4 describes the simulation model and methodology followed by simulation results and analysis in Section 5. Concluding remarks are made in Section 6. 2. On-Demand Multicast Routing Protocol 2.1. Multicast Route and Mesh Creation In ODMRP, group membership and multicast routes are established and updated by the source "on de- mand." Similar to on-demand unicast routing proto- cols, a request phase and a reply phase comprise the protocol (see Figure 1). While a multicast source has packets to send, it floods a member advertising packet with data payload piggybacked. This packet, called Join Query, is periodically broadcasted to the entire network to refresh the membership information and up-date the routes as follows. When a node receives a non-duplicate Join Query, it stores the upstream node ID (i.e., backward learning) into the routing table and re-broadcasts the packet. When the Join Query packet reaches a multicast receiver, the receiver creates and Forwarding Group Multicast Member Nodes Forwarding Group Nodes Figure 2. The forwarding group concept. broadcasts a Join Reply to its neighbors. When a node receives a Join Reply, it checks if the next node ID of one of the entries matches its own ID. If it does, the node realizes that it is on the path to the source and thus is part of the forwarding group. It then sets the FG FLAG (Forwarding Group Flag) and broadcasts its own Join Reply built upon matched entries. The Join Reply is thus propagated by each forwarding group member until it reaches the multicast source via the shortest path. This process constructs (or updates) the routes from sources to receivers and builds a mesh of nodes, the "forwarding group." We have visualized the forwarding group concept in Figure 2. The forwarding group is a set of nodes which is in charge of forwarding multicast packets. It supports shortest paths between any member pairs. All nodes inside the "bubble" (multicast members and forwarding group nodes) forward multicast data packets. Note that a multicast receiver also can be a forwarding group node if it is on the path between a multicast source and another receiver. The mesh provides richer connectivity among multicast members compared with trees. Route redundancy among forwarding group helps overcome node displacements and channel fading. Hence, unlike trees, frequent reconfigurations are not required. Figure 3 is an example to show the robustness of a mesh configuration. Three sources (S 1 send multicast data packets to three receivers (R 1 , R 2 , and R 3 forwarding group nodes (A, B, and C). Suppose the route from S 1 to R 2 is !S 1 -A-B-R 2 ?. In a tree configuration, if the link between nodes A and B breaks or fails, R 2 cannot receive any packets from S 1 until the tree is reconfigured. ODMRP, on the other hand, already has a redundant route in !S 1 RRSSSAB C213 Links Multicast Routes Sources: Receivers: R R , R Forwarding Nodes: A, B, C Figure 3. Why a mesh? I I R R R222Sender Next Node Join Reply of Node R I I Join Reply of Node I111 Figure 4. An example of a Join Reply forwarding. to deliver packets without going through the broken link between nodes A and B. 2.2. Example Let us consider Figure 4 as an example of a Join Reply forwarding process. Nodes S 1 and S 2 are multicast sources, and nodes R 1 , R 2 , and R 3 are multicast receivers. Nodes R 2 and R 3 send their Join Replies to both S 1 and S 2 via I 2 . R 1 sends its Join Reply to S 1 via I 1 and to S 2 via I 2 . When receivers send their Join Replies to next hop nodes, an intermediate node I 1 sets the FG FLAG and builds its own Join Reply since there is a next node ID entry in the Join Reply received from R 1 that matches its ID. Note that the Join Reply built by I 1 has an entry for sender S 1 but not for S 2 because the next node ID for S 2 in the received Join Reply is not I 1 . In the meantime, node I 2 sets the FG FLAG, constructs its own Join Reply and sends it to its neighbors. Note that even though I 2 receives three Join Replies from the receivers, it broadcasts the Join Reply only once because the second and third table arrivals carry no new source infor- mation. Channel overhead is thus reduced dramatically s in cases where numerous multicast receivers share the same links to the source. 2.3. Reliability The reliable transmission of Join Replies plays an important role in establishing and refreshing multicast routes and forwarding groups. Hence, if Join Replies are not properly delivered, effective multicast routing cannot be achieved by ODMRP. The IEEE 802.11 MAC (Medium Access Control) protocol [18], which is the emerging standard in wireless networks, performs reliable transmission by retransmitting the packet if no acknowledgment is received. However, if the packet is broadcasted, no acknowledgments or retransmissions are sent. In ODMRP, the transmissions of Join Reply are often broadcasted to more than one upstream neighbors since we are handling multiple sources (e.g., see the Join Reply from node R 1 in Figure 4). In such cases, the hop-by-hop verification of Join Reply delivery and the retransmission cannot be handled by the MAC layer. It must be done indirectly by ODMRP. Another option for reliable delivery is to subdivide the Join Reply into separate sub-tables, one for each distinct next node. In Figure 4 for example, the Join Reply at node R 1 is split into two Join Replies, one for neighbor I 1 and one for neighbor I 2 . These Join Replies are separately unicasted using a reliable MAC protocol such as IEEE 802.11 or MACAW [5]. Since the number of neighbors is generally limited (typically, about six neighbors is the optimum in a multihop net-work [23]), the scheme still scales well to large number of sources. This option can actually be used as a backup to the passive acknowledgment option as discussed below We adopt a scheme that was used in [21]. Figure 5 is shown to illustrate the mechanism. When node B transmits a packet to node C after receiving a packet from node A, node A can hear the transmission of node if it is within B's radio propagation range. Hence, the packet transmission by node B to node C is used as a "passive acknowledgment" to node A. We can utilize this passive acknowledgment to verify the delivery of a Join Reply. Note that the source itself must send an active acknowledgment to the previous hop since it does not have any next hop to send a Join Reply to unless it is also a forwarding group node for other sources. Considering the case in Figure 4 again, we note that Transmission Passive Ack Transmission Figure 5. Passive acknowledgments. once the nodes I 1 and I 2 receive the Join Reply from node R 1 , they will construct and forward their own Join Reply to next hops (in this case, sources S 1 In transmitting their Join Reply, nodes I 1 and I 2 may overlap with each other. If I 1 and I 2 are within receiving range, they will recover because of the carrier sense feature in CSMA (Carrier Sense Multiple Access) [24]. However, if they are out of range, they will be unaware of the "hidden terminal" condition of node R 1 , which cannot hear the (overlapped) passive acknowledgments. Thus, a node may not hear the passive acknowledgments of its upstream neighbor because of conflicts due to the hidden terminal problem. It will also not hear the passive acknowledgment if the up-stream neighbor has moved away. In either case, when no acknowledgment is received within the timeout in- terval, the node retransmits the message. Note that the node may get acknowledgments from some, but not all upstream neighbors. As an option, the retransmission could be carried out in unicast mode, to selected neighbors, with reduced sub-tables. If packet delivery cannot be verified after an appropriate number of re- transmissions, the node considers the route to be inval- idated. At this point, the most likely cause of route failure is the fact that a node on the route has failed or has moved out of range. An alternate route must be found "on the spot." The node thus broadcasts a message to its neighbors specifying that the next hop to a set of sources cannot be reached. Upon receiving this packet, each neighbor builds and unicasts the Join Reply to its next hop if it has a route to the multi-cast sources. If no route is known, it simply broadcasts the packet specifying the next hop is not available. In both cases, the node sets its FG FLAG. In practical im- plementations, this redundancy is sufficient to establish alternate paths until a more efficient route is established during the next refresh phase. The FG FLAG setting of every neighbor may create excessive redundancy, but most of these settings will expire because only necessary forwarding group nodes will be refreshed in the next Join Reply propagation phase. 2.4. Data Forwarding After the group establishment and route construction process, a source can multicast packets to receivers via selected routes and forwarding groups. When receiving the multicast data packet, a node forwards it only when it is not a duplicate and the setting of the FG FLAG for the multicast group has not expired. This procedure minimizes the traffic overhead and prevents sending packets through stale routes. 2.5. Soft State In ODMRP, no explicit control packets need to be sent to join or leave the group. If a multicast source wants to leave the group, it simply stops sending Join Query packets since it does not have any multicast data to send to the group. If a receiver no longer wants to receive from a particular multicast group, it does not send the Join Reply for that group. Nodes in the forwarding group are demoted to non-forwarding nodes if not refreshed (no Join Replies received) before they timeout. 2.6. Selection of Timer Values Timer values for route refresh interval and forwarding group timeout interval can have impacts on ODMRP performance. The selection of these soft state timers should be adaptive to network environment (e.g., traffic type, traffic load, mobility pattern, mobility speed, channel capacity, etc. When small route refresh interval values are used, fresh route and membership information can be obtained frequently at the expense of producing more packets and causing network congestion. On the other hand, when large route refresh values are selected, even though less control traffic will be generated, nodes may not know up-to-date route and multicast membership. Thus in highly mobile networks, using large route refresh interval values can yield poor protocol performance. The forwarding group timeout interval should also be carefully selected. In networks with heavy traffic load, small values should be used so that unnecessary nodes can timeout quickly and not create excessive redundancy. In situations with high mobility, however, large values should be chosen so that more alternative paths can be provided. It is important to note that the forwarding group timeout value must be larger (e.g., three to five times) than the value of route refresh interval. 2.7. Unicast Capability One of the major strengths of ODMRP is its unicast routing capability [2,26]. Not only can ODMRP coexist with any unicast routing protocol, it can also operate very efficiently as an unicast routing protocol. Thus, a network equipped with ODMRP does not require a separate unicast protocol. Other ad hoc multicast routing protocols such as AMRoute [6], CAMP [14], RBM [8], and LAM [20] must be run on top of a unicast routing protocol. CAMP, RBM, and LAM in particular, only work with certain underlying unicast protocols. 2.8. Data Structures Network hosts running ODMRP are required to maintain the following data structures. 2.8.1. Route Table A route table is created on demand and is maintained by each node. An entry is inserted or updated when a non-duplicate Join Query is received. The node stores the destination (i.e., the source of the Join Query) and the next hop to the destination (i.e., the node which the Join Query is received from). The route table provides the next hop information when transmitting Join Replies. 2.8.2. Forwarding Group Table When a node is a forwarding group node of a multicast group, it maintains the group information in the forwarding group table. The multicast group ID and the time when the node was last refreshed are recorded. 2.8.3. Message Cache The message cache is maintained by each node to detect duplicates. When a node receives a new Join s Query or data packet, it stores the source ID and the sequence number of the packet. Note that entries in the message cache need not be maintained permanently. Schemes such as LRU (Least Recently Used) or FIFO (First In First Out) can be employed to expire and remove old entries in order to prevent the size of the message cache to be extensive. 3. Mobility Prediction 3.1. Adapting the Refresh Internal via Mobility Prediction ODMRP requires periodic flooding of Join Query to refresh routes and group membership. Excessive flooding, however, is not desirable in ad hoc networks because of bandwidth constraints. Furthermore, flooding often causes congestion, contention, and col- lisions. Finding the optimal refresh interval is critical in ODMRP performance. Here we propose a scheme that adapts the refresh interval to mobility patterns and speeds. By utilizing the location and mobility information provided by GPS (Global Positioning Sys- tem) [22], we predict the duration of time routes will remain valid. 1 With the predicted time of route discon- nection, Join Queries are sent only when route breaks of ongoing data sessions are imminent. In our prediction method, we assume a free space propagation model [36], where the received signal strength solely depends on its distance to the trans- mitter. We also assume that all nodes in the network have their clock synchronized (e.g., by using the NTP (Network Time Protocol) [30] or the GPS clock itself). 2 Therefore, if the motion parameters of two neighbors (e.g., speed, direction, radio propagation range, etc.) are known, we can determine the duration of time these two nodes will remain connected. Assume two nodes are within the transmission range r of each other. Let ) be the coordinate of mobile host i and ) be that of mobile host j. Also let v i be the speeds, and ' i and ' j (0 - ' 2-) be the Mobility speed and heading information can be obtained from GPS or the node's own instruments and sensors (e.g., campus, odometer, speed sensors, etc. Time synchronization of the nodes is done only at the boot time. Once nodes have powered up and their clocks are synchronized, it is not required to perform periodic updates (although periodic updates can still be done in large intervals). moving directions of nodes i and j, respectively. Then, the amount of time that they will stay connected, D t , is predicted by: where sin sin , and Note that when v is set to 1 without applying the above equation. To utilize the information obtained from the pre- diction, extra fields must be added into Join Query and Join Reply packets. When a source sends a Join Query, it appends its location, speed, and direction. It sets the MIN LET (Minimum Link Expiration Time) field to the MAX LET VALUE since the source does not have any previous hop node. The next hop neighbor, upon receiving a Join Query, predicts the link expiration time between itself and the previous hop using the equation (3.1). The minimum between this value and the MIN LET indicated by the Join Query is included in the packet. The rationale is that as soon as a single link on a path is disconnected, the entire path is invalidated. The node also overwrites the location and mobility information field written by the previous node with its own information. When a multicast member receives the Join Query, it calculates the predicted LET of the last link of the path. The minimum between the last link expiration time and the MIN LET value specified in the Join Query is the RET (Route Expiration Time). This RET value is enclosed in the Join Reply and broadcasted. If a forwarding group node receives multiple Join Replies with different RET values (i.e., lies in paths from the same source to multiple receivers), it selects the minimum RET among them and sends its own Join Reply with the chosen RET value attached. When the source receives Join Replies, it selects the minimum RET among all the Join Replies received. Then the source can build new routes by flooding a Join Query before the minimum RET approaches (i.e., route breaks). In addition to the estimated RET value, other factors need to be considered when choosing the refresh interval. If the node mobility rate is high and the topology changes frequently, routes will expire quickly R (3, (1, (4, (3, Link with delay (i, link expiration time j Path S-A-B-R S-A-C-R Delay 7 Route 1 Route 2 Figure 6. Route selection example. and often. The source may propagate Join Queries excessively and this excessive flooding can cause collisions and congestion, and clogs the network with control packets. Thus, the MIN REFRESH INTERVAL should be enforced to avoid control message overflow. On the other hand, if nodes are stationary or move slowly and link connectivity remains unchanged for a long duration of time, routes will hardly expire and the source will rarely send Join Queries. A few problems arise in this situation. First, if a node in the route suddenly changes its movement direction or speed, the predicted RET value becomes obsolete and routes will not be re-constructed in time. Second, when a non-member node which is located remotely to multicast members wants to join the group, it cannot inform the new membership or receive multicast data until a Join Query is received. Hence, the MAX REFRESH INTERVAL should be set. The selection of the MIN REFRESH INTERVAL and the MAX REFRESH INTERVAL values should be adaptive to network environments. 3.2. Route Selection Criteria In the basic ODMRP, a multicast receiver selects routes based on the minimum delay (i.e., routes taken by the first Join Query received). A different route selection method can be applied when we use the mobility prediction. The idea is inspired by the Associativity-Based Routing (ABR) protocol [40] which chooses associatively stable routes. In our new algorithm, instead of using the minimum delay path, we choose a route that is the most stable (i.e., the one with the largest RET). To select a route, a multicast receiver must wait for an appropriate amount of time after receiving the first Join Query so that all possible routes and their RETs will be known. The receiver then chooses the most stable route and broadcasts a Join Reply. Route breaks will occur less often and the number of Join Query propagation will reduce because stable routes are used. An example showing the difference between two route selection algorithms is presented in Figure 6. Two routes are available from the source S to the receiver R. Route 1 has the path of !S-A-B-R? and route 2 has the path of !S-A-C-R?. If the minimum delay is used as the route selection metric, the receiver node R selects route 1. Route 1 has a delay of 7 has a delay of 9 (3 9). Since the Join Query that takes route 1 reaches the receiver first, node R chooses route 1. If the stable route is selected instead, route 2 is chosen by the receiver. The route expiration time of route 1 is 2 (min(5; 2; while that of route 2 is 4 (min(5; 5; 4). The receiver selects the route with the maximum RET, and hence route 2 is selected. 3.3. Alternative Method of Prediction Since GPS may not work properly in certain situations (e.g., indoor, fading, etc.), we may not always be able to accurately predict the link expiration time for a particular link. However, there is an alternative method to predict the LET. This method is based on a more realistic propagation model and has been proposed in [1] and [33]. Basically, transmission power samples are measured periodically from packets received from a node's neighbor. From this information it is possible to compute the rate of change for a particular neighbor's transmission power level. Therefore, the time when the transmission power level will drop below the acceptable value (i.e., hysteresis region) can be predicted. We plan to investigate this option in our future work. 4. Simulation Model and Methodology The simulator for evaluating ODMRP and other multicast routing protocols was implemented within the library [41]. The GloMoSim library is a scalable simulation environment for wireless network systems using the parallel discrete-event simulation capability provided by PARSEC [3]. Our simulation modeled a network of 50 mobile hosts placed randomly within a 1000m \Theta 1000m area. Radio propagation range for each node was 250 meters and channel capacity was 2 Mbps. There were no network partitions throughout the simulation and the average number of neighbors for each node was 6.82. Each simulation executed for 600 seconds of simulation time. Multiple runs with different seed numbers were conducted for each s scenario and collected data were averaged over those runs. 4.1. Channel and Radio Model We used a free space propagation model [36] with a threshold cutoff in our experiments. In the free space model, the power of a signal attenuates as 1=d 2 where d is the distance between radios. In addition to the model, we also implemented SIRCIM (Simulation of Indoor Radio Channel Impulse-response Models) [37] which considers multipath fading, shad- owing, barriers, foliages, etc. SIRCIM is more accurate than the free space model, but we decided against using SIRCIM in our study because: (a) the complexity of SIRCIM increases simulation time by three orders of magnitude; (b) the accuracy of the channel model does not affect the relative ranking of the multicast protocols evaluated in this study; and (c) SIRCIM must be "tuned" to the characteristics of the physical environment (e.g., furniture, partitions, etc.), thus requiring a much more specific scenario than we are assuming in our experiments. In the radio model, we assumed the ability of a radio to lock onto a sufficiently strong signal in the presence of interfering signals, i.e., radio capture. If the capture ratio (the ratio of an arriving packet's signal strength over the sum of all colliding packets) [36] was greater than a predefined threshold value, the packet was received while all other interfering packets were dropped. 4.2. Medium Access Control Protocol The IEEE 802.11 MAC with Distributed Coordination Function (DCF) [18] was used as the MAC pro- tocol. DCF is the mode which allows nodes to share the wireless channel in an ad hoc configuration. The specific access scheme is Carrier Sense Multiple Ac- cess/Collision Avoidance (CSMA/CA) with acknowl- edgments. Optionally, the nodes can make use of Request To Send/Clear To Send (RTS/CTS) channel reservation control frames for unicast, virtual carrier sense, and fragmentation of packets larger than a given threshold. By setting timers based upon the reservations in RTS/CTS packets, the virtual carrier sense augments the physical carrier sense in determining when mobile nodes perceive that the medium is busy. Fragmentation is useful in the presence of high bit error and loss rates, as it reduces the size of the data units that need to be retransmitted. In our experiments, we employed RTS/CTS exclusively for unicast control packets directed to specific neighbors (e.g., replies). All other transmissions use CSMA/CA. We chose this configuration to minimize the frequency and deleterious effects of collisions over the wireless medium. We did not employ fragmentation because our data packets were small enough that the additional overhead would reduce overall network throughput. 4.3. Multicast Protocols In addition to ODMRP, we implemented four multicast protocols for ad hoc networks: AMRoute [6], AMRIS [42], CAMP [14], and flooding. When implementing the protocols, we followed the specifications of each protocol as defined in the published literature. We directly queried the protocol designers about details which were not specified in the publications (e.g., various timer values, core selection algorithm, etc. ODMRP and AMRIS do not require underlying unicast protocol to operate, but AMRoute and CAMP do. While AMRoute can work with any protocol, the designers of CAMP specifically state that it can operate only with certain unicast protocols [14]. We have implemented one of those protocols, WRP [32], a distance-vector based unicast routing protocol developed by the same group which developed CAMP. For a fair compar- ison, WRP was used as the underlying unicast protocol also for AMRoute. For the ODMRP [28] implementa- tion, we used the version without mobility prediction (i.e., network hosts are not equipped with GPS). 3 The parameter values used for each protocol in our simulation are shown from Tables 1 to 4. Table 5 summarizes key characteristics and properties of the protocols we simulated. 4 Note that ODMRP requires periodic messaging of Join Query only when sources have data packets to send. 3 We have decided not to utilize the mobility prediction in ODMRP implementation to give fair comparisons to other pro- tocols. Performance improvements made by the mobility prediction of ODMRP has been reported in [27]. 4 For the detail operations of each protocol, readers are referred to published documents of each protocol. Table Parameter values for AMRoute. Join-Req interval Join-Req interval when no group 5 sec members are connected to the core Tree-Create interval 20 sec Tree-Create timeout 40 sec Core resolution algorithm Highest ID Table Parameter values for ODMRP. Join Query refresh interval 3 sec Join Reply acknowledgment timeout 25 ms Maximum Join Reply retransmissions 3 Table Parameter values for AMRIS. Beacon interval 1 sec allowed beacon losses 3 New Session lifetime 3 sec Join-Req acknowledgment timeout 2 sec Broadcast random jitter time 50 ms Table Parameter values for CAMP. Number of cores 1 Beacon interval 3 sec Update interval 3 sec Age out anchor timeout 45 sec Heartbeat interval 15 sec Request retransmission interval 9 sec Max Join Request retransmissions 3 4.4. Traffic Pattern A traffic generator was developed to simulate constant bit rate sources. The size of data payload was 512 bytes. The senders were chosen randomly among multicast members who in turn were chosen with uniform probability among 50 network hosts. The member nodes join the multicast session at the beginning of Table Summary of protocols. Protocols AMRoute ODMRP AMRIS CAMP Flood Configuration Tree Mesh Tree Mesh Mesh Loop-Free No Dependency on Unicast Protocol Periodic Mes- saging Control Packet Flood the simulation and remain as members throughout the simulation. Hence, the simulation experiments do not test/account for the overhead produced in the session leave process. 4.5. Metrics We have used the following metrics in comparing protocol performance. Some of these metrics were suggested by the IETF MANET working group for rout- ing/multicasting protocol evaluation [10]. ffl Packet delivery ratio: The ratio of the number of data packets delivered to the destinations versus the number of data packets supposed to be received. This number presents the effectiveness of a protocol. ffl Number of data packets transmitted per data packet delivered: Data packets transmitted is the count of every individual transmission of data by each node over the entire network. This count includes transmissions of packets that are eventually dropped and retransmitted by intermediate nodes. Note that in unicast protocols, this measure is always equal or greater than one. In multicast, since a single transmission can deliver data to multiple des- tinations, the measure can be less than one. ffl Number of control bytes transmitted per data byte delivered: Instead of using a measure of pure control overhead, we chose to use the ratio of control bytes transmitted to data byte delivered to investigate how efficiently control packets are utilized in delivering data. Note that not only bytes of control packets (e.g., beacons, route updates, join requests, acknowledgments, etc.), but also bytes of data packet Packet Delivery Mobility Speed (km/h) ODMRP AMRIS Figure 7. Packet delivery ratio as a function of mobility speed. headers are included in the number of control bytes transmitted. Accordingly, only the data payload bytes contribute to the data bytes delivered. ffl Number of control and data packets transmitted per data packet delivered: This measure shows the efficiency in terms of channel access and is very important in ad hoc networks since link layer protocols are typically contention-based. 5. Simulation Results We tried to emulate as many scenarios as possible to investigate the protocol performance under different network situations. We have varied the following four items: mobility speed, number of multicast senders, multicast group size, and network traffic load. 5.1. Mobility Speed 5.1.1. Scenarios Each node moved constantly with the predefined speed. Moving directions of each node were selected randomly, and when nodes reached the simulation terrain they bounced back and continued to move. The node movement speed was varied from 0 km/hr to 72 km/hr. In the mobility experiment, twenty nodes are multicast members and five sources transmit packets at the rate of 2 pkt/sec each. 5.1.2. Results and Analysis Figure 7 illustrates the packet delivery ratio of the protocols under different speeds. ODMRP shows good performance even in highly dynamic situations. ODMRP provides redundant routes with a mesh topology and the chances of packet delivery to destinations remain high even when the primary routes are unavail- able. The path redundancy enables ODMRP to suffer only minimal data loss and be robust to mobility. In fact, ODMRP was as effective as flooding in this experiment which also uses a mesh topology, shows a better performance than protocols that use trees. How- ever, CAMP exhibited poorer performance than we had expected, especially under mobility. A major reason CAMP was not as effective as ODMRP was that many packets headed to distant routers in the mesh were not delivered. In CAMP, since the paths to distant destinations have fewer redundant paths than those closer to the center of the mesh, they are more prone to occasional link breaks preventing a vital "anchoring" node from successfully receiving packets. Most of the successful packet transmissions occur in this mesh center, and require fewer data transmissions per delivery than transmissions to the mesh edges. In addition, in the presence of mobility and link breaks, WRP, which is the unicast protocol CAMP prefers to coexist with, can require a period of network re-convergence in regards to a subset of destinations. During this interval, this sub-set of destinations will be marked as unreachable by the loop-detection facilities. If the group core is a part of this subset of temporarily unreachable nodes, the multicast routing updates regarding mesh maintenance will be postponed, which also contributes to delays in mesh response to mobility. AMRIS shows a poor delivery ratio compared with protocols that use mesh configuration. Since AMRIS builds a shared tree for data dissemination, there is only one path between member nodes. If a single tree link breaks because of node movements, packet collision, or congestion, destinations can not receive packets. AMRIS detects node movements and tree breaks by a beaconing mechanism. Nodes send beacons every second, and neighbors are considered to have moved away if three consecutive beacons are not received. Thus, in the best case, it takes three seconds after the link break for AMRIS to start tree readjustment. A number of packets can be lost during that period. There are possible solutions to this problem, but they all have respective drawbacks. If beacons are sent more often, that could increase packet collisions. If the number of allowed beacon losses is decremented, a node may attempt to find a new route when the link is not broken but beacons are lost due to collisions. Finding the optimal beacon interval and allowed number of beacon losses for AMRIS is beyond the scope of the paper and we used the values recommended by the AMRIS designers. The result that surprised us was for zero mobility. While other protocols showed data delivery ratio approaching unity, AMRIS delivered only 60% of data packets. Since each node sends beacons every second, there are a number of packets contending for the channel. The beacon size of AMRIS is relatively large compared with other protocols that send beacons (see [42]). Thus, the beacon traffic combined with the data traffic causes a large number of collisions leading to 40% drop. Under very light data traffic, AMRIS shows improved performance as will be shown in Figure 14. AMRoute was the least effective of the protocols with mobility. Although its delivery ratio is near perfect in no mobility, it fails to deliver a significant number of packets even at low mobility speeds. The delivery ratio steadily worsens as the mobility speed is increased. One of the reasons AMRoute performs so poorly is due to the formation of loops and the creation of sub-optimal trees when mobility is present (at 72 km/hr, the average hop count was nearly eight while other protocols were below four). Loops occur during the tree reconstruction phase when some nodes are forwarding data according to the stale tree and others according to the newly built tree. The existence of loops is critical in protocol performance because they cause serious congestion. At some instants, nodes had up to 13.75 packets dropped per second. The loss of packets due to buffer overflow has two consequences. First, if a data packet is dropped in the early stage of its multicast tree traversal, a large portion of tree members will not receive it. Second, if control packets (Tree-Create, Join-Ack, etc.) are dropped, the tree is not properly built or becomes segmented and data will not be delivered. Another reason for AMRoute ineffectiveness is its dependency on the underlying unicast protocol. AMRoute relies on the unicast protocol to set up bidirectional tunnels between group members for the multicast tree. However, as shown in [35], when mobility speed increases, the bidirectional link assumption in ad hoc networks becomes (i.e., a node can reach a neighboring node, but not necessarily vice versa). In our experiments, uni-directional "critical" links existed in AMRoute trees.1416 Number of Data Packets TXed Data Packet Delivered Mobility Speed (km/h) ODMRP AMRIS Figure 8. Number of data packets transmitted per data packet delivered as a function of mobility speed.125 Number of Control Bytes TXed Data Byte Delivered Mobility Speed (km/h) ODMRP AMRIS Figure 9. Number of control bytes transmitted per data byte delivered as a function of mobility speed. Critical links are such that packets sent by the one end of the link are mostly received by the other end but not vice versa. A great number of packets are lost at these critical links. Since there are no alternate routes in the AMRoute shared tree (although AMRoute creates the mesh in order to build a tree, data is forwarded only by tree nodes), data delivery ratio is very low. Figure 8 shows the number of data transmissions per data delivery to destinations. AMRoute has the highest number of transmissions because of loops. We can observe that protocols using meshes (i.e., ODMRP and CAMP) transmit more data packets than AMRIS, which uses a tree. In fact, ODMRP transmits nearly as much data as flooding because it exploits multiple redundant routes for data delivery. The control byte overhead per data byte delivered is shown in Figure 9. Remember that data packet header is included in control overhead. Flooding has no con- 0Number of All Packets TXed Data Packet Delivered Mobility Speed (km/h) ODMRP AMRIS Figure 10. Number of total packets transmitted per data packet delivered as a function of mobility speed. trol packets. Hence, only the data header contributes to control overhead and this overhead does not increase with mobility. Other protocols generate increasing overhead as speed increases. AMRIS shows a low control overhead compared with other multicast schemes. The primary reason is that it transmitted less data packets (as seen in Figure 8). CAMP shows a larger control overhead under high mobility than ODMRP because of its reliance on the unicast routing protocol WRP, which sends triggered updates. WRP suffers from exponential growth in control traffic overhead under increasing mobility. Moreover, CAMP piggybacks its own update messages onto WRP updates and those packets play a role in overhead growth. In ODMRP, the control overhead remains relatively constant because no updates are triggered by mobility. Join Query refresh interval was set constant to three seconds and hence no additional overhead is required as mobility increases. AMRoute has the highest ratio because of the data headers that are caught in the loops. The high ratio is also due to the formation of inefficient trees. During the tree creation phase, an inefficient tree can be formed when the Tree-Create packets from distant mesh neighbors arrives earlier than packets from nearby nodes (e.g., due to network congestion, etc. The non-optimal tree results in having longer hops between member nodes and increasing the number of data transmissions. The number of all packets transmitted per data packet delivered is presented in Figure 10. An interesting result is that CAMP has a smaller number of transmissions than ODMRP. This result stems from two factors. First, ODMRP transmits more data packets on redundant paths than CAMP. Second, although CAMP0.20.61 Packet Delivery Number of Senders ODMRP AMRIS Figure 11. Packet delivery ratio as a function of number of senders. has more control overhead bytes, the number of control packet transmissions is lower since CAMP updates are piggybacked onto WRP updates. Again, AMRIS has the smallest number of packet transmissions because it uses a tree and AMRoute has the highest value because of loops. 5.2. Number of Senders 5.2.1. Scenarios In this experiment, the multicast group size is set constant at twenty, node mobility speed is slow (1 m/s), and network traffic load is relatively light (10 pkt/sec). The number of multicast senders range in the set f1, 2, 5, 10, 20g. A single sender represents a class lecture scenario, while at the other extreme, twenty senders model a video conference situation. 5.2.2. Results and Analysis The packet delivery ratio as a function of the number of multicast senders is shown in Figure 11. As the number of sources increases, performance of flooding slightly degrades as more packets are lost by collision, conges- tion, and channel contention. ODMRP shows robustness to the number of sources. In fact, performance even improves with number of senders because of increasing number of forwarding nodes and thus better path re- dundancy. ODMRP limits the number of sources that can send Join Queries at the same time. Whenever a source needs to flood a Join Query, it listens if any other source is flooding the packet. It proceeds to send the Join Query only if no flooded packets are received within a certain period. Thus, the number of collisions Number of Control Bytes TXed Data Byte Delivered Number of Senders ODMRP AMRIS Figure 12. Number of control bytes transmitted per data byte delivered as a function of number of senders. decreases and the the protocol remains effective. Like ODMRP, CAMP shows improved performance with a larger number of senders due to the increase in the number of anchors that each node requires. Each member node requests every neighbor which is in the reverse shortest path to some source, to rebroadcast multicast update packets it receives initially. Hence increasing the number of sources increases the redundant paths in the mesh. AMRIS and AMRoute performance was unaffected by the number of senders because they use a shared tree for the multicast session. Figure 12 shows the control overhead per data byte delivered. Every protocol except ODMRP shows a relatively constant value. While the other three multicast protocols form a shared mesh or tree, ODMRP builds per-source meshes. If the number of senders increases, more Join Query packets are propagated and control overhead grows accordingly. We can speculate from this result that ODMRP in its present form may not be as efficient in networks where a large number of nodes (e.g., hundreds and thousands) are multicast sources. 5.3. Multicast Group Size 5.3.1. Scenarios We varied the number of multicast members to investigate the scalability of the protocol. While fixing the number of senders at five, mobility speed at 1 m/s, and network traffic rate at 10 pkt/sec, the multicast group size was varied from five to forty members.0.40.85 Packet Delivery Multicast Group Size ODMRP AMRIS Figure 13. Packet delivery ratio as a function of multicast group size. 5.3.2. Results and Analysis The routing effectiveness of protocols as a function of multicast group size is illustrated in Figure 13. Flooding and ODMRP performance were not affected by the number of multicast members. CAMP, on the other hand, performs markedly better as the number of receivers increases. Since the mesh becomes massive with the growth of the members, more redundant routes are formed and that improves the performance. If only a small number of nodes join the multicast session, the mesh actually appears closer to a tree for distant nodes, and the performance is reflected in this graph. AMRIS also shows improvements with the member size growth, but they are less dramatic than CAMP because redundant routes are not established in AMRIS. AMRoute shows the complete opposite behavior. As the group size increases, the delivery ratio actually drops. This behavior is due to the "critical" links that exist in the AMRoute multicast tree (critical links were described in Section 5.1). As the group size increases, the number of tree links increases and the probability of sources being isolated in the tree by critical links increases as well. 5.4. Network Traffic Load 5.4.1. Scenarios To study the impact of data traffic load on multicast protocols, we varied the load on the network. There were five senders and the multicast group size was twenty. In this experiment, there was no node mobility. Therefore, the packet drops are only caused by buffer overflow, collision, and congestion. The network traffic Packet Delivery Network Traffic Load (packets/sec) ODMRP AMRIS Figure 14. Packet delivery ratio with no mobility as a function of network traffic load. loads used were between 1 pkt/sec and 50 pkt/sec. 5.4.2. Results and Analysis Packet delivery ratios for various traffic loads are shown in Figure 14. AMRIS was the most sensitive to traffic load. AMRIS delivers a high percentage of data packets in extremely light load (i.e., less than 5 pkt/sec). As the load increases however, the ratio drops rapidly. As explained in Section 5.1, the transmission and the size of beacons resulted in numerous packet col- lisions. AMRoute performance is nearly perfect when the packet rate is relatively low, but it drops rather quickly when the traffic load is increased. The degradation is caused by buffer overflow at the members in the tree and at the mesh nodes that connect the tree members. CAMP performance is also affected by traffic load. As the load increases, the number of collisions and packet losses increase. When important control packets are dropped, anchor construction can be delayed and data packets can fail to reach all the anchors. The degradation follows a pattern similar to flooding and ODMRP, indicating a common behavior in mesh based data delivery. Flooding shows worse delivery ratios than ODMRP as load grows. Since every data packet is flooded, the number of collisions and buffer overflows grows with the load. ODMRP is also affected by load, but the packet loss rate is less severe than flooding because the number of data packet transmissions is less than flooding. Although ODMRP shows the same patters of behaviors as CAMP, it gives a better delivery rate because it has less control overhead and suffers less buffer overflows than CAMP. 6. Conclusions We have presented ODMRP for multihop wireless mobile networks. ODMRP builds and maintains a mesh for each multicast group. Providing multiple paths by the formation of mesh configuration makes the protocol robust to mobility. Alternate routes enable data delivery in the face of mobility and link breaks while the primary route is being reconstructed. The protocol does not yield excessive channel overhead in highly mobile networks because no control packets are triggered by link breaks. ODMRP also applies demand-driven, as opposed to periodic, multicast route construction and takes soft state approach in membership maintenance. The key properties of ODMRP are: ffl Simplicity ffl Low channel and storage overhead ffl Usage of up-to-date shortest routes Reliable construction of routes and forwarding group ffl Robustness to host mobility ffl Maintenance and utilization of multiple paths ffl Exploitation of the broadcast nature of the wireless environment ffl Unicast routing capability Simulation results indicate that mesh based protocols outperform tree based protocols significantly. In addition, compared with another mesh protocol CAMP, ODMRP produced less control overhead and efficiently utilized those control packets to deliver more data packets to multicast members. Since the primary concerns of ad hoc networks are frequent topology changes and constrained bandwidth, it is critical that the protocol supplies multiple routes and yields minimal overhead. ODMRP therefore, is an attractive choice for multicasting in ad hoc wireless networks. The protocol, how- ever, may suffer from excessive flooding when there are a large number of multicast senders. We are currently developing enhancements to make ODMRP more scalable to large member groups. --R "Optimal Prioritization of Handovers in Mobile Cellular Networks," "Unicast Performance Analysis of the ODMRP in a Mobile Ad hoc Network Testbed," "PARSEC: A Parallel Simulation Environment for Complex Systems," "Core Based Trees (CBT) - An Architecture for Scalable Inter-Domain Multicast Routing," "MACAW: A Media Access Protocol for Wireless LANs," "AM- Route: Adhoc Multicast Routing Protocol," "Forwarding Group Multicast Protocol (FGMP) for Multihop, Mobile Wireless Networks," "A Reservation-Based Multi-cast (RBM) Routing Protocol for Mobile Networks: Initial Route Construction Phase," "A Distributed Routing Algorithm for Mobile Wireless Networks," "Mobile Ad hoc Networking (MANET): Routing Protocol Performance Issues and Evaluation Considerations," "Multicast Routing in Datagram Internetworks and Extended LANs," "The PIM Architecture for Wide-Area Multicast Routing," "Multipoint Com- munication: A Survey of Protocols, Functions, and Mech- anisms," "The Core-Assisted Mesh Protocol," "Source-Tree Routing in Wireless Networks," "Scalable Link-State Internet Routing," "Tree Multi-cast Strategies in Mobile, Multihop Wireless Networks," IEEE Computer Society LAN MAN Standards Committee Internet Engineering Task Force (IETF) Mobile Ad Hoc Networks (MANET) Working Group Charter "A Lightweight Adaptive Multicast Algorithm," "The DARPA Packet Radio Net-work Protocols," Understanding the GPS: Principles and Applications "Optimum Transmission Radii for Packet Radio Networks or Why Six is a Magic Num- ber," "Packet Switching in Radio Channels: Part I - Carrier Sense Multiple-Access Modes and Their Throughput-Delay Characteristics," "On-Demand Multicast Routing Protocol," "Exploiting the Unicast Functionality of the On-Demand Multicast Routing Proto- col," "Ad hoc Wireless Multicast with Mobility Prediction," "On-Demand Multicast Routing Protocol (ODMRP) for Ad Hoc Networks," "The Effects of On-Demand Behavior in Routing Protocols for Multihop Wireless Ad Hoc Networks," "Internet Time Synchronization: the Network Time Protocol," "Multicast Routing Extensions for OSPF," "An Efficient Routing Protocol for Wireless Networks," "Minimiz- ing Cellular Handover Failures Without Channel Utilization Loss," "Bandwidth-Efficient Multicast Routing Protocol for Ad-Hoc Networks," "Unidirectional Links Prove Costly in Wireless Ad-Hoc Networks," Principles and Practice "Statisti- cal Channel Impulse Response Models for Factory and Open Plan Building Radio Communication System Design," "Multicast Operation of the Ad-hoc On-Demand Distance Vector Routing Protocol," "MCEDAR: Multicast Core-Extraction Distributed Ad hoc Routing," "Associativity-Based Routing for Ad-Hoc Mobile Networks," UCLA Parallel Computing Laboratory and Wireless Adaptive Mobility Laboratory "Ad hoc Multi-cast Routing protocol utilizing Increasing id-numberS (AMRIS) Functional Specification," --TR Multicast routing in datagram internetworks and extended LANs Core based trees (CBT) Multicast routing extensions for OSPF A distributed routing algorithm for mobile wireless networks The PIM architecture for wide-area multicast routing An efficient routing protocol for wireless networks A preservation-based multicast (RBM) routing protocol for mobile networks Unidirectional links prove costly in wireless ad hoc networks Multicast operation of the ad-hoc on-demand distance vector routing protocol Tree multicast strategies in mobile, multishop wireless networks Communications Forwarding Group Multicast Protocol (FGMP) for multihop, mobile wireless networks Associativity-Based Routing for Ad Hoc Mobile Networks Parsec Source-Tree Routing in Wireless Networks Scalable Link-State Internet Routing --CTR Benslimane, EM2NET: an explicit multicast for MANET, Proceeding of the 2006 international conference on Communications and mobile computing, July 03-06, 2006, Vancouver, British Columbia, Canada Muhammad Abdulla , Robert Simon, A simulation analysis of multicasting in delay tolerant networks, Proceedings of the 37th conference on Winter simulation, December 03-06, 2006, Monterey, California Yuan Zhou , Guang-Sheng Li , Yong-Zhao Zhan , Qi-Rong Mao , Yi-Bin Hou, DRMR: dynamic-ring-based multicast routing protocol for ad hoc networks, Journal of Computer Science and Technology, v.19 n.6, p.909-919, November 2004 Jason Liu , Yougu Yuan , David M. Nicol , Robert S. Gray , Calvin C. Newport , David Kotz , Luiz Felipe Perrone, Simulation validation using direct execution of wireless Ad-Hoc routing protocols, Proceedings of the eighteenth workshop on Parallel and distributed simulation, May 16-19, 2004, Kufstein, Austria Sundaram Rajagopalan , Chien-Chung Shen, What does using TCP as an evaluation tool reveal about MANET routing protocols?, Proceeding of the 2006 international conference on Communications and mobile computing, July 03-06, 2006, Vancouver, British Columbia, Canada Tim Nieberg , Stefan Dulman , Paul Havinga , Lodewijk van Hoesel , Jian Wu, Collaborative algorithms for communication in wireless sensor networks, Ambient intelligence: impact on embedded system design, Kluwer Academic Publishers, Norwell, MA, Bing Wu , Jie Wu , Eduardo B. Fernandez , Mohammad Ilyas , Spyros Magliveras, Secure and efficient key management in mobile ad hoc networks, Journal of Network and Computer Applications, v.30 n.3, p.937-954, August, 2007 Harald Tebbe , Andreas J. Kassler , Pedro M. Ruiz, QoS-aware mesh construction to enhance multicast routing in mobile ad hoc networks, Proceedings of the first international conference on Integrated internet ad hoc and sensor networks, May 30-31, 2006, Nice, France Jason Liu , Yougu Yuan , David M. Nicol , Robert S. Gray , Calvin C. Newport , David Kotz , Luiz Felipe Perrone, Empirical Validation of Wireless Models in Simulations of Ad Hoc Routing Protocols, Simulation, v.81 n.4, p.307-323, April 2005 Chien-Chung Shen , Sundaram Rajagopalan, Protocol-independent multicast packet delivery improvement service for mobile Ad hoc networks, Ad Hoc Networks, v.5 n.2, p.210-227, March, 2007 Thomas Kunz, Multicasting in mobile ad-hoc networks: achieving high packet delivery ratios, Proceedings of the conference of the Centre for Advanced Studies on Collaborative research, p.156-170, October 06-09, 2003, Toronto, Ontario, Canada Robert S. Gray , David Kotz , Calvin Newport , Nikita Dubrovsky , Aaron Fiske , Jason Liu , Christopher Masone , Susan McGrath , Yougu Yuan, Outdoor experimental comparison of four ad hoc routing algorithms, Proceedings of the 7th ACM international symposium on Modeling, analysis and simulation of wireless and mobile systems, October 04-06, 2004, Venice, Italy Stefan Pleisch , Mahesh Balakrishnan , Ken Birman , Robbert van Renesse, MISTRAL:: efficient flooding in mobile ad-hoc networks, Proceedings of the seventh ACM international symposium on Mobile ad hoc networking and computing, May 22-25, 2006, Florence, Italy Sencun Zhu , Sanjeev Setia , Shouhuai Xu , Sushil Jajodia, GKMPAN: An Efficient Group Rekeying Scheme for Secure Multicast in Ad-Hoc Networks, Journal of Computer Security, v.14 n.4, p.301-325, July 2006 Fred Stann , John Heidemann , Rajesh Shroff , Muhammad Zaki Murtaza, RBP: robust broadcast propagation in wireless networks, Proceedings of the 4th international conference on Embedded networked sensor systems, October 31-November 03, 2006, Boulder, Colorado, USA Randeep Bhatia , Li (Erran) Li, Characterizing achievable multicast rates in multi-hop wireless networks, Proceedings of the 6th ACM international symposium on Mobile ad hoc networking and computing, May 25-27, 2005, Urbana-Champaign, IL, USA Chih-Chieh Han , Ram Kumar , Roy Shea , Mani Srivastava, Sensor network software update management: a survey, International Journal of Network Management, v.15 n.4, p.283-294, July 2005
routing;mobile computing;ad hoc networks;multicast
603301
Transmission range effects on AODV multicast communication.
As laptop computers begin to dominate the marketplace, wireless adapters with varying bandwidth and range capabilities are being developed by hardware vendors. To provide multihop communication between these computers, ad hoc mobile networking is receiving increasing research interest. While increasing a node's transmission range allows fewer hops between a source and destination and enhances overall network connectivity, it also increases the probability of collisions and reduces the effective bandwidth seen at individual nodes. To enable formation of multihop ad hoc networks, a routing protocol is needed to provide the communication and route finding capability in these networks. The Ad hoc On-Demand Distance Vector Routing protocol (AODV) has been designed to provide both unicast and multicast communication in ad hoc mobile networks. Because AODV uses broadcast to transmit multicast data packets between nodes, the transmission range plays a key role in determining the performance of AODV. This paper studies the effects of transmission range on AODV's multicast performance by examining the results achieved at varying transmission ranges and network configurations.
Introduction Within the last few years, mobile computing has gained popularity as laptop computers have become smaller, lighter, and more powerful. It has become commonplace for professionals to carry their computers with them as they travel. With this increase in popularity has also come a greater demand for connectivity. The idea of anywhere/anytime network access naturally appeals to mobile users. These users want to access the Internet and communicate with their associates, whatever their location. This provides the motivation for ad hoc networking, or the on-the- y formation of networks. Protocols for managing such ad hoc networks must be able to formulate routes between any given source and destination, and then be able to maintain these routes as the location of the users changes. As the number of mobile users has risen, a wide variety of applications have become available. Some of these new applications rely on multicast communication for their operation. While identical semantically to the corresponding concept in wired networks, multi-cast in ad hoc mobile networks has a distinguishing set of characteristics and constraints. These include limited power, limited bandwidth, and high error rates. An ad hoc multicast protocol must be able to connect all group members and then maintain this connectivity after topological changes in the network. The Ad hoc On-Demand Distance Vector (AODV) routing protocol provides both unicast and multicast communication connectivity in an ad hoc mobile environment [11,16]. AODV is a reactive protocol in that it creates routes on-demand, or as needed. Both unicast and multicast routes are built using a route discovery cycle, which is initiated when a source node wishes to either nd a route to some destination or join a multi-cast group. Nodes which are able to provide a route to the desired destination respond to the source node by sending it a reply packet. Once a route is established, it is maintained as long as it is needed; i.e., until either the source node stops sending packets, or until there are no longer any members of the multicast group. AODV is able to quickly repair link breaks in active routes whenever they occur. Other ad hoc multicast protocols have recently been developed as this topic has attracted the attention of the research community. The On-Demand Multicast Routing nProtocol (ODMRP) [9] is a mesh-based algorithm which calculates a forwarding group for each multicast group. The forwarding group is a set of nodes which forward multicast packets that they receive. The group is periodically refreshed by a network-wide Join Request message broadcast by each multicast source node. An alternative protocol is the Core-Assisted Mesh Protocol (CAMP) [6]. Like ODMRP, CAMP also creates a shared mesh per multicast group. CAMP uses core nodes to limit the amount of control tra-c when nodes join a group, and it ensures that the shortest path from receivers to sources is a part of the mesh. Finally, the Lightweight Adaptive Multicast protocol (LAM) [7] is similar to AODV in that it is tightly coupled with a unicast protocol (TORA [10]), and also creates a shared tree for each multicast group. However, LAM bases this shared tree at a pre-selected core node. Current wireless modems oer a wide range of transmission power and connectivity. For instance, the Wavelan IEEE Turbo card, which oers 2 Mb/s at a 400m transmission radius in open o-ce conditions and a 90m radius in semi-open conditions. The 1 Mb/s data rate for this card oers a 550m and 115m range in the same conditions. Proxim's 1.6 Mb/s RangeLAN2 oers a 300m outdoor range and 150m indoor range. Breeze- com's SA-PC Pro card provides data rates between 1 and 3 Mb/s, while transmitting at a range of 600m outdoors These products oer a variety of power levels, and thus transmission ranges, for fairly similar bandwidth. It might seem desirable to have the largest possible transmission radius, since this would provide the greatest amount of connectivity. However, high density networks suer from channel access delays and an increased number of collisions. Moreover, applications sometimes have to run in constrained environments. For instance, in a conference scenario, attendees are likely to be conned within some xed area, possibly in just a single large room. With that area, it is not necessarily the case that the largest transmission radius is the best solution for connectivity. A large transmission radius necessarily implies that more users are aected by each transmission, thereby limiting the eective bandwidth of neighboring users. The larger the transmission ra- dius, the more users aected by transmissions. In the case of unicast data, the eects of a large transmission radius in a conned area may be somewhat mitigated by channel access schemes such as the IEEE 802.11 Distributed Coordination Function (DCF) [4]. For unicast communication, DCF utilizes short control packets for acquiring the channel, and provides an acknowledgment to ensure data reception. Thus, while the number of collisions of the control packets may increase with larger transmission radii, thereby increasing channel access time, data throughput may not be notably aected. Since the number of hops to reach a destination is smaller for a larger transmission radius, the total delay for a data packet between source and destination might even decrease. However, for multicast data, the situation is quite dierent. Multicast data packets are in some ways similar to broadcast tra-c. In the case of AODV, when a node receives a data packet with a multicast destination address, it must send the packet up the protocol stack at least as far as the IP layer to determine whether to accept or forward the packet. For short transmission radii, the number of nodes aected by a single transmission is small, so a network node that does not belong to any multicast groups is less likely to waste signi- cant processing power discarding useless packets. How- ever, as the transmission range increases, the number of nodes which receive multicast data transmissions also increases, and, assuming that the membership of a multicast group is a relatively small percentage of the total network population, the number of nodes adversely affected by these multicast transmissions similarly rises. Hence there is a tradeo between being able to reach multicast group members in a smaller number of hops, and keeping the set of nodes aected by multicast data transmissions to a minimum. This paper investigates the nature of that trade- o, examining the eects of varying transmission range within dierent conned network areas. A variety of results are examined, including the packet delivery ratio for multicast data packet delivery, and the number of multicast data packets non-group members must dis- card. The remainder of this paper is organized as fol- lows. Section 2 takes an in-depth look at how AODV provides multicast connectivity for the lifetime of a multicast group, including the creation and maintenance of the multicast tree. Section 3 describes the forwarding mechanism used for the multicast data packets. Then, section 4 describes the simulations performed and examines the results of these simulations to determine how the change in transmission range eects varying aspects of the protocol and the network connectivity. Section 5 describes directions for future work, and - nally section 6 presents the conclusions from this study. 2. The Protocol AODV's multicast operation is based on a route discovery cycle. When a node wishes to either join a multicast group or nd a route to a group, it initiates route discovery by sending a Route Request (RREQ) packet. As nodes join the multicast group, a bidirectional tree is formed from the group members and the nodes connecting those group members (tree routers). There is only one tree per multicast group, and each multicast group has associated with it a multicast group leader. The multicast group leader's sole responsibility is to maintain and disseminate the multicast group sequence number. AODV utilizes sequence numbers to ensure relative freshness of routes, and thereby to prevent routing loops. 2.1. Routing Tables Each node running AODV must potentially maintain two tables related to multicast. If a node is either a member of a multicast group or is a router for such a group, it must maintain a Multicast Route Table (MRT). The MRT is used by nodes to maintain next hop information for the multicast trees. The elds of the MRT are as follows: Multicast Group IP Address Multicast Group Leader IP Address Multicast Group Sequence Number HopCount to Multicast Group Leader Next hops, with the following data per hop: Next Hop IP Address Link Direction Activated Flag There is one entry in the MRT for each multicast group of which the node is either a member or a tree router. Each entry has associated with it a list of one or more next hops, or neighbors on the multicast tree. The next hops eld is a linked list of structures, each of which contains the indicated information. The link direction of a next hop is dened to be up-stream if the link is towards the group leader, and down- Group Leader Next Hops A Figure 1. Sample Multicast Tree. stream if it is away from the group leader. Because of the tree structure, a node should have at most one up-stream link at any time. The Activated ag associated with each next hop is an indication of whether the link has been o-cially added to the multicast tree (see section 2.3.3). When a link is added to the tree, the ag is set, and only after that time can the link be used for receiving multicast data packets. In gure 1, node A's next hops on the multicast tree are enclosed by the dashed line. AODV also maintains a Group Leader Table (GLT) with two elds per entry: Multicast Group IP Address Multicast Group Leader IP Address When a node receives a Group Hello (section 2.2), it updates its GLT to re ect the multicast group/group leader association indicated in the Group Hello message. If the node later wants to join a multicast group, it rst checks its GLT for an entry for that group. If there is such an entry, and if the node has a route to the multi-cast group leader, it may unicast its Route Request to the group leader instead of broadcasting it across the network. This table is used only as an optimization; its elimination does not aect the correct operation of the protocol. 2.2. The Group Leader Each multicast group has associated with it a group leader. When a node wishes to join a multicast group, it broadcasts a RREQ and then waits for a reply. If after some maximum number of attempts (rreq retries does not receive a reply, it may assume that there are no other members of the group in the connected partition of the network. It then becomes the group leader for that multicast group and initializes the sequence number to one. Once it becomes the group leader, it broadcasts a Group Hello (GRPH) message. This message contains the following elds: mgroup seqno > Currently, there are two ags dened. The rst of these is the Update ag. This is set when there is a change in group leader information, as described in section 2.5.1. The second ag is Omtree. When the group leader initiates the GRPH, it leaves this ag un- set. Whenever a node not on the multicast tree receives the message, it sets this ag. This indicates that the GRPH message has traveled o the tree along this path. When a node on the multicast tree receives a GRPH with the Omtree ag unset, it knows that the GRPH has traveled solely on tree links, and so the hop cnt eld can be used to update the node's current distance from the group leader. Otherwise, if a multicast tree node receives the packet with that ag set, it knows it cannot use the hop cnt value as an indicator of its distance from the group leader, because the packet has not traveled only along the tree. The signicance of this message being broadcast instead of multicast across the tree is shown in section 2.5.3. The hop cnt eld is incremented each time the GRPH packet is forwarded. The source addr eld is set to the group leader's IP address, and the mgroup addr and mgroup seqno elds are set to the multicast group IP address and current sequence number, respectively. The group leader increments the group sequence number each time it initiates a new GRPH message. When a node receives the GRPH packet, it records the multicast group IP address and sequence number before rebroadcasting the packet. If it later receives a GRPH with this same multicast group IP ad- dress/sequence number combination, it knows it has already seen this GRPH message and it can discard the packet. If, on the other hand, a node receives a GRPH packet it has not seen before, it updates its GLT to reect the current group/group leader combination. If it is a member of the multicast tree, it also updates the multicast group sequence number. A group leader change occurs when the current group leader either decides to unsubscribe from the group, or when the multicast tree becomes partitioned. These scenarios are described in sections 2.4 and 2.5.2, respectively 2.3. Subscribing to the Multicast Group A route discovery cycle is initiated each time a node would like to nd a route to a multicast group. It may initiate route discovery in order to subscribe to a new group, or because it would like to begin sending to a group of which it is not already a member. The node initiates route discovery by broadcasting a RREQ. It then waits for the reception of a Route Reply (RREP) packet. After the discovery period, the node selects its next hop towards the multicast tree. It activates this link by unicasting this node a Multicast Activation (MACT) message. 2.3.1. Route Requests When a node wishes to subscribe to a multicast group or to nd a route to a group of which it is not already a member, it initiates route discovery by broadcasting a RREQ. The RREQ has the following structure broadcast ID; dest addr; dest seqno; source addr; source seqno > The currently dened ags are Join and Repair. Join is set when the node wishes to join the group, as opposed to just nd a route to the group. The Repair ag is set when the RREQ is sent to repair the multicast tree (section 2.5.3). The dest addr eld is the IP address of the desired multicast group, and the dest seqno is the source's record of the last known sequence number of the multicast group. Processing for the other RREQ elds follows the unicast algorithms as specied in [12] and reported in [11]. When a node receives the RREQ, it notes the node from which the RREQ arrived, and creates a next hop entry in its MRT for that previous hop. The Activated ag for that next hop is false. The node then determines whether it can send a RREP by the method described in section 2.3.2. If it cannot send a RREP, it rebroadcasts the request to its neighbors. To reduce the impact of route discovery, the RREQ may be sent in an expanding ring search [12] for the destination. Figure 2(a) illustrates the propagation of a join RREQ throughout the network. In this gure, as well as in the multicast gures in the following sections, multicast group members are represented by shaded cir- cles, and tree routers are represented by circles with the letter 'R'. Group Leader R R (a) RREQ Propagation Group Leader R R (b) RREPs Returned to Source Group Leader R R R (c) Multicast Tree Branch Addition Figure 2. Multicast Group Join. 2.3.2. Route Replies If the RREQ is not a join request, any node with a current route to the multicast group can respond by sending a RREP. A current route is a route to the multicast group whose associated sequence number is no less than the dest seqno of the RREQ. On the other hand, if the RREQ is a join RREQ, only a node that is a member of the multicast tree may respond to the RREQ. Since a RREP in response to a join request sets up a potential branch addition to the multicast tree, only members of the multicast tree are allowed to initiate this RREP. In either case, if the node determines it can respond to the RREQ, it creates a RREP and unicasts the RREP to the source node. RREP contains the following parameters: prefix size; hop cnt; dest addr; dest seqno; source addr; lifetime > The only ag currently dened for the RREP is Re- pair. This ag is set when the RREP is in response to a repair request (section 2.5.1). The prex size eld is utilized for subnet routing, as discussed in [12]. If the node generating the RREP is a member of the multicast tree, the hop cnt eld is initialized to zero. Otherwise, it is set to the responding node's distance from the multi-cast tree. This eld is incremented each time the RREP is forwarded, so that when the source node receives the RREP it indicates the source's distance from the multi-cast tree. The dest addr is set to the multicast group's IP address, and the dest seqno is set to the responding node's record of the group's sequence number. The source addr is the address of the node that originated the request. The lifetime eld is used when the request is not a join request. It is set to the responding node's current lifetime for the multicast group route entry. For nodes on the multicast tree, the multicast group entry itself does not time out, and hence does not have a life-time associated with it. Only the individual next hop links may time out. If the RREQ was a join request, the RREP also contains an extension called the Multicast Group Information Extension. This extension contains the multi-cast group leader IP address and another hopcount eld called mgroup hcnt. This hopcount is set equal to the responding node's distance from the group leader. It is incremented each time the packet is forwarded, so that when the subscribing node (i.e., the node that sent the RREQ) receives the RREP, it indicates that node's distance from the group leader. When a node receives a RREP, it stores the IP address of the node from which it received this packet. It also adds a next hop entry for the previous node to its multicast route table entry, and leaves the Activate ag associated with this next hop unset. The node then forwards the RREP towards the source. If an intermediate node later receives another RREP for the same subscribing node and multicast destination pair, it only forwards the new RREP if that RREP oers a better route than was previously known. A better route is one with either a greater destination sequence number or the same destination sequence number but a smaller hopcount to the multicast tree. Figure 2(b) shows the path of the RREPs sent back to the subscribing node. After transmitting the RREQ, the subscribing node waits the discovery period (route discovery timeout) before selecting a route. During this period, it keeps track of the best route (greatest sequence number and smallest hopcount) to the multicast tree. At the end of the discovery period, the subscribing node selects its next hop and activates that next hop, as described in the next section. 2.3.3. Multicast Activation Once the discovery period has ended and the subscribing node has chosen its next hop, it activates this entry in its MRT by setting the Activated ag associated with that next hop. It then creates a Multicast Activation (MACT) message, and unicasts this message to its selected next hop. The MACT message contains the following elds: source seqno > The currently dened ags for the MACT message are Join, Prune, Grpldr, and Update. The Join ag is set when the node is joining the multicast tree, while the Prune ag is used by a node when it wishes to prune itself from the tree (section 2.4). The Grpldr ag is used after a network partition when a new group leader must be selected (section 2.5.2), and the Update eld is used after a tree branch repair (section 2.5.1). The hop cnt eld is primarily used after a tree repair (section 2.5.1). For link activation, this eld is set to one. The mgroup addr eld is set to the IP address of the multicast group, and the source addr and source seqno elds are set to the IP address and current sequence number of the node initiating the MACT, respectively When the next hop receives the MACT message, it activates the next hop entry for the sending node in its MRT. If this next hop was already a member of the multicast tree, the addition of the new branch to the tree is completed. Otherwise, if this next hop was not already a member of the multicast tree, then, like the subscribing node, it will also have been keeping track of the best next hop to the multicast tree. It activates this next hop in its MRT, and then unicasts a MACT message to this next hop. Processing continues in this manner until an existing member of the multicast tree is reached. Figure 2(c) shows the multicast tree after the join is completed. 2.4. Unsubscribing From the Multicast Group Multicast group membership is dynamic; nodes can subscribe to or unsubscribe from a multicast group at any time. A node prunes itself from the multicast tree using a variation of the MACT message. A multicast group member may unsubscribe from a multicast group of which it is a member at any time. However, it may only exit the multicast tree if it is a leaf node. If a non-leaf node attempted to exit the tree, the tree would then become partitioned. Hence, a non-leaf node that wishes to unsubscribe from the multicast group may change its member status internally, but it takes no overt action to notify any of the other tree members. A leaf node unsubscribes from the multicast group by pruning itself from the multicast tree. It does this by rst deleting the entry for that multicast group from its MRT, and then creating a MACT message with a set Prune ag. It then unicasts this message to its next hop. When the next hop receives the prune message, it deletes the sending node's information from its MRT entry for that multicast group. If, due to the pruning of the sending node, the receiving node is now a leaf node, and if this node is not a multicast group member (only a tree router), it can in turn prune itself from the tree in the previously described manner. Otherwise, if it is not a leaf node, or if it is a member of the multicast group, then pruning ends at this node. Figure 3 illustrates a pruning operation. In g- ure 3(a), node A is a multicast group member that wishes to unsubscribe from the group. Since it is a leaf node, it should also prune itself from the tree. It creates the MACT prune message and unicasts this message to its next hop, node B. When node B receives the mes- sage, it deletes node A from its next hop entries, and then notes that it is now a leaf node. Since it is a tree router and not a group member, it then prunes itself from the tree as well. Figure 3(b) illustrates the multi-cast tree after pruning. When the group leader decides to unsubscribe the group, it operates in a similar manner. If it is a leaf node, it may prune itself from the tree. Otherwise, it must remain a router for the tree. If it is a leaf node, it sends the prune message to its next hop and deletes the multicast group information from its MRT. When the next hop receives the prune message, it is handled as described in section 2.5.2. Oth- erwise, if the group leader is not a leaf node, it selects one of its next hops and sends this node a MACT mes- (a) Pruning of Multicast Group Member R R (b) Multicast Tree After Prune Figure 3. Unsubscribing from the Multicast Group. sage with set Grpldr ag, as is also described in section 2.5.2. 2.5. Multicast Tree Maintenance Because the network nodes are mobile, links between nodes are likely to break. A multicast tree is maintained for the lifetime of the multicast group. Hence, there must be a way of maintaining the tree after topological changes in the network. Multicast tree maintenance generally falls into one of three broad categories: (i) link break and repair; (ii) link break and subsequent network partition; and (iii) tree merge after a network partition. 2.5.1. Repairing Link Breaks Nodes determine that a link has broken in the same way as described in [11], whether or not the link is part of the multicast tree. If the multicast tree has recently been used to send data packets, then a node on the tree must hear each of its next hops (except the node from which the packet was received) retransmit a data packet within retransmit time, generally three times the propagation delay through a node. Because IP is a \best ef- fort" network-layer protocol, a multicasting node does not need to hear each of its next hops retransmit each packet; it just must hear each next hop transmit something within that time frame. This special retransmit time is used because waiting the full hello life time period to detect a broken multicast tree link would often result in a large number of lost packets. When a link break on the multicast tree occurs, the node downstream of the break is responsible for repairing the link. A node knows it is downstream of the break because it knows the direction of each of its next hops in relation to the multicast group leader. Only the down-stream node should initiate the repair; if nodes on both sides of the break tried to repair the link, they might repair the link through dierent intermediate nodes, thus forming a loop. The downstream node initiates the repair by broadcasting a RREQ with the Join ag set and with a special extension included. This extension, called the Multicast Group Leader Extension, contains a mgroup hcnt eld, which is set equal to the node's current distance from the multicast group leader. In gure 4(a), the downstream node sets this eld equal to two, since it is two hops away from the group leader. When this extension is included, only nodes that are no farther from the group leader can respond. This prevents nodes on the same side of the break as the downstream node from responding to the RREQ, which would form a loop. Because the two nodes are likely to still be close by, the downstream node can set the initial value of the RREQ to be small, thereby allowing for a local repair and preventing the RREQ from being broadcast across the entire network. Because the RREQ has the Join ag set, only a node on the multicast tree can respond. When such a node receives the RREQ with this extension eld, it checks whether it is at least as close to the group leader as indicated by the mgroup hcnt eld. If so, and if its record of the group sequence number is at least as great as that contained in the RREQ, it can reply to the RREQ by unicasting a RREP back to the initiating node. RREP forwarding and subsequent route activation with the MACT message are handled as previously described. Figure 4(b) illustrates the multicast tree after the repair is completed. E. Royer, C. Perkins / Transmission Range Eects on AODV Multicast Communication R R R Group Leader Downstream Node (a) Link Break R R Group Leader (b) Repaired Multicast Tree Figure 4. Repair of Multicast Tree Branch. Once the repair is nished, it is possible that the node which initiated the repair is now a new distance from the group leader. If this is the case, it must inform it down-stream next hops of their new distance from the group leader. The node creates a MACT message, sets the Up- date ag, and sets the hop cnt eld equal to its distance from the group leader. It then multicasts this message to the multicast group. When the downstream nodes receive this message, they increment the hop cnt value and then update their current distance from the group leader. If they are not leaf nodes, they in turn send this update message to their downstream next hops, and so on. Because the MACT is multicast, the node that is upstream of the multicasting node also receives the mes- sage. In this case, it notes that the packet came from its downstream link, and discards the message. When a link break occurs, the node upstream of the break also notices the disconnection. It is possible that the tree branch will not be reconnected through that node. If this upstream node is not a group member, and if the loss of that link has made that node a leaf node, it sets a prune timer to wait for the repair. This prune timer should be longer than the route discovery period in order to allow time for the repair to be com- pleted. The new leaf node may prune itself after the timer expires, if the next hop does not reactivate it (by sending it a MACT message). 2.5.2. Network Partitions If a node attempting to repair a broken tree link does not receive a RREP within the discovery period, it re-broadcasts its RREQ up to rreq retries more times, using the same expanding ring search as indicated in section 2.3.1. If no response is received after this many attempts, the node must assume that the network has become partitioned and that the multicast tree cannot yet be repaired. If this is the case, the multicast tree partition that was downstream of the break is now left without a group leader. If the node that was trying to repair the break is a multicast group member, then it becomes the new group leader. It broadcasts a GRPH message to announce the group leader change, and sets the Update ag in this message to indicate that the change has occurred. If the node that was trying to repair the break is not a multicast group member, there are two possibilities. The rst is that this node has only one downstream link. If this is the case, then the link loss has made this node a leaf on the tree, and so it can prune itself from the tree. It unicasts its next hop a prune message, and then deletes all the group information from its MRT. When the next hop receives the prune message, it deletes the sending node's next hop information from its MRT, and notes that the message came from its upstream link. It is then in the same position as the previous node. If it is a group member, it becomes the new group leader. Oth- erwise, if it has only one downstream next hop link, it prunes itself from the tree along this link. This process continues until a multicast group member is reached. This node becomes the new group leader. The second possibility is that the node that was trying to repair the link has multiple downstream branches. In this case, it cannot prune itself from the tree, because doing so would disconnect the tree. It instead selects any one of its downstream links, and unicasts that next hop a MACT message with set Grpldr ag. This ag indicates that the next group member to receive this message should become the new group leader. After unicasting this message, it changes the direction associated with this next hop in its MRT so that the direction R R Group Leader 1 Group Leader 2 Network Partition (a) Partitioned Network before the Repair R R R Group Leader (b) Reconnected Network Figure 5. Merge of Two Components of Multicast Tree. is now upstream. If the next hop to receive the MACT is a group member, it becomes the new group leader. Oth- erwise, it in turn chooses one of its downstream links, and sends that next hop the MACT message with set Grpldr ag. It also updates the direction associated with that next hop to be upstream. This process ends once a multicast group member is reached. Once the new group leader is determined, it broadcasts a GRPH message with set Update ag and incremented group sequence number to announce its new status as group leader. 2.5.3. Merging Two Disjoint Trees Once a network partition has occurred, there are two group leaders for the same multicast group, each of which periodically broadcasts a GRPH message. If the two network partitions come back into contact with each other, group members learn of this occurrence through the reception of a GRPH message that has information about a new group leader. The two partitions of the multicast tree must then be reconnected. The only node which can initiate the repair of the tree is the multicast group leader with the lower IP address. This distinction is made because if more than one node tried to repair the tree, it is likely that it would be repaired through dierent intermediate nodes, and thus form a loop. When the group leader with the lower IP address receives the GRPH, it creates a RREQ with set Join and Repair ags and unicasts this message to the other group leader (GL 2 ), using the node from which it received the GRPH as the next hop. As the RREQ travels to GL 2 , nodes process the packet as they would a regular RREQ with the following exception. If a node that is a member of GL 2 's tree receives the RREQ, it forwards the RREQ to GL 2 along its upstream multi-cast tree link. This prevents the formation of routing loops once the RREP is sent. When GL 2 receives the RREQ, it notes the set Re- ag, and creates a RREP to send back to GL 1 . It sets the Repair ag of this RREP, and then unicasts the RREP back to GL 1 . It also updates the multicast group sequence number by taking the larger of its record of the group sequence number and that contained in the RREQ, and incrementing this value by one. The next time GL 2 broadcasts a GRPH message, it includes this new sequence number value, and sets the Update ag to indicate a group leader change has occurred. As the RREP travels back to GL 1 , nodes that receive the RREP create the next hop entries and activate these entries immediately. Because the RREQ was unicast, there is only one potential tree branch being added to the tree, and so a MACT message does not need to be sent. Hence the next hop entry can be activated without delay. If a node that is on the multicast tree of GL 1 receives the RREP message, it updates its group leader information for that multicast group to re ect GL 2 as the new group leader. This node forwards the RREP along its upstream tree link towards GL 1 to prevent routing loops. It then changes the direction of that link to downstream, and marks the link from which the packet arrived as upstream. This link direction change occurs because the new group leader is in a dierent direction than the previous one. Once GL 1 receives the RREP, it notes that it is no longer the group leader, makes the link addition or direction change, and the tree merge is complete. Figure 5 shows an example of a tree repaired in this manner. 3. Data Packet Forwarding Data packets destined for the multicast group are transmitted as broadcast tra-c, unless there is support for multicast at layer 2. When a node receives a multicast data packet, it checks whether it is a part of the multicast tree for that multicast group. If not, it discards the packet. If it is a member of the multicast tree, it then determines whether it has already received that packet. Nodes on the multicast tree keep a record of the source IP address, fragment id, and fragment oset of the multicast data packets they receive. If this source IP address/fragment id/oset combination is already represented in their records, they discard the packet. Otherwise, they create a new entry to represent the packet. In this way, if the node later receives the same data packet transmitted by another next hop, it knows not to reprocess the packet. If the node has not already received the data packet, the node processes the packet if it is a member of the multicast group to which the packet is addressed. Then, if the node is on the multicast tree for that group, it forwards (by broadcast or multicast) the packet to its next hops. 4. Simulations The transmission range R xmit is a key parameter in the interconnection pattern of a network. Its value affects a wide range of results, including: the neighbor degree of network nodes, the throughput, the probability of collision, the contention for channel access, battery lifetime of the transmitting node, average number of hops, and thus the delay, for message transmission, and the impact of transmissions on neighboring nodes. In the following simulations, the eect of the transmission range is studied on dierent network topologies. To investigate the eect of the transmission range on the AODV multicast protocol, a variety of results are examined. First, the packet delivery ratio is calculated by taking the number of data packets received, divided by the number of data packets transmitted. Control packets are not counted for the purposes of this calcu- lation. The packet delivery ratio is a key indicator of how well the protocol performs under the given condi- tions. Since each data packet must be received by every member of the multicast group, the packet delivery ratio is then divided by the number of group members to yield the normalized overall packet delivery ratio. To understand the packet delivery ratio results, various other results are examined. The average distance from a multicast group member to the group leader is directly aected by the transmission range. When transmissions have relatively small range, the path length to the multicast group leader is much longer. Longer path lengths lead to a higher probability of a packet collision before the packet reaches its destina- tion, and also a higher probability of tree link breaks. Both of these events result in a lower packet delivery ratio. Since the amount of control message overhead is directly related to the number of breaks in the multicast tree, a shorter transmission radius is likely to result in a greater amount of control tra-c. A large transmission radius increases the average number of neighbors per node. This leads to shorter path lengths to reach multicast group members, but a greater number of nodes receive each data packet broad- cast. Consequently, there is an increase in battery utilization at individual nodes, as well as an increase in the likelihood of data packet collisions. 4.1. Simulation Environment The simulations were performed using the GloMoSim Network Simulator developed at UCLA [1]. This simulator models the OSI network architecture and includes models for IP and UDP. The simulator also allows for network node mobility, thereby enabling simulation of mobile ad hoc networks. The MAC layer protocol used in the simulations is the IEEE standard 802.11 Distributed Coordination Function (DCF) [4]. This standard uses Request-To- Send (RTS) and Clear-To-Send (CTS) control packets for unicast data transmissions between neighboring nodes. A node wishing to unicast a data packet to its neighbor broadcasts a short RTS control packet. When its neighbor receives the packet, it responds with a CTS packet. Once the node receives the CTS, it transmits the data packet. After receiving this data packet, the neighbor then sends an acknowledgment (ACK) to the sender of the data packet, signifying reception of the packet. The use of the RTS-CTS Parameter Name Meaning Value allowed hello loss # of Allowed Hello Losses 2 group hello interval Frequency of Group Hello Broadcasts 5 sec hello interval Frequency of Hello or Other Broadcasts 1 sec hello life Maximum Time Allowed Between Hello Pkt Receptions 3 sec pkt id save Time to Buer Data Packet prune timeout Time to Wait to Receive a MACT before Prune 3 sec retransmit time Time to Wait for Data Packet Retransmissions 750 msec route life Time to Keep Reverse Route Entries 3 sec rreq retries Max # of RREQ Retransmissions 2 route discovery timeout Max Time to Wait for a RREP 1 sec Table Simulated Parameter Values. control packets reduces the potential for the hidden- terminal problem [17]. Broadcast data packets and RTS control packets are sent using the unslotted Carrier Sense Multiple Access protocol with Collision Avoidance (CSMA/CA) [4]. When a node wishes to broadcast a packet, it rst senses the channel. If it does not detect an on-going transmission, it sets a short timer and then re-senses the channel once the timer expires. If the channel is still idle, it broadcasts its packet. On the other hand, if it does detect a transmission, it calculates a backo time and then waits this amount of time before reattempting the transmission. The bandwidth for the simulations is 2 Mb/sec. The propagation model used is the free space model [14] with threshold cuto included in the GloMoSim simulation package. The free space model has a power signal attenuation of 1=d 2 , where d is the distance between nodes. The radio model used also has capture capability, where it can lock on to a strong signal during interference, and still receive the packet. Other interfering packets with weaker signal strength are dropped. Node movement is modeled by the random direction mobility model [15]. In this model, nodes are initially placed randomly within the network simulation area. Each node chooses a random direction between 0 and 360 degrees, and then selects a destination on the border of the network area in that direction of travel. The node then moves to that destination at its pre-assigned speed (between 0 and 5 m/s). When the node reaches its destination, it rests for seconds. It then chooses a new direction, this time between 0 and 180 degrees. The degree selected is adjusted relative to the boundary on which the node is located. The node then resumes movement. Except for the 0 m/s mobility scenario, this movement model causes continual changes in the net-work topology. Each simulation simulates 300 seconds and models a network of 50 nodes. During each simulation, there is one multicast group which contains ten members. Nodes join the multicast group at the beginning of the simulation. Once all the nodes have joined the group and the tree is formed, data transmission begins. Data packets are sent by one of the group members at a constant rate of eight packets per second throughout the duration of the simulation. Each data packet is 64 bytes. When a node receives a multicast data packet and is a member of that multicast group, it sends the packet to the application layer for processing and increments its count of the number of data packets it has received. It then rebroadcasts the packet. If the node is not a member of the multicast group but is on the multicast tree, it simply rebroadcasts the packet to allow reception of the packet by its next hops. In order to achieve 100% packet delivery, every member of the multicast group must receive the data packet. No layer 2 support for multicast is assumed. AODV does not guarantee packet delivery; however, it does nd good routes for IP's best-eort delivery. Because data packets are not buered for retransmis- sion, losses can occur. If a collision involving a data packet occurs at a node and the packet cannot be cap- tured, the packet is lost. Typically, if a link break occurs on the multicast tree, data packets are lost before that break is noticed and while the link is being repaired. Hence, it is essential to take steps to monitor multi-cast tree links and provide for immediate repair so that link breaks result in minimum packet loss. Unfortu- )Packet Delivery 200m 300m 400m 500m (a) 1000m1000m Network Packet Delivery 200m 300m 400m 500m (b) 1500m300m Network Figure 6. Packet Delivery Ratio. Speed (m/s) Hops 200m 300m 400m 500m (a) 1000m1000m Network Speed (m/s) Hops 200m 300m 400m 500m (b) 1500m300m Network Figure 7. Average Number of Hops to Multicast Group Leader. nately, because multicast data packets are broadcast, MAC layer feedback provides no notication of broken links. For this reason, AODV provides a method of monitoring these active links, as described in section 2.5.1. Table 1 shows the essential parameter values for these simulations. Note that the expanding ring search was not used in the simulations. There are two dierent network roaming areas simu- lated. The rst is a 1000m1000m area, and the second is a 1500m300m area. These two size areas have been used in several other ad hoc network simulations [2,3,8]. They are modeled here to determine the eect of transmission range in them. In order to explore the eects of transmission range, seven dierent ranges, from 200m to 500m, are studied. Shorter than 200m, network connectivity is too sparse for an accurate comparison, as network partitions oc- cur. The results of the 450m and 500m simulations are similar enough to be able to extrapolate the eects of further increasing the transmission range. Each transmission radius/speed combination was run for ten different initial network congurations. 4.2. Results First, consider the achieved packet delivery ratio. Figure 6(a) shows the results in the 1000m1000m area for the seven dierent transmission ranges mod- eled, and illustrates how the packet delivery ratio is affected by the changing speed of the network nodes. Figure 6(b) shows the same results for the 1500m300m simulations. For both network congurations, an increase in range yields an increase in the packet delivery ratio, or the number of data packets received by multicast group members. For the 1000m1000m net- work, the increase in speed results in a decrease in the packet delivery ratio for the more sparsely connected networks. In the 1500m300m network, the increase in speed has a smaller eect on the overall packet delivery Repairs 200m 300m 400m 500m (a) 1000m1000m Network Repairs 200m 300m 400m 500m (b) 1500m300m Network Figure 8. Multicast Tree Repairs. Speed (m/s) Packets 200m 300m 400m 500m (a) 1000m1000m Network Speed (m/s) Packets 200m 300m 400m 500m (b) 1500m300m Network Figure 9. Control Packet Overhead. To understand why the packet delivery ratio is affected by the transmission range, it is necessary to investigate how the transmission range aects other aspects of the network. Figures 7(a) and 7(b) illustrate the eect of the transmission range on the average distance of a multicast group member to its group leader. The distance to the group leader gives an indication of the size of the tree and how many hops data packets must traverse between destinations. The gures indicate that for smaller transmission ranges, the average number of hops to the group leader is greater. A larger distance to the group leader results in greater potential for packet collisions, as well as a higher chance of link breaks. Thus, a greater transmission range results in fewer hops on the multicast tree, which produces a better packet delivery ratio. It is interesting to note that there is not a notable dierence in results between the two network sizes. Because the average path length to the group leader is inversely proportional to the transmission radius, the number of repairs to the multicast tree is also likely to be inversely proportional. This is veried in gures 8(a) and 8(b). These gures show the average number of repairs needed to x broken multicast tree links during the simulation. As expected, the number of repairs increases for increasing speed. Also as expected, the greatest transmission range requires the fewest number of repairs, again resulting in a better packet delivery ratio for these networks. The amount of control overhead generated during the simulation directly corresponds to the number of repairs to the multicast tree. Figures 9(a) and 9(b) show the number of control packets produced during each of the simulations. The number of control packets represented here is found by summing the number of RREQ, RREP, MACT, and GRPH packets initiated. The g- ures show a reduction in the number of control messages as the transmission range is increased. For zero mobility, there are no repairs needed to the multicast tree. Figures 9(a) and 9(b) indicate that the number of control messages needed to initialize the multicast tree is approximately constant at the dierent trans- )Neighbors 200m 300m 400m 500m (a) 1000m1000m Network Neighbors 200m 300m 400m 500m (b) 1500m300m Network Figure 10. Average Number of Neighbors. Speed (m/s) Collisions 200m 300m 400m 500m (a) 1000m1000m Network Speed (m/s) Collisions 200m 300m 400m 500m (b) 1500m300m Network Figure 11. Collisions. mission ranges. The variation in control overhead becomes more signicant once the nodes begin moving. As nodes travel more quickly, there are more breaks and repairs to the multicast tree, and hence there are more control packets generated. Because there are fewer link breaks for the longer transmission ranges, there are subsequently fewer control packets generated in these simulations as well. The 200m transmission range in the 1000m1000m network particularly suers from the increase in mobility. The network topology and low connectivity in this network conguration often result in multiple attempts per repair to re-establish tree link connections. Having examined only these results, it appears that increasing the transmission radius has a uniformly positive eect on the network. A larger transmission radius results in better packet delivery ratio, fewer link breaks in the multicast tree, and less control overhead. How- ever, it is also necessary to examine the impact that increasing the neighborhood size has on the network. Increasing the transmission range also increases the number of neighboring nodes aected by each transmission. Figures 10(a) and 10(b) indicate the number of neighbors per node at the varying transmission ranges. For the purpose of the gure, two nodes are considered to be neighbors if the distance between them is less than or equal to the given transmission radius. As would be expected, the number of neighbors per node increases with increasing transmission range. One of the primary eects of increasing the size of the neighborhood is the increase in the number of packet collisions. Figures 11(a) and 11(b) illustrate the total number of packet collisions in the networks. The gures show that the number of collisions rapidly increases as the transmission range grows. The number of collisions with 450m and 500m transmission ranges is nearly ve times that of the 200m transmission range network. To further explore the eect of the dierent neighborhood sizes, the number of multicast data packets received at nodes which are not group members is examined in gures 12(a) and 12(b). At a packet transmission frequency of eight packets per second and simulation length of 300 seconds, just under 2200 data packets Figure 12. Multicast Data Packets Received By Non-Group Members. Speed (m/s) Packet Delivery 200m 300m 400m 500m (a) 1000m1000m Network Speed (m/s) Packet Delivery 200m 300m 400m 500m (b) 1500m300m Network Figure 13. Packet Delivery Ratio for Increased Data Rate. are initiated during the simulation. The gures indicate that for a transmission radius of only 200m, non-group member nodes receive, on average, each multicast data packet approximately twice. However, for the highest mobility and transmission radius combination, nodes receive each data packet approximately six times. Such a redundancy in packet reception is likely to have quite a negative eect on a node's battery lifetime, as the node will spend a large percentage of its battery power processing unnecessary packets. The higher nodal density engenders additional contention for slotted MAC schemes. This causes more collisions during the contention period, resulting in increased queuing delays as nodes are forced to wait longer periods of time between packet transmissions. The results presented so far are based on one source with a moderate sending rate (eight packets per sec- ond). To determine the interaction between transmission range and network tra-c, a second set of experiments was performed with the number of sources increased to two and with each source sending 20 packets per second. The data packet size in these simulations is 512 bytes, as opposed to the 64 byte packets in the previous experiments. The packet delivery ratio for this set of experiments is shown in gure 13. The results here dier from the packet delivery ratio for the lower sending rate, shown in gure 6. Here, it is no longer the case that the longest transmission range produces the greatest packet delivery ratio. The nodes in these networks are not able to deliver as many data packets due to the increased contention for channel access and the increased likelihood of collisions. The transmission range of 400m in the 1000m1000m networks and 400-450m in the 1500m300m network results in more delivered data packets than does the 500m transmission range. The ranges of 200m and 250m still produce the lowest packet delivery ratio due to the lower connectivity in these networks The control packet overhead for the increased data rate is given in gure 14. These graphs do not vary signicantly from the results shown in gure 9. The Figure 14. Control Packet Overhead for Increased Data Rate. Speed (m/s) Collisions 200m 300m 400m 500m (a) 1000m1000m Network Collisions Speed (m/s) 200m 300m 400m 500m (b) 1500m300m Network Figure 15. Number of Collisions for Increased Data Rate. control tra-c in the 200 and 250m networks still dominates in both network sizes. Finally, the number of collisions is shown in gure 15. Here, the results vary slightly from those in gure 11 for the large transmission range. Except for the static net- works, the number of collisions is greatest in the 450m transmission range scenarios. 5. Future Work Our work on multicast can be extended in many di- rections. We would like to investigate larger node pop- ulations, higher rates of mobility, and the eects of different parameter settings. We would also like to investigate algorithms for tunable power control. It is possible that certain broadcast multicast transmissions should be replaced by unicast (tunneled multicast) to the appropriate neighbors in the multicast tree. We would like to make the relevant comparisons and use the results for possible revisions to the way that multicast datagrams are handled. This information could be incorporated into the AODV protocol operation for multicast routing. Other multicast algorithms for ad hoc networks have been proposed [6,7,9]. We would like to compare the power consumption vs. packet delivery ratio observed for AODV against the performance of the other algo- rithms. Feeney [5] has already made similar measurements for unicast algorithms, and her techniques should be easily adaptable to provide the necessary comparison data for multicast algorithms. Power control represents an interesting area of re-search because the power level used at a mobile node has the eect of dynamically creating or destroying links. This dynamic link control can happen even without any node movement. Thus, there are two interacting mechanisms for changing the topology of the network. It seems likely that, at certain times, a mobile node should be able to benecially reduce its power consumption if it has numerous links to nodes in its neighborhood. In this way, it would be able to conserve power. Alternatively, when the node has few other nodes in its neighborhood and has a large percentage of its battery power remain- ing, it might be useful for it to increase its transmission range so that better network connectivity may be es- tablished. Ramanathan and Rosales-Hain have made steps towards this goal by developing a mechanism for dynamically adjusting the transmitter power at individual nodes in order to optimize the overall network topology [13]. Their scheme is able to adapt depending on the connectivity or bi-connectivity constraints. The cases where battery power is diminished but more network connectivity is needed are not handled so easily. It is possible that AODV would benet from acquiring information about neighborhoods once removed. Such information may be useful for power control algorithms. A more ambitious approach would be an attempt to nd global information about links that may become useful to unreachable nodes. Perhaps exploratory, high-power probes should be transmitted occasionally, to get rst-hand information about how the local neighborhood connectivity could be improved by the use of higher power for data transmissions. 6. Summary and Conclusions In this paper, we have presented the AODV multicast routing algorithm, and have shown the eects of various transmission ranges and mobility rates on packet delivery and the number of repairs needed for maintenance of the multicast delivery tree. AODV handles the transmission of multicast and broadcast data in a natural way, maintaining compatibility with traditional IP route table mechanisms and the needs of unicast packet routing. The AODV routing protocol is able to provide multicast communication between group members in a variety of network congurations and mobility scenar- ios. By building bi-directional multicast trees between group members, AODV quickly connects group mem- bers, and is able to maintain these connections through-out the lifetime of the multicast group. AODV's multicast routing algorithm is a straightforward extension to the algorithm used to discover unicast routes. The basic broadcast RREQ discovery mecha- nism, with unicast RREP messages, is adapted for use with multicast routing. Since the multicast IP address is not allocated to any specic network node, the responsibility for maintaining the sequence number for multicast routes has to be assigned to a distinguished node called the group leader. Aside from this, the main dierence introduced by multicast routing is the need for maintaining multiple next hops per multicast route entry instead of just one next hop, as is the case for unicast routing. Having multiple next hops also creates new opportunities for route loops; however, this possibility is eliminated through the use of a new message type called the Multicast Activation (MACT) message. This message enables just one of several possible multicast tree paths; since only one path is enabled, route loops remain impossible even for multicast routing. The transmission range and network size are key determinants of AODV's multicast performance. Increasing the transmission range has many benets. The number of links on the multicast tree is reduced, resulting in fewer tree links which need to be maintained. Each multicast tree link repair requires control message overhead. Reducing the number of repairs has the advantage of also decreasing the amount of control overhead. For unloaded networks, the packet delivery ratio increases for longer transmission ranges due to the reduction in the number of hops between group members and the longer-lived tree links. Despite these advantages, a large transmission range also causes more network nodes to be aected by multicast data transmissions, even when the nodes do not need to receive these packets. A large transmission radius therefore drains the battery not only of the transmitting node, but also of neighboring nodes within the source's transmission range. Worse, a large transmission radius reduces the eective bandwidth available to the individual nodes and increases the number of collisions seen throughout the network, as more nodes are competing for and utilizing the same network band- width. This increase in the number of collisions causes a reduction in the packet delivery ratio for tra-c patterns that signicantly load the wireless medium. Perhaps most signicantly, increasing the transmission range places disproportionately greater demands on the power requirements of the (typically battery-powered) mobile nodes. Thus, it is crucial for the consumer market to nd ways to minimize power consumption. We hope that this exploratory work on the relationship between transmission ranges and multicast routing performance will lead the way towards improving the reliability of best-eort multicast packet delivery. We conclude that the transmission range should be adjusted to meet the targeted throughput while minimizing battery power consumption. Our work shows that there are opportunities for power savings when nodes can get the same (or even better) performance by reducing the power drain caused by unnecessarily high transmission ranges. --R GlomoSim: A Scalable Network Simulation Envi- ronment A Performance Comparison of Multi-Hop Wireless Ad Hoc Network Routing Protocols Performance Comparison of Two On-demand Routing Protocols for Ad Hoc Networks Access Control (MAC) and Physical Layer (PHY) Speci An Energy Consumption Model of Performance Analysis of Routing Protocols for Mobile Ad Hoc Networks. A Lightweight Adaptive Multicast Algorithm. A Highly Adaptive Distributed Routing Algorithm for Mobile Wireless Networks. Ad hoc On-Demand Distance Vector (AODV) Routing Topology Control of Multihop Wireless Networks using Transmit Power Adjust- ment Communications An Analysis of the Optimum Node Density for Ad hoc Mobile Networks. Multicast Operation of the Ad-hoc On-Demand Distance Vector Routing Protocol Packet Switching in Radio Channels: Part-II - The Hidden Terminal Problem in Carrier Sense MultipleAccess Models and the BusyTone Solution --TR A performance comparison of multi-hop wireless ad hoc network routing protocols Scenario-based performance analysis of routing protocols for mobile ad-hoc networks Multicast operation of the ad-hoc on-demand distance vector routing protocol An energy consumption model for performance analysis of routing protocols for mobile ad hoc networks Communications Ad-hoc On-Demand Distance Vector Routing A Highly Adaptive Distributed Routing Algorithm for Mobile Wireless Networks --CTR L. Lloyd , Rui Liu , Madhav V. Marathe , Ram Ramanathan , S. S. Ravi, Algorithmic aspects of topology control problems for ad hoc networks, Proceedings of the 3rd ACM international symposium on Mobile ad hoc networking & computing, June 09-11, 2002, Lausanne, Switzerland L. Lloyd , Rui Liu , Madhav V. Marathe , Ram Ramanathan , S. S. Ravi, Algorithmic aspects of topology control problems for ad hoc networks, Mobile Networks and Applications, v.10 n.1-2, p.19-34, February 2005
ad hoc networks;mobile networking;multicast;wireless networks
603342
High-level Language Support for User-defined Reductions.
The optimized handling of reductions on parallel supercomputers or clusters of workstations is critical to high performance because reductions are common in scientific codes and a potential source of bottlenecks. Yet in many high-level languages, a mechanism for writing efficient reductions remains surprisingly absent. Further, when such mechanisms do exist, they often do not provide the flexibility a programmer needs to achieve a desirable level of performance. In this paper, we present a new language construct for arbitrary reductions that lets a programmer achieve a level of performance equal to that achievable with the highly flexible, but low-level combination of Fortran and MPI. We have implemented this construct in the ZPL language and evaluate it in the context of the initialization of the NAS MG benchmark. We show a 45 times speedup over the same code written in ZPL without this construct. In addition, performance on a large number of processors surpasses that achieved in the NAS implementation showing that our mechanism provides programmers with the needed flexibility.
Introduction Reductions require careful compilation for two reasons. First, they abound in scientic codes. For example, they are used in algorithms for image processing and for computational geometry, in kernels for matrix multiplication and for sorting, and to test for convergence in iterative algorithms. Often a test for convergence is repeated at frequent intervals throughout the program. Second, performance, often whole program performance, suffers if a reduction is poorly optimized or left unoptimized. An unoptimized reduction is sequential or a source of signicant unnecessary communication. Reductions are non-trivial to parallelize; there are dependences between loop iterations that can only be violated if it is known that an operation or function is associative. A reduction is a mapping from an array of n dimensions to an array of less than n dimensions or a scalar. In this mapping, collisions (two or more array elements mapping to the same part of the result) must occur because the result is necessarily smaller than the original array. To resolve these collisions, elements mapping to the same location are combined with an operator that is almost always binary. Moreover, this binary operator is usually associative and commutative. If the operator is associative, the parallel-prex method [11] can be used to parallelize the reduction. If the operator is commutative, the computation might be further optimizeable on some parallel computers. It is essential to take advantage of associativity when compiling for a parallel computer. Otherwise potential parallelism is left unexploited. As examples of reductions, consider the following two. In a full sum reduction over an array of integers, the operator is addition and the result is the sum of every integer in the array. In a partial sum reduction (often called a histogram reduction) over a 2D array of integers the operator again is addition but the result is either a column of integers where each is the sum of all the integers in its row or a row of integers where each is the sum of all the integers in its column. In addition to summation, other common reductions include the following: determining the minimum or maximum value in an array, nding the location of the minimum or maximum value in an array, and calculating the logical or bit-wise "and" or "or" of the elements in an array. In this paper, we introduce a parallel language construct that lets a programmer explicitly specify arbitrary reductions so that the compiler cannot fail to exploit associativity by parallelizing the reduction. We report on our implementation of this construct in the context of the ZPL language [18]. Most high-level parallel languages include reductions in their repertoire of devices, but fewer allow for the specication of arbitrary reductions. Languages like NESL [3] (and ZPL prior to our introduction of this mechanism) supply a number of built-in reductions such as those mentioned above, but do not let programmers dene their own. Though languages like C* [12, 13] and SAC [16] have user-dened reductions, the mechanisms do not allow for reductions to be written as efciently as with the mechanism we introduce. The rest of this paper is organized as follows. In Section 2 we consider the trade-offs between various programming approaches to reductions. In Section 3 we introduce the ZPL language and in Section 4 we present our mechanism to efciently support arbitrary user-dened reductions in the context of ZPL. In Section 5 we quantitatively evaluate this mechanism. In Sections 6 and 7 we discuss related work and conclude. Programming Approaches to Reductions This section concerns itself with the various approaches one takes to program parallel supercomputers or clusters of workstations. In particular, we focus on how easy it is to write a reduction using a given approach and what level of performance is likely to be achieved. The approaches we consider are as follows: using an automatic parallelizer, relying on a parallelizing compiler assisted by programmer-inserted directives, employing a message passing library, or writing code in a high-level language. 2.1 Automatic and semi-automatic parallelization Most research related to improving state-of-the-art programming practices with regard to reductions lies under the umbrella of automatic parallelization. With this approach, programming is as easy as writing code for a single processor because this is just what the programmer does. The compiler is solely responsible for exploiting parallelism. Traditionally pattern matching and idiom recognition have been used to parallelize reductions [4, 14]. Sophisticated techniques for recognizing broader classes of reductions have also been examined [8, 19]. Commutativity analysis [15] promises to be yet another effective technique. However, it is an undecidable problem to determine whether a function is associative [10]. Moreover, even if a function is not technically associative, the salient part of the calculation might be. To exploit the associativity of a function it is sufcient but not necessary that the function be associative. Automatic parallelization is an invaluable technique for quickly improving performance on large legacy codes written for sequential processors, but one cannot expect to achieve consistently high performance. There are too many uses for different reductions that no compiler will ever be able to identify and parallelize all reductions. Moreover, the compiler might justiably determine a reduction is not parallelizeable even if the programmer is able to determine that it is. It is not a new observation that a compiler needs assistance in parallelizing codes. This observation lead to the development of High Performance Fortran (HPF) [9]. HPF limits the risk that a critical section of code is left unpar- allelized by relying on the programmer to insert directives into a code. A programmer writes a sequential program in ordinary Fortran and then adds data layout directives thereby creating an HPF program. Programmers of HPF have achieved successes but still suffer from many of the same problems encountered by programmers relying on fully automatic parallelization. Compilers are, after all, supposed to recognize reductions and parallelize them accordingly. 2.2 Message passing libraries Message passing libraries shift the responsibility of exploiting parallelism to the programmer. Details of communication account for a large portion of the code [6] and valuable time must be spent writing it. In addition, the programmer must write the computation based on a per-processor view of the system. The negative impact this has on code readability and maintainability should not be underestimated. In spite of these problems, this approach to programming parallel computers is the standard method employed by scientists who demand high performance. Reductions are not difcult to write using a message passing library. MPI [17] comes with a rich set of built-in reductions, but occasionally the reduction a programmer wants to write is not in this set. In this case, MPI has a mechanism that allows for user-dened reductions. The programmer must write a function that can be used by processors to combine their own local results. This function is associated with a datatype and can be used in the standard reduction function call. For example, see the code in Appendix A in which it is assumed that a reduction to return the minimum element in an array as well as its location is absent from the built-in set of reductions in the MPI library. The disadvantage to using message passing libraries is that to do so means programming with a low-level per-processor view of the system. Even though this simplies what needs to be added to support user-dened reductions, the overall complexity level is higher than the next approach we consider. 2.3 High-level parallel languages High-level parallel languages, like message passing libraries, are used by programmers who want a guarantee of parallelization. Reductions written in these high level languages are guaranteed to be parallel. The advantage over message passing libraries is two-fold; details of communication are hidden from the programmer and the view of the computation is global, i.e., not on a per-processor level. The disadvantage is that a certain level of control is lost. In languages that do not provide user-dened reductions, like NESL (and ZPL before the mechanism in this paper was implemented), a programmer often must write grossly inefcient code that relies on some simple, built-in reductions to accomplish what could easily be done with a more complicated reduction. For example, suppose a programmer wants to determine the two smallest elements in a large array. Ideally, each processor would compute the two smallest elements on the part of the array owned by that processor. Then a reduction could be computed in which pairs of processors compare four elements, the two smallest elements on each processor, to determine the smallest two elements on both of the processors. This is an associative operation and so the parallel- prex method can be used to reduce the two smallest elements on all the processors in parallel. If a high-level language only supplies a few built-in reductions including one in which the single smallest element in an array as well as its location in the array can be identied, the most efcient solution is unworkable. Instead, we must nd the smallest element in the array and replace it with an element of maximum value. Then we can nd the second smallest value using the same reduction. Finally we should replace the smallest value if the array is to be left in its original state. Clearly this is inefcient and motivates the need for a powerful language construct that allows for arbitrary, user-dened reductions. Note that in the case of ZPL before this mechanism was implemented, the best reduction we could use to nd the two smallest elements was a reduction that determined the smallest element in the array, but not its location. So an even less efcient algorithm for nding the smallest two elements in an array would have to be used. In this paper, we improve upon user-dened reduction mechanisms previously proposed for high-level, parallel languages. The language construct we add to the ZPL language lets a programmer achieve the performance hitherto only achievable with message passing libraries. 3 A Brief Introduction to ZPL ZPL is a high-level, data-parallel, array-based language used to program parallel computers when high performance is desired even if development time is limited. Its relative simplicity and Pascal-like feel make it easy to read and un- derstand, yet it also retains a sophisticated model of parallelism. For these reasons and because we have implemented user-dened reductions in ZPL, we choose to introduce our language construct in the context of ZPL. It should be noted however that this construct is sufciently general to apply to other high-level parallel languages. In this section we introduce those features of the ZPL language relevant to this paper. Interested readers are referred to the user's guide [18]. 3.1 Regions and arrays Central to ZPL is the region [7]. Regions are index sets with no associated data. To declare two regions, R and BigR, such that BigR is an set and R is an n n index set that refers only to the non-border portion of BigR, we write the following: region Regions are used in two contexts. First, they are used to declare parallel arrays. All arrays declared over regions are parallel and as such are distributed over the processors in a manner speciable at runtime. We declare three integer arrays, A, B, and C, to be over the index set given by BigR by writing: Non-parallel arrays, also called indexed arrays, are declared using the keyword "array". These arrays are replicated on each processor and are guaranteed to contain the same data on each processor. To declare a ten element array of integers, a, that is replicated and consistent on all processors, we write: Note that there is no region associated with this declaration. The index set is instead specied after the array keyword. A second use of regions is to implicitly signal parallel computation. For example, to sum corresponding values in the non-border portion of parallel arrays A and B and store the result in C, we write the following line of code: This corresponds to a doubly nested loop over the nn index set. There is no communication since all interacting parallel arrays are distributed in the same way. 3.2 Parallel operators and communication Communication only arises when certain ZPL operators are used. Since communication is a major overhead in parallel computing, programmers should avoid these operators whenever possible. Additionally, the operators that correspond to less communication should be used instead of operators that correspond to more communication. The classica- tion of these operators gives ZPL a performance model that lets programmers determine how fast or slow are their algorithms [5]. The most basic operator is the @ operator. This operator allows the programmer to refer to elements offset from elements in the array being assigned. It is important to note that this implies the possibility of communication, in particular, point-to-point or nearest-neighbor communication. To write a computation in which the sum of four adjacent elements in the array A are assigned to elements in the same array, we write the following code: (Note that because this is a data-parallel computation signaled by the region, only old values in the array A, values in A before any computation in this line of code occur, are used to update the array.) A more expensive communication operation is the reduce operator, <<. This entails broadcast and/or parallel- prex communication. There are a number of built-in reductions in the ZPL language such as summation, minimum value, maximum value, etc. For example, to calculate the sum of every value in the array A and store it in the rst element of the array a, we write the following code: The indexed array, a, is directly indexed into. The region does not apply to it, applying instead to the computation over A. Parallel arrays cannot be indexed into since this would allow for arbitrary communication patterns. Only indexed arrays can be indexed hence their name. Arbitrary indexing of parallel arrays can be done in bulk using the permute operator, #. This is the most expensive communication operator in the ZPL language. 4 A Mechanism for User-dened Reductions We have added the ability to write user-dened reductions in the ZPL language by overloading functions. Each of the overloaded functions corresponds to a different piece of the reduction. In this section, we describe how this works. First, we present a simple example of using the user-dened reduction mechanism to dene one of the simple built-in reductions. We then describe two more complicated reductions that can be implemented in this way and that illustrate every aspect of our mechanism. Finally, we discuss a few miscellaneous issues related to user-dened reductions: associativity, commutativity, and aggregation. 4.1 Basic user-dened reductions User-dened reductions in ZPL are easy to write. By overloading a function, the same reduction operator can be used. This ensures that the performance model remains intact [5]. As an example, suppose ZPL's built-in reductions did not include the sum reduction. Then we could realize the same computation by writing the code appearing in Figure 1. 3 return 0; 8 return a 9 end; . sum<< A .; Figure 1: User-dened sum reduction in ZPL We have overloaded the function sum. The denition of sum in lines 1-4 of Figure 1 is the initialization function; in lines 6-9, the reduction function. For a full reduction, nding the sum of every integer in an array, the parallel implementation works in the following way. Each processor has a single variable of type integer used to accumulate its local sum. On each processor, this variable is initialized with the initialization function. Then, on each processor, the variable is repeatedly assigned the result of the reduction function as it is applied to every element in the array residing on the local processor and the accumulating variable. Finally, the same function is used to combine accumulating values between pairs of processors. Using the parallel-prex method, this last step can be done in a number of steps on the order of the logarithm of the number of processors. 4.2 Generalized user-dened reductions and the minten reduction In general, three functions must be used to correspond to the three phases of a reduction: the initialization, the local reduction, and the global reduction. In the initialization phase, all local accumulating values are initialized. In the local phase, the local function is applied to the local accumulating value and values in the array residing on the local processor. In the global phase, the global function is applied to accumulating values on different processors. In many cases such as the sum reduction, the local and global phases can be described with a single function. To illustrate why three distinct functions might be desirable, consider the minten reduction. In the minten reduction, we are given an array of values and must nd the ten smallest values. In ZPL, we can write this reduction as in Figure 2. Note that for efciency, we write the procedures so that the result is not returned, but instead overwrites a parameter. This technique also applies to the sum reduction but is less important in that case since the result type is small. In general, to specify a user-dened reduction that takes an array of type A elements and returns a lower rank array of type B elements, overloaded functions of the following types must be constructed: # B, A B # B, and B. For efciency, the functions may be specied in the form B#, AB#, and B B# as is done in the minten reduction. The symbol "#" corresponds to either no argument or no result and we use a "#" to denote a parameter that is passed by reference. The advantage of allowing the programmer to distinguish between local and global functions is two-fold. First, greater efciency is achieved by not requiring an A type to be translated to a B type before the reduction. Second, if the global operation is more compute-intensive than the local function, it is better to use the faster local function. It is used more often during the course of a reduction assuming many array elements reside on each processor. We realize both of these advantages in the minten code. It would be inefcient to translate each array element into an array of ten elements containing the array element and nine maximum values. Further, the global function of nding the ten 6 for i := 1 to 10 do do tmpval := bestv[i]; 19 bestv[i] := newval; newval := tmpval; 22 end; 26 28 for i := 1 to 10 do 29 minten(bestvec1[i], bestvec2); . minten<< A .; Figure 2: User-dened minten reduction in ZPL smallest values in two arrays of ten values each is more compute-intensive than checking to see if a single element is smaller than any element in an array of ten elements and, if so, replacing that element. 4.3 Extensions for the minloc reduction In addition to letting the programmer write the two functions for efciency, letting the programmer pass in extra parameters to the local function adds to the potential efciency. For example, to write a minloc reduction using the mechanism for user-dened reductions as described to this point, we would need to translate the array values into a new type that includes its location. Alternatively, we can pass in some extra information to the local function. The minloc reduction is similar to the basic minimum reduction but along with the minimum value, the reduction returns the location of the minimum value in the array. Figure 3 contains an efcient minloc reduction in ZPL. Note the use of the Index1 and Index2 "arrays". These are not arrays in that no storage is associated with them. However, they can be thought of as read-only arrays. In general, the variable Indexd contains the value i in the ith position of the dth dimension for all i dened by the current region. These variables are used in the local portion of the reduction and are passed in to the local function specied by the user. Ordinary overloaded function resolution techniques still apply. The nal argument is for the accumulating value. Appendix A contains code that implements the minloc reduction in C and MPI. ZPL allows the programmer the same level of expressibility because the three functions correspond exactly to the points in the low-level C+MPI code 13 if d < best.d then 14 best.d := d; 22 if min1.d < min2.d then 26 . minloc<< (A, Index1, Index2) .; Figure 3: User-dened minloc reduction in ZPL where, under any reasonable condition, work is done. This offers the ZPL programmer enough exibility to write an efcient code. 4.4 Associativity, commutativity, and aggregation User-dened reductions in ZPL must be associative to guarantee determinism and a correct answer. The programmer is responsible for verifying that this is the case. This is consistent with other languages that support user-dened reductions such as C* and SAC. In C* and SAC, user-dened reductions must also be commutative. For ZPL, we have weakened this condition and assume instead that a user-dened reduction is not commutative. This decision is pending results from a performance study. Whereas associativity is necessary to use the parallel-prex method and exploit parallelism, commutativity is not. Commutativity is advantageous only to certain parallel computers that can take advantage of values arriving in different orders. Non-commutative reductions are common. For example, given a one-dimensional array of ones and zeroes, the length of the longest sequence of ones can be determined in parallel using an associative, non-commutative reduction. Aggregation is an important method for limiting the number of messages sent in message passing systems in the presence of many similar reductions. It has proven vital to achieving high performance [14]. If given a parallel array where each element corresponds to a list of k elements, we want to nd the smallest elements that reside in each position of the list, we would write k reductions in a loop. These k reductions would be aggregated by the ZPL compiler. Aggregation occurs in the ZPL case for user-dened reductions just as for built-in reductions. In the code in Appendix A, a signicant difference can be seen between the global functions in the C+MPI and ZPL implementations. In the C+MPI implementation, the global function takes an array of reduction elements rather than a single one. In ZPL, the global function is passed just a single element. However, the ZPL compiler transforms the global function into one that takes an array of elements and aggregation is done automatically when applicable. 5 Evaluation To determine the effect on performance of user-dened reductions, we ran three versions of the NAS MG benchmark [1, 2] on a 272 processor T3E-900. Each processor runs at 450MHz and there are 256 MB of RAM per pro- cessor. The three versions of the NAS MG benchmark are the original NAS implementation in F77 and MPI, a ZPL implementation using only built-in reductions, and a ZPL implementation using the user-dened reduction mechanism described in this paper. Our focus is on the initialization of the array in the NAS MG benchmark which works as follows. First, the array is lled with random numbers. Second, the ten largest and ten smallest values are identied. Third, these twenty values are replaced with the values +1 and -1 respectively and all other values in the array are set to zero. It is assumed that the ten largest and ten smallest values are unique. In our timings, we focus only on the second step of this process. Figure 4 contains the results of our experiment on the three large classes. Note that classes A and B are identical with regards to the initialization of the array. Processors3296Speedup over best 2-processor time (0.404 seconds in Initialization linear speedup ZPL Built-in ZPL User-defined Processors412Speedup over best 16-processor time (0.405 seconds in MG Class C Initialization linear speedup ZPL Built-in ZPL User-defined Figure 4: Parallel speedup of NAS MG's initialization The graphs in Figure 4 show us that the addition of user-dened reductions in the ZPL language is critical to performance. Although the ZPL implementation using only built-in reductions scales almost linearly with respect to itself, the overhead is too high. In this implementation, we compute 20 reductions. Each reduction returns a minimum or maximum value in the array. Between these reductions, each processor scans through its portion of the array to nd the reduced value. If it is found, the location is determined and this information is broadcast to all processors. The amount of computation is overwhelming; the array is traversed a total of 40 times. In the ZPL implementation with user-dened reductions as well as the F77+MPI implementation, the array is traversed only once. Another point to note from the graphs is that the ZPL implementation with user-dened reductions is only slightly slower than the F77+MPI implementation on a small number of processors (within 10%) and that on a large number, the ZPL implementation continues to scale whereas the F77+MPI implementation does not. This continued scaling is a result of implementation differences; it does not reect a limitation of expressibility in the F77+MPI implementation. The F77+MPI implementation avoids user-dened reductions by taking advantage of the local view of the com- putation. In a single traversal over the array, each processor nds the ten smallest and ten largest values that reside on its portion of the array. After this, twenty reductions are used to nd which values are the largest and smallest in the entire array. No location information need be broadcast. If a processor's locally largest values are globally largest, then this processor knows that it will replace these values with +1. This is in contrast to what can be done in ZPL. In both ZPL implementations, the location information of the largest and smallest values in the entire array must be broadcast to each processor to maintain the global view of the computation. Our ZPL implementation with user- dened reductions scales better than the F77+MPI reduction only because we use a single, large reduction to nd the twenty globally largest and smallest values in the array. On smaller processors, the ZPL implementations suffer from the extra overhead involved in communicating and using the location information on a global scale. 6 Related Work The idea of a construct for user-dened reductions is not new, though it remains surprisingly absent from many high-level languages. When they are supported, it is often not as efcient as possible. They are supported in SAC [16], but in a limited form. Only one function is speciable for both the global and local parts of the reduction. This makes reductions like the minten reduction difcult to write in an efcient manner for reasons discussed in Section 4.2. Viswanathan and Larus [20] developed a powerful mechanism for user-dened reductions in the context of the C* language that closely resembles the construct described in this paper. However, they provide no mechanism for passing extra parameters to the local function and it is unclear as to how the initialization phase is done, whether with another overloaded function or not. In addition, due to language differences, their mechanism for user-dened reductions can lead to data races. The higher-level, global view of the computation in ZPL eliminates this worry. 7 Conclusion The optimized handling of reductions on parallel supercomputers or clusters of workstations is critical to high performance because reductions are common in scientic codes and a potential source of bottlenecks. Consequently, researchers have worked diligently on techniques for compilers and programmers to use so that reductions execute efciently. Great strides have been made in the domain of automatic parallelization, but this remains a hit-and-miss approach to high performance. Semi-automatic techniques relying on directives have improved the hit rate, but performance still often suffers. And so the use of a language like Fortran 77 coupled with a message passing library like MPI remains the popular standard. Consistently high performance is crucial to most scientic programmers who are willing to expend the considerable effort necessary to program with Fortran 77 and MPI. Message passing libraries are difcult to use; they force the programmer to write programs on a per-processor basis, to tediously engineer all interprocessor communication, and to lose track of the problem as a whole. High-level parallel languages are a promising alternative to the popular standard, but even for the well-studied idiom of reductions, performance suffers. This is because what can be directly done by a programmer with Fortran 77 and MPI can often not be done in any given high-level language. There is either no mechanism for user-dened reductions or there is one that forces the programmer to sacrice some amount of efciency. In this paper, we have presented a new language construct for arbitrary reductions that lets a programmer achieve a level of high performance equal to that achievable with Fortran and MPI. We evaluated our approach in the context of the NAS MG benchmark and showed that performance closely resembles that achieved with the low-level Fortran plus MPI approach. This construct is vital to high performance and makes high-level languages a more viable choice for scientists. Acknowledgments The rst author is supported by a DOE High-Performance Computer Science Fellowship and completed a portion of this work while at Los Alamos National Laboratory. We would like to thank Sung-Eun Choi and our anonymous reviewers for their many insightful comments on earlier drafts of this paper. This work was supported in part by a grant of HPC resources from the Arctic Region Supercomputing Center. --R NAS parallel benchmarks 2.0. NESL: A nested data-parallel language (Version 3.1) ZPL's WYSIWYG performance model. A comparative study of the NAS MG benchmark across parallel languages and architectures. Regions: An abstraction for expressing array computation. Parallelizing complex scans and reductions. High Performance Fortran Forum. On the complexity of commutativity analysis. Parallel pre Parallel programming in C Compiler optimization of implicit reductions for distributed memory multipro- cessors Commutativity analysis: A new analysis framework for parallelizing compilers. MPI: the complete reference. Programming Guide to ZPL. Detection and global optimization of reduction operations for distributed parallel machines. --TR Parallelizing complex scans and reductions Commutativity analysis Detection and global optimization of reduction operations for distributed parallel machines A programmer''s guide to ZPL Regions On defining application-specific high-level array operations by means of shape-invariant programming facilities A comparative study of the NAS MG benchmark across parallel languages and architectures MPI Polaris On the Complexity of Commutativity Analysis ZPL''s WYSIWYG Performance Model NESL: A Nested Data-Parallel Language --CTR Paul van der Mark , Lex Wolters , Gerard Cats, Using semi-lagrangian formulations with automatic code generation for environmental modeling, Proceedings of the 2004 ACM symposium on Applied computing, March 14-17, 2004, Nicosia, Cyprus Steven J. Deitz , David Callahan , Bradford L. Chamberlain , Lawrence Snyder, Global-view abstractions for user-defined reductions and scans, Proceedings of the eleventh ACM SIGPLAN symposium on Principles and practice of parallel programming, March 29-31, 2006, New York, New York, USA Steven J. Deitz , Bradford L. Chamberlain , Sung-Eun Choi , Lawrence Snyder, The design and implementation of a parallel array operator for the arbitrary remapping of data, ACM SIGPLAN Notices, v.38 n.10, October Lawrence Snyder, The design and development of ZPL, Proceedings of the third ACM SIGPLAN conference on History of programming languages, p.8-1-8-37, June 09-10, 2007, San Diego, California
high-level languages;parallel programming;scientific computing;user-defined reductions
603347
Design and Prototype of a Performance Tool Interface for OpenMP.
This paper proposes a performance tools interface for OpenMP, similar in spirit to the MPI profiling interface in its intent to define a clear and portable API that makes OpenMP execution events visible to runtime performance tools. We present our design using a source-level instrumentation approach based on OpenMP directive rewriting. Rules to instrument each directive and their combination are applied to generate calls to the interface consistent with directive semantics and to pass context information (e.g., source code locations) in a portable and efficient way. Our proposed OpenMP performance API further allows user functions and arbitrary code regions to be marked and performance measurement to be controlled using new OpenMP directives. To prototype the proposed OpenMP performance interface, we have developed compatible performance libraries for the Expert automatic event trace analyzer &lsqb;17, 18&rsqb; and the TAU performance analysis framework &lsqb;13&rsqb;. The directive instrumentation transformations we define are implemented in a source-to-source translation tool called OPARI. Application examples are presented for both Expert and TAU to show the OpenMP performance interface and OPARI instrumentation tool in operation. When used together with the MPI profiling interface (as the examples also demonstrate), our proposed approach provides a portable and robust solution to performance analysis of OpenMP and mixed-mode (OpenMP+MPI) applications.
Introduction With the advent of any proposed language system for expressing parallel operation (whether as a true parallel language (e.g., ZPL [6]), parallel extensions to sequential language (e.g., UPC [4]), or parallel compiler directives (e.g., questions soon arise regarding how performance instrumentation and measurement will be conducted, and how performance data will be analyzed and mapped to the language-level (high-level) parallel abstractions. Several issues make this an interesting problem. First, the language system implements a model for parallelism whose explicit parallel operation is generally hidden from the programmer. As such, parallel performance events may not be accessible directly, requiring instead support from underlying runtime software to observe them in full. When such support is unavailable, performance must be inferred from model properties. Second, the language system typically transforms the program into its parallel executable form, making it necessary to track code transformations closely so that performance data can be correctly mapped to the user-level source. The more complex the transformations, the more difficult the performance mapping will be. Last, high-level language expression of parallelism often goes hand-in-hand with an interest for cross-platform portability of the language system. Users will naturally desire the programming and performance tools to be portable as well. For the performance tool developer, these issues complicate decisions regarding choice of tool technology and implementation approach. In this paper, we consider the problem of designing a performance tool interface for OpenMP. Three goals for a performance tool interface for OpenMP are considered: . Expose OpenMP parallel execution to the performance system. Here we are concerned about what execution events and state data are observable for performance measurement through the interface. . Make the interface portable across different platforms and for different performance tools. Portability in this regard requires the definition of the interface semantics and how information is to be accessed . Allow flexibility in how the interface is applied. Since OpenMP compilers may implement OpenMP directives differently, including variations in runtime library operation, the performance interface should not constrain how it is used. While our study focuses mainly on the instrumentation interface, as that is where events are monitored and the operational state is queried, clearly the type of performance measurement will determine the scope of analyses possible. Ideally, the flexibility of the interface will support multiple measurement capabilities. master slave X00000001111111000000011111110000111Parallel Region Operation master starts serial execution parallel region begins slaves started team begins parallel execution team threads hit barrier slaves end; master exits barrier master resumes serial execution Figure 1: OpenMP Parallel Region Operation Showing States and Events General Performance Model for OpenMP OpenMP is a parallel programming language system used to express shared memory parallelism. It is based on the model of (nested) fork-join parallelism and the notion of parallel regions where computational work is shared and spread across multiple threads of execution (a thread team); see Figure 1. The language constructs provide for thread synchronization (explicitly and implicitly) to enforce consistency in operation. OpenMP is implemented using comment-style compiler directives (in Fortran) and pragmas (in C and C++). A performance model for OpenMP can be defined based on its execution events and states. We advocate multiple performance views based on a hierarchy of execution states where each level is more refined in focus: . Level 1: serial and parallel states (with nesting) . Level 2: work sharing states (per team thread) . Level 3: synchronization states (per/across team threads) . Level 4: runtime system (thread) states In this way, performance observation can be targeted at the level(s) of interest using events specific to the level. Events are defined to identify points of state transitions (begin/end, enter/exit), allowing OpenMP programs to be thought of as multi-threaded execution graphs with states as nodes and events as edges. A performance instrumentation interface would allow monitoring of events and access to state information. Figure 1 shows a diagram of OpenMP parallel region operation. Identified are serial (S) and parallel (P) states, parallel startup (STARTUP) and shutdown (SHUTDOWN) states, and different events at different levels for master and slave threads. Based on this diagram, and given a workable performance instrumentation interface, we can develop measurement tools for capturing serial and parallel performance. Before After Before After structured block call pomp parallel fork(d) call pomp parallel begin(d) structured block call pomp barrier enter(d) call pomp barrier exit(d) call pomp parallel end(d) call pomp parallel join(d) do loop call pomp do enter(d) do loop call pomp barrier enter(d) call pomp barrier exit(d) call pomp do exit(d) Before After Before After structured block call pomp workshare enter(d) structured block call pomp barrier enter(d) call pomp barrier exit(d) call pomp workshare exit(d) call pomp barrier enter(d) call pomp barrier exit(d) structured block structured block call pomp sections enter(d) call pomp section begin(d) structured block call pomp section end(d) call pomp section begin(d) structured block call pomp section end(d) call pomp barrier enter(d) call pomp barrier exit(d) call pomp sections exit(d) Before After Before After structured block call pomp critical enter(d) call pomp critical begin(d) structured block call pomp critical end(d) call pomp critical exit(d) structured block call pomp single enter(d) call pomp single begin(d) structured block call pomp single end(d) call pomp barrier enter(d) call pomp barrier exit(d) call pomp single exit(d) Before After Before After atomic expression call pomp atomic enter(d) atomic expression call pomp atomic exit(d) structured block call pomp master begin(d) structured block call pomp master end(d) Table 1: Proposed OpenMP Directive Transformations. 3 Proposed OpenMP Performance Tool Interface How should a performance interface be developed to meet the goals for OpenMP? Although different interfaces are possible (see [5, 10]), the basic idea behind our proposal is to define a standard API to a performance measurement library that can be used to instrument a user's OpenMP application program for monitoring OpenMP events. This instrumentation could be done by a source-to-source translation tool prior to the actual compilation or within an OpenMP compilation system. Performance tool developers then only need to implement the functions of this interface to enable their tool to measure and analyze OpenMP programs. Different measurement modes (e.g., profiling [2] and tracing [5, 7, 10]) can easily be accommodated in this way. Hence, the proposed performance interface does not specify how measurements are performed, only the form of the library interface. We call the OpenMP performance API the "POMP API" and the corresponding performance library the "POMP library," taking after the use of "pmpi" in the definition of the MPI profiling interface. In the following, we present various aspects of our proposal for a standardized performance tool interface using directive rewriting for its im- plementation. Fortran90 OpenMP 2.0 syntax is used in examples and tables. The transformations equally apply to C/C++. 3.1 OpenMP Directive Instrumentation The POMP API is defined with respect to the semantics of OpenMP operation. Thus, we specify the instrumentation of OpenMP directives in terms of directive transformations because, first, this allows a description independent of the base programming language, and second, the specification is tied directly to the programming model the application programmer understands. Our transformation rules insert calls to pomp NAME TYPE(d) in a manner appropriate for each OpenMP directive, where NAME is replaced by the name of the directive, TYPE is either fork, join, enter, exit, begin, or end, and d is a context descriptor (described in Section 3.5). fork and join mark the location where the execution model switches from sequential to parallel and vice versa, enter and exit flag the entering and exiting of OpenMP constructs, and, finally, begin and end mark the start and end of structured blocks used as bodies for the OpenMP directives. Table 1 shows our proposed transformations and performance library routines. To improve readability, optional clauses to the directives, as allowed by the OpenMP standards, are not shown. As can be seen, the type and placement of POMP calls is intended to expose OpenMP events to the underlying performance measurement system. In some cases, it is necessary to transform the directive in such a way that the operation can be explicitly captured. For instance, in order to measure the synchronization time at the implicit barrier at the end of DO, SECTIONS, WORKSHARE, or SINGLE directives, we use the following method: . If, as shown in the table, the original corresponding END directive does not include a NOWAIT clause, NOWAIT is added and the implicit barrier is made explicit. . If there is a NOWAIT clause in the original END directive, then this step is not necessary. To distinguish these barriers from (user-specified) explicit barriers, the pomp barrier #() functions are passed the context descriptor of the enclosing construct (instead of the descriptor of the explicit barrier). Unfortunately, this method cannot be used for measuring the barrier waiting time at the end of parallel directives because they do not come with a NOWAIT clause. Therefore, we add an explicit barrier with corresponding performance interface calls here. For source-to-source translation tools implementing the proposed transforma- tions, this means that actually two barriers get called. But the second (implicit) barrier should execute and succeed immediately because the threads of the OpenMP team are already synchronized by the first barrier. Of course, a OpenMP compiler can insert the performance interface calls directly around the implicit barrier, thereby avoiding this overhead. Transformation rules for the combined parallel work-sharing constructs (PARALLEL DO, PARALLEL SECTIONS, and PARALLEL WORKSHARE) can be defined accordingly; see Table 2. They are basically the combination of transformations for the corresponding single OpenMP constructs. The only difference is that clauses specified for the combined construct have to be distributed to the single OpenMP constructs in such a way that it complies with the OpenMP standard (e.g., SCHEDULE, ORDERED, and LASTPRIVATE clauses have to be specified with the inner DO directive). 3.2 OpenMP Runtime Library Routine Instrumentation To monitor OpenMP runtime library routine calls, the transformation process replaces these calls by calls to the performance tool interface library. For example, a OpenMP API call to omp set lock() is transformed into a call Before After !$OMP PARALLEL DO clauses . do loop call pomp parallel fork(d) !$OMP PARALLEL other-clauses . call pomp parallel begin(d) call pomp do enter(d) !$OMP DO schedule-clauses, ordered-clauses, lastprivate-clauses do loop call pomp barrier enter(d) call pomp barrier exit(d) call pomp do exit(d) call pomp parallel end(d) call pomp parallel join(d) Before After clauses . structured block call pomp parallel fork(d) !$OMP PARALLEL other-clauses . call pomp parallel begin(d) call pomp sections enter(d) !$OMP SECTIONS lastprivate-clauses call pomp section begin(d) structured block call pomp section end(d) call pomp barrier enter(d) call pomp barrier exit(d) call pomp sections exit(d) call pomp parallel end(d) call pomp parallel join(d) Before After clauses . structured block call pomp parallel fork(d) !$OMP PARALLEL clauses . call pomp parallel begin(d) call pomp workshare enter(d) structured block call pomp barrier enter(d) call pomp barrier exit(d) call pomp workshare exit(d) call pomp parallel end(d) call pomp parallel join(d) Table 2: Proposed OpenMP Combined Parallel Work-sharing Directive Transformations. to pomp set lock(). In the implementation of the performance interface function, the original corresponding OpenMP runtime library routine must be called. Performance data can be obtained before and after. Currently, we think it is sufficient to use this procedure for the omp # lock() and omp # nest lock() routines because they are most relevant for the observation of OpenMP performance behavior. 3.3 Performance Monitoring Library Control In addition to the performance library interface, we propose to add a new directive to give the programmer control over when the performance collection is done: !$OMP INST [INIT | FINALIZE | ON | OFF] For normal OpenMP compilation this directive is ignored. Otherwise, it is translated into calls of pomp init(), pomp finalize(), pomp on(), and pomp off() calls when performance instrumentation is requested. If compatibility with existing OpenMP compilers is essential, new directives with the sentinel !$POMP could be used. Yet another approach (which does not extend the set of OpenMP directives) would be to have the programmer add the performance tool interface calls directly, but this then requires either stub routines, conditional compilation, or the removal of the instrumentation to be used when performance monitoring is not desired. Our proposed new directive approach is more portable, effective, and easier to maintain. PARALLEL MASTER SINGLE pomp_parallel_fork(d) pomp_parallel_begin(d) pomp_parallel_end(d) pomp_parallel_join(d) pomp_master_begin(d) pomp_master_end(d) pomp_single_enter(d) pomp_single_begin(d) pomp_single_end(d) pomp_single_exit(d) DO / FOR WORKSHARE SECTION / SECTIONS pomp_do_enter(d) pomp_do_exit(d) pomp_for_enter(d) pomp_for_exit(d) pomp_workshare_enter(d) pomp_workshare_exit(d) pomp_sections_enter(d) pomp_section_begin(d) pomp_section_end(d) pomp_sections_exit(d) BARRIER CRITICAL ATOMIC pomp_barrier_enter(d) pomp_barrier_exit(d) pomp_critical_enter(d) pomp_critical_begin(d) pomp_critical_end(d) pomp_critical_exit(d) pomp_atomic_enter(d) pomp_atomic_exit(d) Runtime Library Control User Code pomp_set_lock() pomp_unset_lock() pomp_set_nest_lock() pomp_unset_nest_lock pomp_init() pomp_finalize() pomp_on() pomp_off() pomp_begin() pomp_end() Table 3: POMP OpenMP Performance API. 3.4 User Code Instrumentation For large application programs it is usually not sufficient to just collect OpenMP related events. The OpenMP compiler should also insert appropriate pomp begin() and pomp end() calls at the beginning and end of each user function. In this case the context descriptor describes the user function. In addition, users may desire to mark arbitrary (non-function) code regions. This can be done with a directive mechanism similar to that described in the last subsection, such as arbitrary user code The directives are translated into pomp begin() and pomp end() calls. Again, techniques can be used to avoid defining new directives, but with the same disadvantages as described in the last section. Furthermore, the transformation tool / compiler cannot generate the context descriptor for this user defined region in this case, so another (less efficient) mechanism would have to be used here. The full proposed OpenMP performance API is shown in Table 3. 3.5 Context Descriptors An important aspect of the performance instrumentation is how the performance tool interface routines get access to context information, in order to relate the collected performance information back to the source code and OpenMP constructs. We propose the following. For each instrumented OpenMP construct, user function, and user-specified region, the instrumentor generates a context descriptor in the global static memory segment of the compilation unit containing the construct or region. All monitoring function calls related to this construct or region are passed the address of this descriptor (called d in Tables 1 and 2). The proposed definition of the context descriptor (in C syntax) is shown below: struct ompregdescr { char* name; char* sub_name; int num_sections; char* file_name; int begin_line1, begin_lineN; int end_line1, end_lineN; WORD data[4]; struct ompregdescr* next; The fields of the context descriptor have the following meaning: name contains the name of the OpenMP construct or the string "region" for user functions and regions. sub name stores the name of named critical regions or the name of user functions and regions. In case of the sections OpenMP directives, num sections provides the number of sections, otherwise it is set to 0. The next five fields (file name, begin line1, begin lineN, line1, end lineN) describe the source code location of the OpenMP construct or user region: the source file name, and the first and last line number of the opening and of the corresponding END OpenMP directive. The field data can be used by the performance tool interface functions to store performance data related to this construct or region (e.g., counters or timers). Finally, the next component allows for chaining context descriptors together at runtime, so that at the end of the program the list of descriptors can be traversed and the collected performance data can be stored away and analyzed. This approach has many advantages over other methods (e.g., using unique identifiers): 1. Full context information, including source code location, is available to the performance tool interface functions 2. Runtime overhead for implementing this approach is minimal. Only one address is passed as an argument. In addition, providing space for storing performance data (in the form of the data field), the performance tool interface functions do not need to dynamically allocate memory for this purpose (which is very costly). 3. The context data is kept together with the (instrumented) executable so it avoids problems of locating (the right) separate context description file(s) at runtime. 4. Finally, it allows for separate compilation. This is important for today's large complex application codes. 3.6 Conditional Compilation We also propose to support user source code lines to be compiled conditionally if POMP instrumentation is requested. If the OpenMP compiler or POMP transformation tool supports a macro preprocessor (e.g. cpp for C, C++, and sometimes Fortran), it must define the symbol POMP to be used for conditional compilation. Following OpenMP standard conventions, this symbol is defined to have the decimal value YYYYMM where YYYY and MM are the year and month designations of the version of the POMP API that the implementation supports. This allows users to define and use application-, user-, or site-specific extensions to POMP by writing: arbitrary user code #endif The !P$ sentinel can be used for conditional compilation in Fortran compilation or transformation systems. In addition, CP$ and *P$ sentinels are accepted only when instrumenting Fortran fixed source form. During POMP instrumentation, these sentinels are replaced by three spaces, and the rest of the line is treated as a normal Fortran line. These sentinels also have to comply with the specifications defined in the Sections 2.1.3.1 and 2.1.3.2 of the OpenMP Fortran Application Program Interface, Version 2.0, November 2000. 3.7 Conditional / Selective Transformations Finally, to allow a user to (temporarily) disable the POMP instrumentation process for specific files or parts of files, we propose to provide the following new directives: (or !$POMP ., as necessary) which disable and re-enable POMP instrumentation (similar to common existing compiler directives for disabling optimizations). POMP instrumentation disabled by !$OMP NOINSTRUMENT is in effect until end of file or until the next !$OMP INSTRUMENT whichever comes first. 3.8 C/C++ OpenMP Pragma Instrumentation The transformations for Fortran OpenMP directives described in Tables 1 and 2 apply equally to C/C++ OpenMP pragmas. The main difference is that the extent of C/C++ OpenMP pragmas is determined by the structured block following it, and not by an explicit END pragma as in Fortran. This has the following consequences for pragma instrumentation: . Instrumentation for the "closing" part of the pragma follows the structured block. . Adding a nowait clause (to allow the make implicit barriers explicit) has to be done for the "opening" part of the pragma. . The structured block of a C/C++ OpenMP pragma (#pragma omp #) will be transformed by wrapping it with pomp # begin(d) and pomp # end(d) calls which in turn are enclosed in a block (i.e., using {. All other changes are simple differences in language (e.g., no call keyword and using #pragma omp instead of !$OMP). The new monitoring control and user code instrumentation would appear as: #pragma omp inst [init | finalize | on | off] #pragma omp inst begin ( ) arbitrary user code #pragma omp inst end ( ) #pragma omp noinstrument #pragma omp instrument 3.9 Implementation Issues It is clear that an interface for performance measurements must be very efficient and must minimize its influence on the dynamic behavior of the user code under investigation. We designed our POMP library interface with efficiency in mind from the very beginning: . We choose to define a larger set of performance monitoring API functions according to the pattern pomp TYPE NAME(descr) instead of using an interface like pomp event(POMP TYPE, POMP NAME, filename, linenumber, value, .) which would have been much simpler to implement. But it would make it necessary to use costly IF or statements inside the pomp event routine, resulting in run-time overhead. . Argument passing overhead is minimized (while still supporting full context information) by using context descriptors. This was already discussed in Section 3.5. . If further optimization is required, inlining of the POMP interface calls through the use of macros would be possible. In C/C++, this is possible without any changes to the proposal as outlined above as the function call and macro call syntax is the same. Fortran OpenMP instrumentation only requires the generation of the CALL during OpenMP directive transformation to be suppressed. However, the structure of a single POMP call is so simple (i.e., a function call with one constant argument) that current compiler technology should be able to inline the calls without the "manual" use of macros. . The granularity of OpenMP constructs can be much finer than, for example, MPI functions. This is especially true for the ATOMIC, CRITICAL, MASTER, and SINGLE OpenMP constructs as well as for the OpenMP API functions for locking. Implementers of the POMP interface must take special care when implementing the corresponding POMP functions. In addition, we propose that the instrumentation of these constructs can be selectively disabled by specifying the following command line option to the OpenMP compiler or POMP transformation tool: -pomp-disable=construct[,construct .] where construct is the name of one OpenMP construct listed above or "sync" to disable all of them. Finally, if the instrumentation of these (or other) constructs is critical only in specific parts of the code, our !$OMP NOINSTRUMENT directive (see Section 3.7) can be used to disable them selectively. 3.10 Open Issues While we think that the proposal outlined so far is reasonably complete, there are additional issues which need further discussion. Here, we try to briefly summarize the issues we are aware of: . Do we need instrumentation for the OpenMP ORDERED and FLUSH? . Do we need instrumentation of single iterations of PARALLEL DO (parallel for) loops? This would potentially allow the influence of OpenMP loop iteration scheduling policies to be measured, but only when iterations are of a sufficient granularity. . Do we need a way to allow users to pass additional information to the POMP interface? Besides using POMP conditional compilation (see Section 3.6), we might consider extending the !$OMP INST BEGIN and END directive (see Section 3.4) to optionally allow to pass the address of a user variable: arbitrary user code The pomp begin and pomp end routines would have an additional void* typed second parameter which would be NULL if the user did not specify a variable. This way, the user could pass additional information to the POMP API functions, which would be ignored in general implementations but could be utilized in (user- supplied) special versions. It is also possible to allow passing user information to the other (all) POMP API functions, but this requires further directives / pragmas. . Do we need additional OpenMP runtime level instrumentation or is it enough to observe OpenMP behavior on the source code level? 4 Prototype Implementation To integrate performance tools with the proposed OpenMP performance interface, two issues must be addressed. First, the OpenMP program must be instrumented with the appropriate performance calls. Second, a performance library must be developed to implement the OpenMP performance API for the particular performance tool. The following describes how two performance tools, EXPERT and TAU have been integrated with the proposed OpenMP performance interface. In each case, both OpenMP applications and hybrid (OpenMP+MPI) applications are sup- ported. The latter demonstrates the ability to combine the OpenMP performance interface with other performance interface mechanisms in a seamless manner. 4.1 Automatic Instrumentation As a proof of concept and a means for experimentation, we implemented OPARI (OpenMP Pragma And Region Instrumentor). It is a source-to-source translator which performs the OpenMP directive and API call transformations described in this paper, including the new proposed directives and !$POMP INST alternative sentinel. The current prototype implements full Fortran77 and Fortran90 OpenMP 2.0 and full C/C++ OpenMP 1.0 support. The instrumentation of user functions (based on PDT [12]) is under way. The tool consists of about 2000 lines of C++ code. Being just a source-to-source translator based on a (very) fuzzy parser, and not a full compiler, OPARI has a few small limitations: Fortran . The !$OMP END DO and !$OMP END PARALLEL DO directives are required (not optional, as described in the OpenMP standard). . The atomic expression controlled by a !$OMP ATOMIC directive has to be on a line all by itself. . Structured blocks describing the extent of an OpenMP pragma need to be either compound statements ({.}), or simple statements. In addition, for loops are supported only after omp for and omp parallel for pragmas. . Complex statements like if-then-else or do-while need to be enclosed in a block ({. We did not find these limitations overly restrictive during our tests and experiments. They rarely apply for well-written code. If they do, the original source code can easily be fixed. Of course, it is possible to remove these limitations by enhancing OPARI's parsing capabilities. Finally, if the performance measurement environment does not support the automatic recording of user functions entries and exits, and therefore cannot automatically instrument the program's main function, the OPARI runtime measurement library has to be initialized by a !$OMP INST INIT directive / pragma prior to any other OpenMP pragma. 4.2 Integration into EXPERT The EXPERT tool environment [17, 18] is aimed at automatically uncovering performance problems in event traces of MPI, OpenMP, or hybrid applications running on complex, large SMP clusters. The work on EXPERT is carried out within the KOJAK project [11] and is a part of the ESPRIT working group APART [1]. EXPERT analyzes the performance behavior along three dimensions: performance problem category, dynamic call tree position, and code location. Each of the analyzed dimensions is organized in a hierarchy. Performance problems are organized from more general ("There is an MPI related problem") to very specific ones ("Messages sent in wrong order"). The dynamic call tree is a natural hierarchy showing calling stack relationships. Finally, the location dimension represents the hierarchical hardware and software architecture of SMP clusters consisting of the levels machine, node, process, and thread. The range of performance problems known to EXPERT are not hard-coded into the tool but are provided as a collection of performance property specifications. This makes EXPERT extensible and very flexible. A performance property specification consists of . a compound event (i.e., an event pattern describing the nature of the performance problem), . instructions to calculate the so-called severity of the property, determining its influence on the performance of the analyzed application, . its parent performance property, and . instructions on how to initialize the property and how to display collected performance data or property related results. Performance property specifications are abstractions beyond simple performance metrics, allowing EXPERT to explain performance problems in terms of the underlying programming model(s). Specifications are written in the event trace analysis language EARL [16], an extension of the Python scripting language. EARL provides efficient access to an event trace at the level of the abstractions of the parallel programming models (e.g., region stack, message queue, or collective operation) making it easy to write performance property specifications. EXPERT's analysis process relies on event traces as performance data source. Event traces preserve the temporal and spatial relationship among individual events, and they are necessary to prove certain interesting performance properties. Event traces are recorded in the newly designed EPILOG format that, in contrast to traditional trace data formats, is suitable to represent the executions of MPI, OpenMP, or hybrid parallel applications being distributed across one or more (possibly large) clusters of SMP nodes. It supports storage of all necessary source code and call site information, hardware performance counter values, and marking of collectively executed operations for both MPI and OpenMP. The implementation of EPILOG is thread safe, a necessary feature not always present in most traditional tools. Traces can be generated for C, C++, and Fortran applications just by linking to the EPILOG tracing library. To intercept user function calls and returns, we use the internal profiling interface of the PGI compiler suite [15] being installed on our LINUX SMP cluster testbed. For capturing OpenMP events, we implemented the pomp library functions in terms of EPILOG tracing calls, and then use OPARI to instrument the user application. For example, the omp for enter() and omp for exit() interface implementation for instrumentation of the #pragma omp parallel for directive for C/C++ would look like the following in EPILOG: void pomp_for_enter(OMPRegDescr* r) { struct ElgRegion* e; if (! void pomp_for_exit(OMPRegDescr* r) { What is important to notice is how the region descriptor is utilized to collect performance data per OpenMP con- struct. For hybrid applications using OpenMP and MPI, MPI-specific events can also be generated by a appropriate wrapper function library utilizing the MPI standard profiling interface. 4.3 Integration into TAU The TAU performance system [13] provides robust technology for performance instrumentation, measurement, and analysis for complex parallel systems. It targets a general computation model consisting of shared-memory nodes where contexts reside, each providing a virtual address space shared by multiple threads of execution. The model is general enough to apply to many high-performance scalable parallel systems and programming paradigms. Because TAU enables performance information to be captured at the node/context/thread levels, this information can be mapped to the particular parallel software and system execution platform under consideration. TAU supports a flexible instrumentation model that allows access to a measurement API at several stages of program compilation and execution. The instrumentation identifies code segments, provides for mapping of low-level execution events to high-level computation entities, and works with multi-threaded and message passing parallel execution models. It interfaces with the TAU measurement model that can capture data for function, method, basic block, and statement execution. Profiling and tracing form the two measurement choices that TAU provides. Performance experiments can be composed from different measurement modules, including ones that access hardware performance monitors. The TAU data analysis and presentation utilities offer text-based and graphical tools to visualize the performance data as well as bridges to third-party software, such as Vampir [14] for sophisticated trace analysis and visualization. As with EXPERT, TAU implements the OpenMP performance API in a library that captures the OpenMP events and uses TAU's performance measurement facility to record performance data. For example, the POMP implementation of the same functions as in Section 4.2 would look like the following in TAU: TAU_GLOBAL_TIMER(tfor,"for enter/exit", "[OpenMP]",OpenMP); void pomp_for_enter(OMPRegDescr* r) { #endif #endif void pomp_for_exit(OMPRegDescr* r) { #endif #endif TAU supports construct-based as well as region-based performance measurement. Construct-based measurement uses globally accessible timers to aggregate construct-specific performance cost over all regions. In the case of region-based measurement, like EXPERT, the region descriptor is used to select the specific performance data for that context. Following this instrumentation approach, all of TAU's functionality is accessible to the user, including the ability to select profiling or tracing, enable hardware performance monitoring, and add MPI instrumentation for performance measurement of hybrid applications. 5 Example Applications To demonstrate the viability and robustness of the proposed interface and instrumentation tools we have developed, the OPARI tool and the pomp libraries for EXPERT and TAU are applied to example mixed-mode (OpenMP applications. These types of application present an analysis challenge for performance tools because of the need to capture and present performance data for different parallel modes and their interaction. Figure 2: EXPERT Performance Analysis of OpenMP/MPI Weather Forecasting Application Instrumented with OPARI 5.1 Weather Forecasting The REMO weather forecast application from the DKRZ (Deutsches Klima Rechenzentrum, Germany) is an excellent testcase for the performance API. The code is instrumented using OPARI for OpenMP events and the MPI profiling library for MPI events. The measurement system uses the EPILOG tracing facility, with the POMP library calling EPILOG trace routines, as described above. The EXPERT system then processes the events traces and displays the performance analysis results. In EXPERT, the presentation of the results is also based on three dimensions: performance problem, call graph, location. Each dimension is displayed using weighted trees. A weighted tree is a tree browser that labels each node with a weight. EXPERT uses the performance property's severity as this weight. The weight is displayed simultaneously using both a numerical value as well as a color coded icon. The color allows to identify nodes of interest easily even in a large tree. By expanding or collapsing any of the three trees it is possible to analyze the performance behavior of a parallel application on different levels of granularity. We see some of this interactive analysis in Figure 2 and 3. The three tree views are shown. The first view lists the different performance properties. The numbers at the nodes show the percentage of CPU allocation time spent on that property or lost as a result of that property. When the node is collapsed, the inclusive value is shown, when it is expanded only its exclusive value. Colors represent the numeric value graphically. Figure 2 shows that 50% of CPU allocation time was lost as a result of sequential execution or was "used by idle slave threads." Although idle threads do not execute any code, the idle time is mapped to the middle (call tree) view (i.e., the idle slave threads are considered to be executing the same code as the corresponding master threads). This allows the user to find code regions that spent a very long time on sequential execution. The numbers in the middle view refer to the selection in the left view, so 73.5% of the 50.0% are spent in /remo/ed4org/progec4. Figure 3: Barrier Performance Analysis of REMO The right view shows the distribution of idle times across the different threads. Here all values refer to the selection in the left neighbor, so the sum of all values correspond to the 73.9% from the middle view. Of course, only the slave threads have idle times, the master thread shows always 0.0%. Figure 3 refers to the property "OpenMP Barrier." The call tree shows that nearly all barrier time is spent on an implicit barrier (!$omp ibarrier) belonging to a parallel do (!$omp do). The distribution of overhead across the different threads is shown in the right view. 5.2 Ocean Circulation To demonstrate the use of the OpenMP performance tool interface with TAU, we applied it to a two-dimensional Stommel ocean current application from the San Diego Supercomputing Center. The application code models wind-driven circulation in a homogeneous rectangular ocean under the influence of surface winds, linearized bottom friction, flat bottom, and Coriolis force. A 5-point stencil is used to solve partial differential equation on a grid of points. Table 4 shows the source code for a more compute-intensive for block, before and after instrumentation with OPARI. By linking with the TAU-specific pomp library and a user-configured TAU measurement package, the performance data for OpenMP and MPI events can be captured and displayed. Figure presents profiling data for the Stommel application. Shown is a region-based performance view where individual parallel loops are distinguished. The for block shown in Table 4 is highlighted in the "n,c,t 0,0,0 profile" display (representing node 0, context 0, and thread 0) and is seen to take a significant percentage of time to execute. The execution time for this block across all threads is shown in the "for location Original code block #pragma omp for schedule(static) reduction(+: diff) private(j) firstprivate (a1,a2,a3,a4,a5) { for(j=j1;j<=j2;j++){ Code block after OPARI instrumenation #line 252 "stommel.c" #pragma omp for schedule(static) reduction(+: diff) private(j) firstprivate (a1,a2,a3,a4,a5) nowait { for(j=j1;j<=j2;j++){ #pragma omp barrier Table 4: Directive Instrumentation for Stommel Code. profile" display. Clearly, there is a work imbalance between the two threads within each process, but the distribution is consistent across nodes (i.e., processes). Notice how the MPI performance data is integrated with the OpenMP data in the display. It is also possible for TAU to be used to obtain construct-based performance data. By linking the Stommel application with a trace-configured performance library, OpenMP and MPI events can be displayed using the Vampir [14] visualization tool. Figure 5 displays an event timeline showing the overlaps of OpenMP and MPI events. 6 Related Work Given the interest in OpenMP in the last few years, several research efforts have addressed performance measurement and analysis of OpenMP execution, but none of these efforts have considered a common performance tool interface in the manner proposed in this paper. The OVALTINE tool [2] helps determine relevant overheads for a parallel OpenMP program compared to a serial implementation. It uses the Polaris Fortran 77 parser to build a basic abstract syntax tree which it then instruments with counters and timers to determine overheads for various OpenMP constructs and code segments. The nature of the OVALTINE performance measurements suggests that our OpenMP performance API could be applied directly to generate the OpenMP events of interest, allowing greater range to performance tools for use in overhead analysis. OMPtrace [5] is a dynamic instrumentation package used to trace OpenMP execution on SGI and IBM platforms. It provides for automatic capture of OpenMP runtime system (RTS) events by intercepting calls to the RTS library. User functions can also be instrumented to generate trace events. The main advantage of OMPtrace is that there is no need to re-compile the OpenMP program for performance analysis. In essence, OMPtrace uses the RTS interface as the performance tool interface, relying on interception at dynamic link time for instrumentation. Unfortunately, this approach relies on OpenMP compiler transformations that turn OpenMP constructs into function calls, and on dynamic shared library operation. To bypass these restrictions, the OpenMP performance interface we propose could Figure 4: TAU Performance Profile of an OpenMP/MPI 2D Stommel Model of Ocean Circulation Instrumented with OPARI provide a suitable target for the performance tracing part of OMPtrace. A compatible POMP library would need to be developed to generate equivalent OMPtrace events and hardware counter data. In this manner, the Paraver [7] tool for analysis and visualization of OMPtrace data could be used without modification. The VGV tool combines the OpenMP compiler tools (Guide, GuideView) from KAI with the Vampir/Vampirtrace tracing tools from Pallas for OpenMP performance analysis and visualization. OpenMP instrumentation is provided by the Guide compiler for both profiling and tracing, and the Guide runtime system handles recording of thread events. Being compiler-based, the monitoring of OpenMP performance can be quite detailed and tightly integrated in the execution environment. However, the lack of an external API prevents other performance tools for observing OpenMP execution events. The performance interface we proposed could be applied in the VGV context in the same manner as above. The pomp calls could be implemented in a library for VGV, mapping the OpenMP actions to Vampir state transition calls at appropriate points. Another approach might be to have the Guide compiler generate the POMP instrumentation, allowing other pomp-compatible performance interface libraries to be used. Lastly, the JOMP [3] system is a source-to-source compiler that transforms OpenMP-like directives for Java to multi-thread Java statements that implement the equivalent OpenMP parallel operations. It has similarities to our work in that it supports performance instrumentation as part of its directive transformation [8]. This instrumentation generates events for analysis by Paraver [7]. In a similar manner, the JOMP compiler could be modified to generate pomp calls. In this case, since JOMP manages its own threads to implement parallelism, it may be necessary to implement runtime support for POMP libraries to access thread information. Figure 5: TAU Performance Trace of Stommel Application 7 Conclusion and Future Work This paper proposes a portable performance interface for OpenMP to aid in the integration of performance tools in OpenMP programming environments. Defined as a library API, the interface exposes OpenMP execution events of interest (e.g., sequential, parallel, and synchronization events) for performance observation, and passes OpenMP context descriptors to inform the performance interface library of region-specific information. Because OpenMP uses compiler directives (pragmas) to express shared memory parallelism, our definition of the performance tool API must be consistent with the operational semantics of the directives. To show how this is accomplished, we describe how the API is used in rewriting OpenMP directives in functionally equivalent, but source-instrumented forms. The OPARI tool can perform this OpenMP directive rewriting automatically, inserting POMP performance calls where appropriate. The benefits of the proposed performance interface are several. First, it gives a performance API target for source- to-source instrumentation tools (e.g., OPARI), allowing for instrumented OpenMP codes that are portable across compilers and machine platforms. Second, the performance library interface provides a target for tool developers to port performance measurement systems. This enables multiple performance tools to be used in OpenMP performance analysis. We show how this is accomplished for EXPERT and TAU by redefining the pomp calls. Third, the API also offers a target for OpenMP compilers to generate POMP calls that can both access internal, compiler- specific performance libraries and external performance packages. Finally, if the OpenMP community could adopt an OpenMP performance interface such as the one we proposed, it would significantly improve the integration and compatibility between compilers and performance tools, and, perhaps more importantly, the portability of performance analysis techniques. In the future, we hope to work with the OpenMP ARB to promote the definition for a performance tool API, offering our proposal here for consideration. We will enhance the OPARI source-to-source instrumentation approach with support for user function instrumentation using PDT [12]. Other opportunities are also possible with the integration of the API in OpenMP compilers and the use of other performance technologies for instrumentation and measurement. We hope to work with KAI and Pallas to investigate the use of our proposed performance tool interface in the KAP/Pro Guide compiler with Vampirtrace as the basis for the POMP performance library implementation. --R ESPRIT Working Group APART (Automatic Performance Analysis: Resources and Tools). "Overheads Profiler for OpenMP Codes," "Towards OpenMP for Java," "Introduction to UPC and Language Specification," "A Dynamic Tracing Mechanism for Performance Analysis of OpenMP Applications," "The Case for High Level Parallel Programming in ZPL," European Center for Parallelism of Barcelona (CEPBA) "Performance Analysis Tools for Parallel Java Applications on Shared-memory Systems," "An Integrated Performance Visualizer for MPI/OpenMP Programs," KOJAK (Kit for Objective Judgment and Knowledge-based Detection of Bottlenecks) "Tool Framework for Static and Dynamic Analysis of Object-Oriented Software with Templates," "Performance Technology for Complex Parallel and Distributed Systems," "VAMPIR: Visualization and Analysis of MPI Resources" Programmable and Extensible Toolkit for Analyzing Event Traces of Message Passing Programs," "Automatic Performance Analysis of MPI Applications Based on Event Traces," "Automatic Performance Analysis of SMP Cluster Applications," --TR Performance technology for complex parallel and distributed systems A tool framework for static and dynamic analysis of object-oriented software with templates The Case for High-Level Parallel Programming in ZPL Performance Analysis Tools for Parallel Java Applications on Shared-memory Systems Automatic Performance Analysis of MPI Applications Based on Event Traces An Integrated Performance Visualizer for MPI/OpenMP Programs A Dynamic Tracing Mechanism for Performance Analysis of OpenMP Applications Programmable and Extensible Toolkit for Analyzing Event Traces of Message Passing Programs --CTR Felix Wolf , Bernd Mohr, Automatic performance analysis of hybrid MPI/OpenMP applications, Journal of Systems Architecture: the EUROMICRO Journal, v.49 n.10-11, p.421-439, November Sameer S. Shende , Allen D. Malony, The Tau Parallel Performance System, International Journal of High Performance Computing Applications, v.20 n.2, p.287-311, May 2006
parallel programming;performance analysis;OpenMP
603408
Eliminating counterevidence with applications to accountable certificate management.
This paper presents a method to increase the accountability of certificate management by making it intractable for the certification authority (CA) to create contradictory statements about the validity of a certificate. The core of the method is a new primitive, undeniable attester, that allows someone to commit to some set S of bitstrings by publishing a short digest of S and to give attestations for any x that it is or is not a member of S. Such an attestation can be verified by obtaining in authenticated way the published digest and applying a verification algorithm to the triple of the bitstring, the attestation and the digest. The most important feature of this primitive is intractability of creating two contradictory proofs for the same candidate element x and digest. We give an efficient construction for undeniable attesters based on authenticated search trees. We show that the construction also applies to sets of more structured elements. We also show that undeniable attesters exist iff collision-resistant hash functions exist.
Introduction The concept of public-key cryptography was created in an effort to solve the cryptographic management problem [DH76]. While giving an answer to many difficult problems, public-key cryptography also raised several of its own. Not surprisingly, one of the main problematic areas to be solved before public-key cryptography can be successfully applied in practice is still that of key management. There has been a huge A preliminary version of this paper [BLL00] appeared in the ACM CCS '2000 Conference. The current version is the final submission to the Journal of Computer Security. y Tallinn Technical University/University of Tartu/Cybernetica AS, Akadeemia tee 21, 12618 Tallinn, Estonia, [email protected] z Universit at des Saarlandes, FB 14 Informatik, Im Stadtwald - Bau 45, Postfach 15 11 50, 66041 Saarbr ucken, Germany, [email protected] x Helsinki University of Technology, Laboratory for Theoretical Computer Science, Department of Computer Science and Engineering, FIN-02015 HUT, Espoo, Finland, [email protected] body of research on key management methods since [Koh78] but key management involves still considerably more trust toward the third parties than rest of cryptography. We say a certificate management system is accountable when all forgeries by third parties can be explicitly proven and all false accusations explicitly disproven. Efficient and accountable identity-based certificate management is necessary in par- ticular, but not only to support authenticity of digital documents with a long life- time. A body of supporting methods for long-term authenticity was developed in the area commonly known as digital time-stamping [HS91]. Recent work in time-stamping has also shown how to build efficient yet accountable time-stamping systems [BLLV98, Lip99, BLS00] with minimal trust in the third parties. However, one has to complement the techniques of accountable time-stamping with methods from other areas of applied cryptography to support long-term authenticity and non- repudiation. One of such areas is accountable efficient certificate management. Unfor- tunately, cryptographic literature has only briefly treated the question of how to achieve the latter [CL96]. First, we present informal motivation and definition of accountable certificate man- agement, where every validity change of a certificate is accompanied by a transferable attestation ascertaining this act, and a short digest of the current state of database of valid certificates is periodically published. In Section 2, we argue informally that a certificate management system is accountable if and only if it is intractable for anybody to create a pair of contradictory attestations, so that a certificate would be accepted as valid or not, depending on which certificate is in possession of the verifier. Under this intractability assumption, our certificate management system has several desirable properties. The most important property is that if physical visits to the Certification Authority (CA) are audited, every subsequent dispute in court can be solved by the present evidence. Moreover, one can verify certificate validity at some moment, based only on a short digest of the certificate database, a short certificate-specific attestation and the certificate itself. The rest of the paper is focused on this assumption. In Section 3, we give the formal definition of a new primitive called undeniable attester. Informally, an attester is a triple (P; D;V ) of algorithms, such that The proving algorithm P , given a candidate string x and a set S, outputs an attestation certifying whether x 2 S. The digest algorithm D, given a set S, outputs a short digest it. The verification algorithm V is given a candidate element x, a digest d, and an attestation p. V accepts or rejects on input (x; d; p), depending on whether x belongs to a set with digest d. Here, p contains additional information about the status of x 2 ? S. We call an attester undeniable if it is intractable to generate a digest d, an element x and two attestations p and p such that V (x; d; p) accepts but V (x; d; p) rejects. In the context of certificate management, S is a database of identity certificate serial numbers. In Section 4 we survey some attesters whose subsystems were considered previously in certificate management and public-key infrastructure. In particular, we review attesters based on certificate revocation lists, hash trees [Mer80], certificate revocation trees [Koc98, NN00] and RSA accumulators [BdM93, BP97]. However, since most of the mentioned systems have not been designed with accountability in mind, they all have some implicit trust assumptions. As a result, we conclude that the only previously known undeniable attester is the trivial one (similar in efficiency to the certificate revocation lists) with attestation lengths (jSj log jSj). A good example of an attester that is not undeniable is the sorted hash tree attester, defined in Section 4.4. Sorted hash tree attesters are based on an efficient construction similar to the certificate revocation trees. We show in Section 4.4 that sorted hash tree attesters are not undeniable and therefore a sorted hash tree attester-based certificate management system makes it possible for the CA to cheat clients. In Section 5, we propose a very simple efficient authenticated search tree-based construction of undeniable attesters that we call an authenticated search tree attester. The key difference between sorted hash tree attesters and the proposed construction is that authenticated search tree attesters assign to every internal node v of a search tree a hash value S[v], taken over the labels of v's children and the search key of v. (In sorted hash tree attesters, S[v] does not authenticate the search key of v.) Moreover, authenticated search tree attesters are in several aspects more intuitive than sorted hash tree attesters: Being directly based on search trees as they are generally understood in computer science, they allow us to carry over to cryptography the research done in the area of algorithms and data structures [Knu98]. As such, the proposed undeniable attester might have surprisingly wide applications in different security applications, and not only in certificate management. After defining new attester, we will prove that it is undeniable. As with any new cryptographic primitive it is good to know how it relates to previously known prim- itives. A proof that undeniable attesters exist if and only if collision-resistant hash functions exist is presented in Section 5. We show in Section 5.4 that our methods can be extended to multi-field records. First, we can think of every x 2 S as composed of two parts, a unique key and a body. Searching can be performed only by looking up the key; the authenticated search tree attester can be modified to enable detecting the case when the key is not unique. Further extensions are possible. These extensions provide also a better answer to natural question what exactly is a candidate string x in the case of certificate management. We purposefully have not yet specified this: x could be certificate serial number, but also a hash of whole certificate, whatever is more relevant in practical applications. However, the best solution might be to let the unique key to correspond to serial number, and the body to correspond to the hash of whole certificate. In Section 6, we will provide efficiency analysis of the authenticated search tree attester. We show that attestations in the authenticated search tree can be compressed, under ideal conditions, by a factor of 2; this makes authenticated search tree attester almost as space efficient as the sorted hash tree attester. While this method is straight- forward, the authors are unaware of any previous constructions that use the same technique to compress search trees. Moreover, it is unusual to apply standard compression methods to make cryptographic primitives more space efficient. The attestation compressing method given in Section 6 might be of independent interest. Terminology. We have intentionally chosen to use slightly nonstandard but self-consistent terminology. In particular, we have tried to avoid overloading already notoriously overloaded terms "certificate" and "proof" and relatives, by introducing the term attestation. We use the more concrete term certificate management instead of "PKI". (Certificate management denotes usually the process whereby certificates are managed and used, while the PKI refers to the entire framework established for certificate man- agement.) Motivations Our research is motivated by the observation that for long-term authenticity and non-repudiation of digital documents, new methods are necessary for verifying whether identity certificates (bindings between a person and a signature key) were valid at some moment of time. Since many digitally signed documents (e.g., loan agreements) may have important legal value for decades, it would be desirable to ensure that validity information of certificates cannot be forged by anybody, including the authorities. We aim at construction of an accountable certificate management system, where all forgeries by third parties can be explicitly proven and all false accusations explicitly disproven [BLS00]. More precisely, we would like the only part of certificate management (physical visit of a person to an authority) that clearly cannot be mathematically modeled also to be the only stage in the system that needs some non-cryptographic solution (i.e., involving physical presence of a client-chosen notary) to trust problems. If visits were "correct", the system should need no auditing anywhere else. In partic- ular, clients should be able to discover if the CA has maliciously issued new invalid certificates or removed valid certificates that are still valid. Long-term certificate validity can be partially ensured by the methods of time-stamping [HS91, BLLV98], where absence of a proof that a certificate was issued is implicitly counted as the proof of its nonexistence. However, such an assumption is clearly undesirable in many situations. We would like to have not only explicit positive attestations stating that valid certificates are valid, but also explicit negative attestations stating that non-valid certificates are not valid. In this way, all disputes regarding the validity of a certificate could be solved based on the present evidence (a positive or a negative attestation), given that it is intractable for anybody to create a pair of contradictory attestations. From now on, we will work in a setting where the CAmaintains a dynamic database S of valid certificates. See [Riv98, GGM00] for argumentation why a database of valid certificates is better than a database of revoked certificates. In our case, database of revoked certificates would just add unnecessary complexities to the system. The presence of a central authority lessens the communication complexity of the scheme and simplifies tracking of the origins of frauds. Our model also includes the Publication Authority [BLS00] and a (possibly huge) number of clients. We assume that every client receives a positive (resp. negative) attestation from the her certificate x belongs (resp. does not belong) to the database S of valid certifi- cates. This assumption is not restricting, since some sort of attestation-or receipt-is returned to the client by the CA in every certificate management system. In our sys- tem, it is in client's own interest to store the attestation so that he can later explicitly prove or disprove the validity of his certificate at some time. Additionally, everyone can make membership queries of type "x 2 ? S" to the CA, who then returns an attes- tation. Clients who want later to use an attestation p of "x 2 S" (or of "x 62 S") as evidence in court, should obtain it from the CA in some suitable time-frame. This is very similar to what is done in time-stamping [BLLV98, Lip99]. A digest of database S (denoted as D(S)) is published by the Publication Authority in some authenticated and widely available medium by using accountable publishing protocols [BLS00]. Motivations behind this are the same as in time-stamping [HS91, BLLV98, BLS00]. First, without authenticated information about the database, the CA can easily create contradictory attestations. Second, long-term authenticity should not depend on the security of private keys [HS91]. Publishing the digest is the most natural and widely accepted solution in digital time-stamping to achieve the long-term authenticity. Third, nobody should be forced to store old versions of the dynamic database S: The system should still be accountable, if a verifier does not have anything more than an element, a short attestation, and a short digest of the database. This is again very similar to the situation in time-stamping, where clients can verify a time stamp given only the time stamp (equivalent to the attestation), the round stamp (equivalent to the digest), and the candidate element itself [HS91, BLLV98]. Our model of accountable certificate management incorporates at least three different algorithms. Motivated by this, we define a new primitive, attester, to be a triple algorithms. The proving algorithm P , given a candidate string x and a set S, outputs an attestation. The digest algorithm D, given a set S, outputs a short digest of the database. Finally, the verification algorithm V takes as input a candidate element x, a digest d, and an attestation p, and accepts or rejects depending on whether x belongs to a set S such that In described model, the CA cannot cheat a client. (We assume that Denial of Service attacks by the CA, where the CA does not return an attestation to the client, can be prevented for example by letting a client-chosen notary to participate in handing over the attestation.) That is, if a client has a positive (resp., negative) attestation that some certificate belonged (resp., did not belong) to the database of valid certificates at some time, the CA has no means to generate a contradictory attestation, claiming that the same certificate was not (resp. was) in this database at that time, assuming that the CA is not able to break some underlying cryptographic primitives. More formally, we call an attester undeniable, if it is intractable to generate a set S, an element x and two attestations p and p such that V (x; D(S); p) accepts but V (x; D(S); p) rejects. For long-term authenticity undeniability is crucial-e.g., when the CA who issued a concrete certificate might have gone bankrupt long before the verification act, so that it is impossible to sue her for cheating. Moreover, if a client has accidentally deleted his attestation, he can at least be sure that nobody else can sue him, based on a contradictory attestation. These properties will significantly increase the trustworthiness of the CAs. Application in Court The relevance of undeniable attestations can probably be best exemplified by the next application. If a digital signature law is passed in some country, it becomes natural to expect that digital signatures would then be considered as legally valid as handwritten ones. In particular, one should be able to solve legal disputes based on the validity of a particular signature on a particular document. As is well known, one needs certificate management for that in order to determine the validity of the digital signature. However, one often overlooks the real process in court, where a person presents to the judge a piece of evidence, which in this case is a signed document together with a certificate. The judge cannot take an action, based on the evidence (that we call an attestation) alone, if it is possible for somebody else to create counterevidence (that we call the contradictory attestation). For example, certificate revocation list can be seen as counterevidence. Currently, it is almost always possible, at least for the CA, to create counterevi- dence. Therefore, court's decisions often base on heuristics that involve trust in some authorities, eyewitnesses or other human beings. In the case of digital signatures, the definition of eyewitnesses is unclear, and one might not want to trust the authorities. Not only is it possible that the authorities might be corrupted, but a malicious client could also claim that a honest authority is guilty. In such cases the judge cannot take an action, since the authority might or might not be guilty. If it is intractable to create a counterevidence even for the authorities, the court can always authoratively decide a case, based on evidence. By doing this, the judge does not have to trust anybody, and everybody can also check that judge's actions are correct. The latter means that one cannot question ambiguous actions of court related to digital signatures, and hence there is no reason to appeal to a higher court if the actions of the the lower court were provably wrong. Separation of Duties Functions of the CA should be divided between at least two authorities, an off-line CA, and an on-line Validation Authority, as it is done also in many other certificate management systems [CL96]. However, while the distinction between the CA and the Validation Authority is important in practice, it is not a subject of this paper: Since our methods help to prevent forgeries even in the case when one possibly misbehaving party (the CA) has control over the whole system, it also prevents forgeries if there are several third parties. For simplicity, in this paper we will not stress separation between the authorities. For the same reason, we do not elaborate on the accountable publication protocols but rather refer the reader to [BLS00] for necessary information. 3 Formal Definitions 3.1 Preliminaries 1g. As usually, k denotes the set of k-bit words, := . For denotes string of k -s. From now on, k denotes the security parameter, relative to which security of various schemes is measured. We assume that nil is a special encoded differently from any x 2 . Let EA be the class of probabilistic algorithms with execution time that is polynomial in the length of their first input. A family negligible if for all " > 0 there exists a Notation X S means that X is assigned according to the probability space S that may be the output space of some probabilistic algorithm. A collision-resistant hash function (CRHF) H for some index set I is a pair (G; H), such that (1) G 2 EA is a generation algorithm, such that G(1 k (2) For an index i 2 I , H(i; polynomial p, where p(k) > k; (3) For all algorithms A 2 EA, the probability family CRHH (A) is negligible in k, where Note that index i is only necessary when one requires H to be collision-resistant. Otherwise one can assume that jI 3.2 Definition of Attester We have already given informal definitions of attesters. Next, we present the full for- malism, followed by discussion. is an attester for an index set I , if there is a polynomial f , f(k) > k, such that 1. A generating algorithm G 2 EA takes as input a security parameter 1 k and outputs an index i 2 k \ I . 2. A proving algorithm P 2 EA takes as input an index i, an element x 2 k and a set S k , jSj f(k) and outputs an attestation P i (x; 3. A digest algorithm D 2 EA takes as input an index i, a set S k , jSj f(k) and outputs a digest D i 4. A verification algorithm V 2 EA takes as input an index i, a candidate element digest d and an attestation p and outputs We require that if i 62 k \ I , S 6 k , jSj > f(k) or x 62 k , then for any p, V i (x; D i (S); practice, one should set D i Otherwise, for any S k with jSj f(k), and for any x 2 k , outputs Accept if x 2 S and Reject if x 62 S. be an attester and let A 2 EA. Let x and Attester A is a collision-resistant prover (resp. collision-resistant disprover) if 8A 2 negligible. A is a collision-resistant attester if for any A 2 EA, both CRPA (A) and CRDA (A) are negligible. undeniable if for any A 2 EA, UNA (A) is negligible. 3.3 Discussion Note that in the definition of attesters the role of generating function and indices is the same as in the definition of hash functions. Namely, they are not necessary unless we discuss strong security properties like collision-resistance and undeniability. Otherwise we can assume that jI In informal treatment, one can omit I at all. However, in our constructions of undeniable attesters we have to assume that the used hash function is collision-resistant, which automatically introduces need for the index set I in the formal treatment. It is important to understand the seemingly subtle but crucial in applications difference between collision-resistant attesters and undeniable attesters. Collision-resistant attesters assume that a verifier has access to the correctly computed value D i (S). In practice, it means that she either has to rely on some trusted third party to provide a correct D i (S) or has to have access to S herself. Both possibilities are undesirable in many security applications, including accountable certificate management. Undeniable attesters stay secure even in the presence of an adversary who forges the digest, and therefore potentially provide a much higher level of confidence in the system. In practice, S is organized as a certain data structure. In many cases, attester is just a security add-on to this data structure. We will see this in Sections 4.4 and 4.3, where attesters will be based on corresponding types of trees. Therefore, we will often use the terminology of data structures in the context of attesters. For example, one would like an attester to have "succinct" attestations and digests but also fast average-case update time of the data structure. Informally, we say that an attester is dynamic if average-case time per insertion and deletion of elements to the corresponding data structure is O(jij log jSj) for any i 2 I . We say an attester is succinct if for any i 2 I , log jSj). Note that since attester has jD i 4 Some Known Constructions Next, we will give a short survey of some attesters based on previously proposed ideas. Table 1 summarizes the properties of attesters described in this section, together with authenticated search tree attesters described later in Section 5. Note that the hash tree attester and the RSA attester are not succinct, since they have negative attestations of length (jSj log jSj). However, one can easily modify both attesters to be succinct, by Primitive type Name Digest Positive attestation Negative attestation Length in () A List (x4.1) k n log n n log n Hash Tree CRA Sorted Hash Tree UA Authenticated Search Tree Table 1: Some known succinct attesters, i.e., security is given only for the succinct versions (see Section 3.3). For example, while the list attester is an undeniable attester, it is only a succinct attester. Here log n is the security parameter. defining to be equal to some fixed constant for all x 6= S. Both the modified hash tree attester and the modified RSA attester are succinct collision-resistant provers. A similar trick does also work with the list attester, but the resulting succinct construct will only be attester without satisfying any stronger security requirements. As emphasized in Section 2, in accountable certificate management we are interested in undeniable attesters. In the following we will briefly explain why already known attesters fail to satisfy our requirements. The main result of this paper is the provably secure authenticated search tree attester, described in Section 5. List attester is the most trivial attester. For any x and a set S, attestation P (x; S) is D(S) is equal to a short k-bit hash H(S) of S, where H is a collision-resistant hash function. (Remember that k is a security parameter.) The verification algorithm V , accepts if and only if S). The resulting construction is clearly undeniable. Unfortunately, the list attester becomes utterly inefficient if the number of simultaneously valid certificates grows, since both storage requirements and verification time are at least linear in jSj. One of the possibilities to decrease the verification time is to assume that the CA has sorted the database. Although then the clients can perform a binary search in the database, the attester will cease to be undeniable since the CA may leave the database unsorted. This method would also not reduce the storage requirements 4.2 RSA Attester The RSA attester can be in a natural way built upon the RSA accumulator [BdM93, BP97]. Here, the positive attestations have the form for some y therefore the attestation length is (k), where k is again a security parameter. The digest has the same form and therefore also the same length. However, as first pointed out by Nyberg [Nyb94, Nyb96], the length of the attestations can be reduced by introducing built-in trapdoor information known to some coalition of participants, which should therefore be trusted. The best known method [San99] of making the RSA accumulator trapdoorless introduces attestation lengths of order log jSj, the trapdoorless RSA accumulator has longer attestations than the sorted hash tree attester, described below. Moreover, the negative attestations are equal to all of S. 4.3 Hash Tree Attester Hash trees [Mer80] are widely used to authenticate an element as a set member. In the full generality, the hash tree is a labeled tree, with the leaves labeled by different values nodes labeled by the hash over their children labels, where a fixed collision-resistant hash function is used. In the hash tree attester, a positive attestation consists of the minimal amount of data necessary to verify the hash path from the leaf, labeled by x, to the root. We assume that the hash trees used have depth logarithmic in the number of nodes. As a result, the positive attestations have length (k log jSj), where k is again the output length of the used collision-resistant hash function. The digest D(S) of length (k) is equal to the label of the root. On the other hand, negative attestations must include every element of S an have hence length (kjSj). 4.4 Sorted Hash Tree Attester Similarly to the case of the list attester, hash tree attester can be made more efficient if the CA sorts the leaves, an idea only recently proposed in [Koc98, NN00]. (We assume that the values stored at the leaves are sorted from left to right.) The resulting sorted hash tree attester has both negative and positive attestations with length (k log jSj) and is therefore succinct. However, as also in the case of (sorted) list attester, the proposed solution hides in itself an implicit assumption that the CA dutifully sorts the leaves. Since the observed weakness in sorted hash trees is a crucial motivation to our subsequent work, we will next give a detailed definition of sorted hash tree attesters together with a full explanation of their weak points. 4.4.1 Construction The next attester (G; is based on a fixed CRHF H). The only role of the generating function G in this attester is to choose a concrete hash function H i from this family, according to the function GH . Therefore, for the sake of simplicity, we will describe attesters for a fixed i 2 k \ I and for a fixed hash function . The latter can in practice be instantiated with SHA-1 [NIS94] or any other strong (keyed) hash function. Let f be an a priori fixed polynomial that does not depend on k. Next, suppose that is a nonempty set of k-bit integers such that S[j] < S[j +1] for any 1 j < n. Let T be a (directed) binary tree with n leaves, Figure 1: A toy example of the sorted hash tree attester. Dashed lines are present only in the improved sorted hash tree attester, described in Section 4.4.2. The values S[v] are given for the unimproved construction. For the ease of illustration we have chosen all vertices to be elements of Z, although the concrete values of v's are not important in practice. with its jth leftmost leaf labeled by S[j] (Figure 1). A non-leaf vertex labeled by an auxiliary hash value where v L (v R ) denotes the left (right) child of v. The digest of S is equal to the label of the root vertex v, or to Error, if the leaves were unsorted, jSj > f(k), or some leaf had a label S[v] 62 k . with 0 corresponding to the left and 1 corresponding to the right direction. The verification algorithm V (x; d; p) returns Error if p does not have such form. Otherwise, V computes dm by assigning d 0 := x and then recursively, for every j > 0, Verification returns Accept, if d d, and Error, otherwise. If x 2 S, the proving algorithm P returns a p such that V (x; d; p) accepts. Proving that x 62 S is equivalent to finding a quadruple correspond to two neighboring leaves in the tree T . If x is smaller than the least element x 1 of S, we can define P (x; S) to be equal to P The situation when x is bigger than the greatest element of S is dealt with analogously. Looking at the tree depicted in Figure 1, and P (35; On the other hand, Figure 2: A toy example of improperly created sorted hash tree attester. 4.4.2 Further Efficiency Improvements One can further shorten the negative attestations by inserting additional arcs to the underlying tree as follows (slightly different methods were also proposed in [Koc98, If the parents of a leaf v 6= 1 and its left neighbor leaf w are different, then add an arc from w to v's parent, as in Figure 1. Build an attester upon the resulting graph, by modifying the algorithms P , D and V to account for the new arcs. Let the negative attestation of x be equal to the positive attestation of the smallest x 0 > x in set S if such x 0 exists, or of the x, otherwise. As the result, both negative and positive attestations will have the same length. 4.4.3 Sorted Hash Tree Attester is not Undeniable Sorted hash tree attester is succinct, dynamic (if built upon dynamic trees) and collision-resistant. However, it is not undeniable. We show this by the example depicted in Figure 2. There, the positive attestations of 10, 40 and 20 are respectively also a negative attestation of 20. Therefore, a verifier, given the digest S[7] (root of the hash tree), accepts or rejects 20 depending on which attestation was earlier submitted to her. The same is also true for improved sorted hash tree attesters. Such "unsorting" attack is possible since there is no efficient way for the verifier to check whether the CA dutifully sorted the database. The only obvious possibility to prevent this attack, without involving another trusted third party, is to send the entire database of total size jSj log jSj to the verifier. The verifier would then recompute the tree, verifying that this database in the sorted order results in digest d, obtained by her beforehand from a reliable source. However, such solution is clearly impractical if jSj is large, since the verifier has to do jSj 1 hash computations per every verifi- cation. Moreover, such a solution is impossible if some elements in the database are inaccessible (if, to lessen the storage requirements, the old versions of the certificate database are not stored). Intuitively, the need to send the entire database is caused by the fact that a candidate string x can be a label of any leaf, and therefore a negative attestation should incorporate all positive attestations. To understand it, think of searching from an unsorted database S. Showing that x belongs to S is accelerated by presenting an index j (an attestation) of x's occurrence, followed by checking that the jth element is equal to x. However, if x does not belong to the database, one has to verify for each j that the jth element is not equal to x. Therefore, a corrupted CA may easily build an unsorted hash tree without being detected by anyone who does not possess a copy of the whole S. 5 Authenticated Search Tree Attester Next, we give a construction of what we call authenticated search trees. After that we show that the resulting attester (authenticated search tree attester) is an undeniable attester, and finish the section with some discussions. First, let us remember that a directed binary tree T is a search tree [Knu98, Section 6.2.2] if every node v 2 T has a unique search key K[v] associated to it, such that if w is the left (resp. right) child of v, then K[w] < K[v] (resp. K[w] > K[v]). 5.1 Construction Let f be some a priori fixed polynomial. We give, as in Section 4.4, a construction for fixed k. and for fixed i 2 k \ I . Let S k be a nonempty set and let T be a binary search tree with jSj vertices. Each vertex v of T is labeled by a pair (K[v]; S[v]). Here, the elements K[v] belong to the set S and K[v 1 . Moreover, the tree T together with keys K[v] is a search tree. The value S[v] is equal to equal to the label S[] of the v's left (resp. right) child if the corresponding child exists, or to nil, otherwise. For example, if v is a leaf, then Once again, the digest D(S) is defined as S[v], where v is the root vertex, or as Error, if T is not a proper search tree, in particular, if jSj > f(k) or for some leaf v, S[v] 62 k . For a x 2 S (resp. x 62 S), the attestation P (x; S) is defined as the least amount of data necessary to verify that v, given that T is a proper search tree). Intuitively, following an attestation of x 2 k is equivalent to searching x from a search tree, where the usage of hash functions in the vertices guarantees that the CA has to work with the same tree during each query. Moreover, the verification algorithm V returns Error if the tree is not found to be a proper search tree. The rest of this subsection gives a more technical definition of the authenticated search tree attesters, including the necessary (local) verifications that T is a search tree. It is necessary to perform these verifications for the authenticated search tree attester to be undeniable, and therefore to avoid any fraud. Let where all the elements are from k , and m 0. The verification algorithm V (x; d; p) returns Error if (1) h L 6= nil and x < k 0 , or (2) h R 6= nil and x > k 0 . Naturally, V also returns Error if the attestation p does not have the specified form. Otherwise, V Figure 3: A toy example of authenticated search tree. Note that vertices can be enumerated arbitrarily. For the ease of illustration we have chosen all vertices to be elements of Z, although the concrete values of v's are not important in practice. assigns d 0 := H(h After that, V outputs Error if Otherwise, V returns Accept or Reject, depending on whether k If x 2 S, the algorithm P (x; S) returns a list p such that V (x; D(S); p) accepts. As we will see below, such a p is easy to find. If x 62 S, P (x; S) finds (1) An element x 0 , such that x 0 is the greatest element x 0 x (the predecessor of x), if such x exists, or the smallest element in S, otherwise; (2) An element x 00 , such that x 00 is the smallest element x 00 x (the successor of x), if such x exists, or the greatest element in S, otherwise. By the construction of search trees, either x v 00 on the root path starting from the node with sorting key x 0 , or vice versa. (Otherwise P (x; S) returns returns a list p such that V x 0 in the first case and x in the second case. Clearly, V (x; D(S); p) accepts if and only if x 2 S. Note that the verification returns Error only if the tree fragment, reconstructed from p, cannot be a part of a search tree. toy example with is depicted in Figure 3. Here, This attestation contains the predecessor and the successor of 41 (40 and 42, resp.), 42 (42 and 42, resp.) and 43 (42 and 56, resp. 5.2 Security Theorem 1 The authenticated search tree attester is undeniable if H is a collision-resistant hash function family, where the reduction is security preserving in the next meaning. Let A 2 EA be an algorithm, s.t. UNA ". Then there exists an adversary Proof. The adversary M is defined as follows. Given an index i and the security parameter performs a query to A(1 k ; i). With probability ", this query outputs a tuple (x; d; p; p), such that V i (x; d; Reject. Therefore, Analogously, we will overline the variables d j that are computed during the verification of p. The adversary processes p and p in parallel. From (ST1) d Therefore, using (ST2) we get that for some s and s, (Remember also that nil 62 k ). Next, if k s 6= k s , then M has found a collision H i let us assume, without loss of generality, that x < k has found a collision H i (d s Therefore, the adversary M finds a collision to H with probability ". Note that M works in time (t log jSj), where t is the working time of A. ut As with any new cryptographic primitive-and undeniable attester is a new primitive-it is good to know how it relates to the previously known primitives. Next results establish the relationships between collision-resistant attesters, undeniable at- testers and CRHFs. undeniable attester is a collision-resistant attester. Proof. Let A be a machine, such that either CRPA or ". Next we construct an efficient machine M that has UNA returns (x; d; p; p), if otherwise. queries once the algorithms G(1 k ), in constant time. With probability " k , either (a) x 62 S k , but Reject. Therefore, UNA Note that the construction in Section 4.4 showed that not each collision-resistant attester is undeniable, and hence the opposite of this lemma is not true. Theorem 2 Undeniable attesters exist if and only if CRHFs exist. Proof. Let be an undeniable attester. By Lemma 1, A is also collision-resistant. Next, we show that if A is collision-resistant, then (G; D) is a CRHF on 2 k (i.e., on the subsets of k ). Let A 2 EA be an adversary, such that Let M be the next machine. For i). With the , we can efficiently find an element x in (w.l.o.g.) S 1 nS 2 . Let p := P i By the definition of attesters, Thus, we have found a tuple (x; Accept. A contradiction, and thus D i is a CRHF on sets (i.e., on 2 jij , or alternatively, on concatenated strings S[1]S[2] S[jSj], where We finish the proof by constructing a CRHF on the input domain as follows. Let p(k), be an arbitrary string, such that p(k). (It is sufficient to look at strings with length dividing k log 2 p(k), due to the constructions presented in [Dam89, Mer89]. Now denotes a k-bit binary fixed representation of i 2 N . Clearly, if D is a CRHF on the domain 2 k , then H is a CRHF on domain . The opposite was proven by Theorem 1. ut 5.3 Discussion The construction of Section 5.1 generalizes to the case when the underlying tree is a multiway search tree [Knu98, Section 6.2.4]. However, if we wish the attestations to have length O(k log jSj), we are restricted to the trees where the number of children of every node is upper-bounded with some constant that does not depend on k. As a result, we cannot base our construction on exponential search trees and other related data structures that have been lately extensively used in sub-logarithmic search algorithms [BF99]. Authenticated search trees can be made dynamic as in [NN00] by requiring that the CA stores the whole hash tree, and after each database update updates all the necessary hash values in the tree, including the value D(S). Updating can be done in time O(k log jSj) by using appropriate dynamic search trees (say, AVL or 2-3 trees but also skip lists). Since our construction is just a slight reformulation of what is usually meant by search trees, and most of the "reasonable" data structures for searching can be seen as search trees, one can choose the data structure that is the most convenient in a concrete application. There are many other possible constructions of undeniable attesters. For example, one could add a number of arcs to a binary tree as follows: For any non-leaf node v, add an arc (if it already does not exist) from its left child's rightmost descendant leaf to v. We emphasize that the main difference between the described constructions of collision-resistant and undeniable attesters is that in the first case the choice between the left and the right subtree is just done by an explicitly given bit b i . In the latter case, there is instead an explicit search key K[v], such that based on K[v], the verifier can additionally check that the element returned in a query is in the correct location in this tree. 5.4 Extensions to Multi-Field Records Both our definition of the attesters and the construction of authenticated search trees were given for the case when the database S consists of some indivisible records x. However, quite often one works in a situation where x is composed of several fields. For example, in many cases the first field key(x) acts as a unique key to the entire record In such a case, there is a need for a set of algorithms allowing the database maintainer to commit to the value of S in such a way, that The clients can perform a query S, to which the response is either body(x) if the database S contains a unique record with the key key(x) or Undened if there is none; It is intractable for the database maintainer to give different answers to queries for the same key key(x) (thus the response of the CA has to contain some kind of proof). The authenticated search tree can be used to construct the necessary primitive. The database S is organized as an authenticated search tree; the algorithm D is left un- changed. If there exists a y for which key(x)jjy 2 S then let x 0 be the predecessor of key(x)jjy and x 00 be the successor of key(x)jjy in S. Otherwise, let x 0 be the predecessor and x 00 be the successor of key(x)jj0 t in S. (If The attestation P (key(x); S) is equal to P some well-defined presentation. Given negative attestation, the verification procedure additionally checks that and that there are no elements x with in the tree, and returns Error if this is not the case. Given positive attestation, the verification algorithm additionally checks that that there are no elements or in the tree, and that there is some key(x)jjy 2 In both cases, (non-)existence of such x can be efficiently verified, because the positions of the vertices labeled by x 0 , key(x)jjy and x 00 in the search tree can be determined from the attestation. More generally, one could use authenticated k-d trees to perform multidimensional queries. Here, authenticated k-d trees are natural extensions of authenticated search trees to Bentley's k-d trees [Ben75, Ben79] for handling databases with k fields. As shown by Bentley, k-d trees can be balanced to have depth (log jSj), in which case it takes O(jSj 1 t=k ) steps to find all records with t fields equal to specified values, and steps to find all elements in a t-dimensional subspace, when there is q such elements. (See [Knu98, Section 6.5] for more information.) In the context of certificate management, one could take, for example, key(x) to be equal to the unique certificate serial number, while body(x) would be the hash of the whole certificate. 6 Efficiency 6.1 Average-case Attestation Length For a fixed size of S, authenticated search trees result in the shortest worst case attestation length if the underlying tree T is a complete binary tree. In this case, if we additionally assume that the search keys have length k-in practice, we store at leaves the hash values of certificates that are generally longer than k bits-then the worst case attestation length is k simple calculation shows that the attestations P i (x; S) have in total 1 which makes the average-case attestation length equal to This is about twice as much as the attestation length in the complete binary tree based (improved) sorted hash tree attester. Also, in general, upon other types of trees, our construction has on average twice longer attestations than the optimal construction of collision-resistant attesters presented in Section 4.4.2. When using the dynamic AVL trees [Knu98, Section 6.2.3], the worst case certificate length of the dynamic authenticated search tree attester is therefore 2:88 k log n. 6.2 Attestation Compression Next, we describe a method for compressing the attestations. More often than not, compression algorithms are seen as consisting of two standard parts, modeling and coding [BCW90]. An adaptive modeling algorithm estimates the source from the part of the data sequence seen so far, by outputting a probability distribution for the new symbol. After that, an encoder (say, the arithmetic encoder) uses this distribution to encode a new symbol by using as few bits as possible. We can apply this general approach to the authenticated search trees. First, let T be a fixed search tree, and let k be the security parameter. We remind you that the elements of S are k bits long. During the modeling, we assign to every node v recursively a range As previously, let min S 0 be the least and let maxS be the greatest element in S. If v is the root vertex, then (' let v be an arbitrary vertex. To the left child v L (if existing) of v, we assign a range (' v L 1). Analogously, to the right child v R (if existing) of v we assign the range (' v R every root path in T can be seen as a data sequence. For a node v in this sequence, the adaptive modeling algorithm returns the uniform distribution in (' v ; u v ) to the encoder. After that, the encoder encodes the value K[v] ' v as a binary number K c [v], using dlog 2 (u v ' v )e bits. The compressed attestation P c (x; S) is equal to the uncompressed attestation P (x; S), with search keys K[v] replaced with corresponding compressed keys K c [v]. We additionally assume that the new digest D c (S) is equal to the triple (D(S); min Verification still needs the uncompressed attestation which can be easily computed from P c (x; S). Not surprisingly, the fact that all intermediate values K[v] can be unambiguously reconstructed from P c (x; S) is crucial for undeniability, and guided us during the choice of the encoder. Some more efficient encoders that we are aware of do not guarantee unambiguous reconstruction of all intermediate values, especially since the verifier has no previous knowledge about the tree T . Assuming that T is a complete binary tree, the uncompressed attestations have the length is the height of T . The compressed attestations are never longer than k(n +n. The worst case is obtained if 2g. (We will not count in the short additional data necessary to encode the lengths of K[v]'s. One could use, for example, Elias !-codes [Eli75] for the latter.) This provable gap between the worst case length of the compressed and uncompressed attestations is achieved thanks to the implicit structure hidden in the ordered data. However, the value kn n 2 +n unexpected quantification of the amount of this structure. On the other hand, the attestations never shorten by a factor greater than two and therefore the authenticated search tree attester has longer attestations than the sorted hash tree one. However, the factor can be arbitrarily close to 2 when k n. As an example, let us look again at Figure 3. The root path from the root to the leaf with label has nodes with search keys K[v 1 Computing the ranges, we find that (' v 1 Therefore (as previously, we denote the n-bit binary encoding of m as hmin ), K c and jP c (42; the compression gain is 1:754 9=5. While this is an unrealistic example due to maxS min S (remember that the elements of S are collision-resistant hashes of certificates. When the hash function is modeled as a random function, maxS min S holds with a negligible probability), it shows that this compression method can result in quite big savings already for small n-s. In real life situations an example with database of that size might be typical in future certificate management systems in middle-sized countries), depicted by Table 2, is more appropriate. 6.3 Optimality Questions The classical predecessor problem requires one to maintain a set S so that the queries of the form "Is j an element of S and, if not, what element of S, if any, is just before it Method Attestation length in bits Collision-Resistant Attesters Sorted hash tree k(n Undeniable Attesters Table 2: Comparison of the worst-case attestation lengths of collision-resistant and undeniable attesters in bytes, where in sorted order?" may be answered efficiently. Membership problem only requires that the question "Is j an element of S?" may be answered efficiently. There exist extremely efficient dynamic attesters if one does not require them to be collision-resistant. On the one hand, let A be an arbitrary attester, such that f i , where works in the worst-case time t f;jij . Straightforwardly, there exists a search algorithm working in time t D which solves the membership problem. On the other hand, according to the results of [DKM + 94] for search algorithms solving the membership problem, there exists a dynamic attester, such that for any S k and for every x 2 (Define only if x 2 S, and fix D i (S) to be the empty string). However, both the sorted hash trees and our authenticated search trees do not solve only the membership but also the predecessor problem, since the attestation P (x; S) always contains the predecessor of x, if it exists, or the smallest element in S. An interesting open problem is whether this is really necessary. Conclusions The approach to certificate management in this paper is straightforward: First we went back to the source (in our case, the legal system, and more precisely, the court), then we identified why certificate management is necessary there and how to minimize the number of frauds; in our case, this was achieved by making it infeasible to create coun- terevidences. We then gave a rigorous definition of necessary cryptographic primitives (undeniable attesters), and described and analyzed an efficient undeniable attester, the authenticated search tree attester. We showed that the latter is almost as efficient as less secure sorted hash tree attesters, by using a simple (but novel) compression technique. The resulting certificate management system has many desirable properties. It is accountable, since all disputes can be solved by the present undeniable evidence. This means in particular that all forgeries by the third parties can be explicitly proven and all false accusations explicitly disproven. It is efficient, since certificate validity can be verified, given only the certificate, a short digest of the certificate database and a short attestation. Apart from the model of accountable certificate management system, the second main result of this paper is a construction of undeniable attesters. Undeniable attesters may become a very useful security primitive, since they make it possible for anyone to perform securely membership (and predecessor) queries without relying on the trusted third parties nor requiring an access to the whole database. We stress that the current paper provides a model of certificate management, not a complete system, and that more work is needed for making the certificate management really accountable. More precisely, our system guarantees that it is intractable to create a certificate database S, such that if x 2 S (resp., x 62 S), the CA can create an attestation certifying that x 62 S (resp., x 2 S). In practice, S is dynamic and the may remove valid certificates or insert invalid certificates from S at his will. Such malpractice can be detected, for example, if interested parties ask attestations of x 2 ? S every time S is updated. One possibility would be to introduce another trusted party (or a set of volunteers), who would compare the changes between the subsequent versions of S with official documentation provided by the CA and notaries about the physical visits of clients. However, it would be desirable to find more efficient protocols for this purpose. (See [Sar00] for some preliminary analysis.) Further Work Strict optimality of our constructions is left as an open question. For example, since it is easier to solve the membership problem [DKM than the predecessor problem [BF99], it would be interesting to know whether succinct undeniable attesters can be built upon the search algorithms solving the membership problem. Elaboration of exact protocols and duties of different participants in accountable certificate management is of utmost importance. Finally, what benefits would be gained by using authenticated search trees instead of sorted hash trees in other areas of data security? As an use example, results of the preliminary version of this paper [BLL00] have already been used to build a secure key archival service in [MB02]. Acknowledgments The authors were partially supported by the Estonian Science Foundation, grant 3742. The first author was partially supported by the Estonian Science Foundation, grant 4760. A preliminary version of this paper was published as [BLL00]. We would like to thank Andris Ambainis, Carl Ellison, Kobbi Nissim, Berry Schoenmakers, Stuart Stubblebine and anonymous referees for useful comments that helped to improve the paper. --R Text Compression. Multidimensional Binary Search Trees Used for Associative Searching. Multidimensional Binary Search Trees in Database Applications. Optimal Bounds for the Predecessor Prob- lem Accountable Certificate Management Using Undeniable Attestations. Optimally Efficient Accountable Time-stamping Niko Bari A Certification Scheme for Electronic Commerce. A Design Principle for Hash Functions. New Directions in Cryptography. Friedhelm Meyer Auf Der Heide Universal Codeword Sets and Representations for the Inte- gers In Hideki Imai and Yuliang Zheng How to Time-stamp a Digital Document The Art of Computer Programming. On Certificate Revocation and Validation. Toward a Practical Public-key Cryptosystem Secure and Efficient Time-stamping Systems Enabling the Archival Storage of Signed Documents. Protocols for Public Key Cryptosystems. One Way Hash Functions and DES. Certificate revocation and certificate up- date Commutativity in Cryptography. Fast Accumulated Hashing. Can We Eliminate Revocation Lists? Efficient Accumulators without Trapdoor. Analysis and Application of Accountable Certificate Man- agement --TR Text compression A design principle for hash functions One way hash functions and DES Dynamic Perfect Hashing One-way accumulators The art of computer programming, volume 3 Optimal bounds for the predecessor problem Accountable certificate management using undeniable attestations Multidimensional binary search trees used for associative searching Enabling the Archival Storage of Signed Documents Efficient Accumulators without Trapdoor Extended Abstracts Time-Stamping with Binary Linking Schemes A Certification Scheme for Electronic Commerce Can We Eliminate Certificate Revocations Lists? On Certificate Revocation and Validation Fast Accumulated Hashing Efficient and Fresh Cerification Optimally Efficient Accountable Time-Stamping --CTR Glen Nuckolls , Chip Martel , Stuart Stubblebine, Certifying data from multiple sources [Extended Abstract], Proceedings of the 4th ACM conference on Electronic commerce, June 09-12, 2003, San Diego, CA, USA Peeter Laud , Tarmo Uustalu , Varmo Vene, Type systems equivalent to data-flow analyses for imperative languages, Theoretical Computer Science, v.364 n.3, p.292-310, 8 November 2006 Petros Maniatis , Mary Baker, Secure History Preservation Through Timeline Entanglement, Proceedings of the 11th USENIX Security Symposium, p.297-312, August 05-09, 2002
attesters;long-term authenticity;accountable certificate management;search trees;public-key infrastructure;time-stamping;non-repudiation;authenticated search trees
603480
A formal model for an expressive fragment of XSLT.
The extension of the eXtensible Style sheet Language (XSL) by variables and passing of data values between template rules has generated a powerful XML query language: eXtensible Style sheet Language Transformations (XSLT). An informal introduction to XSTL is given, on the bases of which a formal model of a fragment of XSLT is defined. This formal model is in the spirit of tree transducers, and its semantics is defined by rewrite relations. It is shown that the expressive power of the fragment is already beyond that of most other XML query languages. Finally, important properties such as termination and closure under composition are considered.
Introduction XSL [6] is a current W3C [8] proposal for an XML extensible stylesheet lan- guage. Its original primary role was to allow users to write transformations of XML to HTML, thus describing the presentation of XML documents. Nowadays, many people use XSL as their basic tool for XML to XML transformations which renders XSL into an XML query language. It has been noted by the database community [9, 1], though, that the transformations XSL can express are rather limited. For instance, XSL does not have joins or skolem-functions (and, hence cannot do sophisticated grouping of output data). In other words, XSL lacks the most basic property any query language should have: it is not relationally com- plete. However, as the language is still under development, some features have changed over time. Recently various extensions were added to the language [7]. The most apparent ones being the addition of variables and parameter passing between template rules. We show that these additions, together with the use of modes (which are actually states as used in nite state machines and which were already dened in earlier versions of XSL) render XSL into a powerful query language. Indeed, XSL not only becomes relationally complete, but it can do explicit grouping (with or without skolem functions), it can simulate regular path expressions, and it can simulate all other current XML query languages. ? The work of this author was supported by the EC TMR Network GETGRATS. ?? Research Assistant of the Fund for Scientic Research, Flanders. Work partly performed while visiting the University of California San Diego. Contact author of this submission. Actually together with the addition of the new features, XSL was split into two parts: XSL Transformations (XSLT) [7] and XPath [5]. The latter contains the description of XSL's associated pattern language, while the former denes the real transformation language. To emphasize that we are focusing on the transformation part, with the new features, we refer to XSL by XSLT in the rest of this paper. The main source for the denition of XSLT is its specication [7] which is a bit dicult to read, especially when one only wants an impression of how the language works or what it is capable of. To remedy this, we dene an abstract formal model of XSLT incorporating most of its features, but all of those which are necessary to simulate, say, XML-QL. The purpose of this model is two-fold: (i) the clean and formal semantics provides the necessary mathematical model for studying properties of XSLT; (ii) our formal model abstracts away from the actual syntax of XSLT and emphasizes on its features in such a way that the interested reader can get a feeling of the language and what it is capable of. Next, we use this model to gain some insight in XSLT. First, we obtain that XSLT can compute all unary monadic second-order (MSO) structural properties. In brief, MSO is rst-order logic (FO) extended with set quantication and is an expressive and versatile logic: on trees, for instance, it captures many robust formalisms, like regular tree languages [25], query automata [20], nite- valued attribute grammars [22, Moreover, MSO can take the inherent order of children of vertices into account, a desirable property for XML pattern languages [13, 24]. By structural patterns we mean MSO without joins, that is, we cannot check whether the values of two attributes are the same (see Section 4 for details). In fact, Neven and Schwentick [19] showed that, already w.r.t. structural patterns, MSO is more expressive than FO extended with various kinds of regular path expressions. Thus, as most current XML query languages are based on FO extended with regular path expressions, this already indicates that XSLT cannot be simulated by, say, XML-QL. Next, we show that XSLT can simulate most existing XML query languages. To study decidability of type checking, Milo, Suciu, and Vianu [16] dened the k- pebble tree-transducer as a formalism capturing the expressiveness of all existing query languages, including XML-QL [9], XQL [23], Lorel [2], StruQL [14], UnQL [4] and the previous version of XSL. Their model does not take value equation into account (needed for joins, for instance) but can easily be modied to do so. We obtain that XSLT can simulate this model, thereby establishing XSLT to be more expressive than all of the above. For more concrete simulations, we refer the interested reader to [3], were we show how the XML-QL queries in [9] can be expressed in actual XSLT. We want to emphasize that we do not provide a model for all of XSLT. For instance, we excluded for-loops and variables can only be instantiated by data values (not by result tree fragments). The idea is that we want to use variables as a look-ahead or to fetch data values occurring 'far' from the current node. The resulting language is, hence, not Turing complete and, hopefully, more ecient to evaluate. The study of the properties of our formal model, however, is beyond the scope of the present paper. The most important fact is that the dened language is more expressive than, say, XML-QL, as opposed to the previous version of XSL [9, 1]. 1 The rest of the paper is structured as follows. In Section 2, we introduce the important features of XSLT by means of two examples. In Section 3, we dene our formal model. Finally, in Section 4 we obtain our expressibility results. 2 XSLT by Example A basic XSLT program is a collection of template rules where each such rule consists of a matching pattern, a mode (which indicates the (nite) state the computation is in), and a template (see, for example, the program in Figure 2). The computation on a document t starts at its root in the starting mode 2 and proceeds roughly as follows. When the computation arrives at a node, say u, in a certain mode, say q, the program tries to nd a template rule with mode q and whose matching pattern matches u. 3 If it nds such a template rule, the program executes the corresponding template. The latter usually instructs XSLT to produce some XML output and at various positions in this XML output to selects lists of nodes for further processing (we refer to patterns that select nodes for further processing as selecting patterns). Each of these selected nodes are then processed independently as before. Finally, the documents that are constructed by these subprocesses are inserted in at the positions where the subprocesses were generated. To illustrate the new features of XSLT we use the DTD in Figure 1. It describes an organization as a sequence of groups together with a list of top managers. Each group has an id, consists of a manager and a list of other groups, or just consists of a list of employees. For simplicity we identify employees by their id. The XSLT program in Figure 2 computes pairs of employees, is a top manager dierent from Bill and is a direct or indirect manager of e 2 . Pairs are encoded simply by a pair element with attributes topmgrID and employeeID. On the face of it, the program just makes a join between the list of top managers and the group managers, that is, the ones occurring in the top manager list and the ones occurring as a manager of a group. However, it does so in a rather direct and procedural way. In brief, the XSLT program starts by applying the rst template rule at the root in mode start. This rule selects each top manager (in mode selecttopmgr). In particular, the pattern /organization/topmgr/employee is matched against the current node which In previous work we dened a formal model for the version of XSL not incorporating data values [15]. Actually, modes are optional, but for convenience we assume every template has a one and that there is a start mode. 3 Usually, and in all our examples, such a matching pattern only refers to the label of the current node. In fact, we show in Section 4 that such patterns suce. organization [ <!ELEMENT organization group+ topmgrs> <!ELEMENT topmgrs employee+> <!ELEMENT group (mgr group+) | employee+> <!ELEMENT mgr employee> <!ATTLIST group id ID #REQUIRED> Fig. 1. A DTD describing an organization. is labeled by organization and then selects all employee children of all topmgr children (the means 'child of'). For each selected employee (in mode selecttopmgr), the second template rule is applied which stores the employee's ID, say e , in the variable varID and veries, by using the latter, whether e 1 is dierent from Bill. If so, it selects all the descendants of the group manager who have an ID e 1 (in mode display). In particular, the selection pattern in the second template rule says 'select all employees that are descendants of a group that itself is a child of a group whose manager has the same ID as the one stored in the variable varID (the symbol == means 'descendant of', the expression between the brackets a lter on group elements). In this latter selection the XSLT program passes the ID e 1 along as a parameter. Next, for each employee selected by the latter selection, the program outputs an element pair with attribute values e 1 and e 2 for the attributes topmgrID and employeeID, respectively. The above program is not the 'best' way in XSLT to compute the desired query, but it nicely illustrates the three most important features of XSLT: modes, variables, and passing of data values. Let us discuss these brie y: (i) Modes enables XSLT to act dierently upon arrival at the same element types. For instance, as described above, when our program arrives at an employee element, its action depends on the actual mode, select or display, this element was selected in. (ii) Variables can be used for two purposes. The most apparent one, which is illustrated by the above query, is that they allow to perform joins between data values. A less apparent application is to use them as a 'look-ahead'. In Figure 5, we give a fragment of an XSLT program evaluating a binary tree, representing a Boolean circuit, to its truth value. Essentially, the use of variables allows for a bottom-up computation. The restriction to binary trees is just for expository purposes. In fact, it can be shown that XSLT can evaluate any bottom-up tree automaton over unranked trees [17]. In brief, when arriving at an or-labeled node, the program returns the correct truth value based upon the truth values of the rst and second subtree. (iii) Passing of data values to other template rules can be crucial for performing joins if the items that have to be joined are 'far' apart. Moreover, when <xsl:template match="organization" mode="start"> <xsl:apply-templates select="/organization/topmgr/employee" mode="selecttopmgr"/> </xsl:template> <xsl:template match="employee" mode="selecttopmgr"> <xsl:variable name="varID"> <xsl:value-of select="@id"/> </xsl:variable> <xsl:if test="$varID != 'Bill'"> <xsl:apply-templates mode="display" select="//group[mgr/employee[@id=$varID]]/group//employee"> <xsl:with-param name="varID" select="$varID"/> </xsl:apply-templates> </xsl:if> </xsl:template> <xsl:template match="employee" mode="display"> <xsl:param name="varID"/> <xsl:attribute name="topmgrID"> <xsl:value-of select="$varID"/> </xsl:attribute> <xsl:attribute name="employeeID"> <xsl:value-of select="@id"/> </xsl:attribute> </xsl:template> Fig. 2. An XSLT program computing the query of Section 2. <group id="HR"> <employee id="Bill"/> <group id="HR-prod"> <employee id="Edna"/> <group id="HR-prod-empl"> <employee id="Kate"/> <employee id="Ronald"/> <group id="HR-QA"> <employee id="John"/> <group id="HR-QA-empl"> <employee id="Jane"/> <employee id="Jake"/> <employee id="Bill"/> <employee id="John"/> Fig. 3. An XML document conforming to the DTD of Figure 1. <pair topmgrID="John" employeeID="Jane"/> <pair topmgrID="John" employeeID="Jake"/> Fig. 4. The output of the XSLT program of Figure 2 on the document of Figure 3. node IDs are present in the XML document, 4 we can use this mechanism to place 'pebbles' on the input document which enables us to do complicated grouping operations. It are exactly these three features which render XSLT into a quite powerful transformation language. <xsl:template match="or"> <xsl:variable name="arg1"> <xsl:apply-templates select="./*[1]"/> </xsl:variable> <xsl:variable name="arg2"> <xsl:apply-templates select="./*[2]"/> </xsl:variable> <xsl:choose> <xsl:when <xsl:value-of select="'false'"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="'true'"/> </xsl:otherwise> </xsl:choose> </xsl:template> Fig. 5. The fragment of an XSLT program evaluating tree-structured Boolean circuits that takes care of or-nodes. In the next section, we give an abstract formal syntax for XSLT. First of all, we restrict matching patterns to test only the label of the current node (as is already the case in Figure 2). This is no restriction, as Theorem 8 shows that we can test many properties of the current node in the body of the template rule. Further, we divide a template rule into two parts: the variable denition part and the construction part. Variables can only be assigned data values. In particular, a variable can be dened as the value of some attribute of the current node or by an XSLT apply-templates statement that will return exactly one data value. We will refer to such special templates as selection template rules. In the construction part of the template rule, the actual output is dened relative to some conditions on the values of the variables, the parameters, and the attribute values of the current node, and possibly whether the current node is the root, a leaf, or the rst or last child of its parent. 4 If not, XSL is capable of generating them itself (see Section 4). 3 A formal Model for XSLT 3.1 Trees and forests We start with the necessary denitions regarding trees and forests over a nite alphabet (the symbols in correspond to the element names of the XML document the tree represents). To use these trees as adequate abstractions of actual XML documents, we extend them with attributes that take values from an innite domain g. The set of -forests, denoted by F , is inductively dened as follows: every 2 is a -forest; if 2 and f 2 F then (f) is a -forest; if f 1 F then f 1 fn is a -forest. A -tree is a -forest of the form (f ). We denote the set of all -trees by T . Note that there is no a priori bound on the number of children of a node in a forest. In the following, whenever we say tree or forest, we always mean -tree and -forest. The reason we consider forests is that even when we use XSL for tree to tree transformations only, we sometimes need to specify template rules that construct forests. For every forest f 2 F , the set of nodes of f, denoted by Nodes(f ), is the subset of N inductively dened as follows: if )g. Thus, for a tree the node " represents its root and ui represents the i-th child of u. Further, for a forest the node iu represents the node u of the i-th tree in the forest. Next, we add XML attributes to the above dened attributes. To this end, for the rest of the paper, we x a nite set of attributes A. An attributed forest with domain S is a pair (f; ( f a and where for each a 2 A, is a function assigning a value in S to each node of f . The set of all attributed forests with domain S, is denoted by F S . For S we will usually take D. However, to create output in template rules we will use attributed forests over D[fx 1 where the variables refer to those dened by the variable dening part of the template. Of course, in real XML documents, usually, not all element types have the same set of attributes. Obviously, this is just a convenient, not a necessary restriction. In an analogous way one can dene the set of attributed trees, denoted by T D . For a set B, F D denotes the set of attributed forests f over [ B such that symbols of B may only appear at the leaves of f . In our formal model we abstract away from a particular selection pattern language. Recall that XSLT uses the pattern language described in XPath [5] (see [26], for a formal semantics). Patterns can be rather involved as illustrated by the second template rule in Figure 2 where the pattern depends on the value of the variable varID. In addition, patterns can also be moving instructions like select parent, left sibling, right sibling, or rst child. Actually, the proof of Theorem 9 indicates that such local selections only are enough to simulate all existing XML query languages. In the following, we assume an innite set of variables X . We dene a pattern over the variables X X as a function and denote the set of all patterns over X by . The idea is as follows. Let p be a pattern, t be a tree, and be a variable assignment (for the variables in p). Then p(t; )(u) is the set of selected nodes when the pattern is applied at node u. 3.2 Syntax Denition 1. An XSLT program is a tuple { is an alphabet of input symbols ; { is an alphabet of output symbols; { M c and M s are nite sets of construction and selection modes ; { start 2 M c is the start mode; and { R is a nite set of construction and selection template rules (to be dened below). As mentioned at the end of section 2, we distinguish between two types of template rules: constructing and selecting ones. The former are used to create output. So, the result of applying these is a forest. The latter are used to fetch data val- ues. So, each one returns exactly one domain element. The mode will determine the nature of the template: constructing or selecting. Denition 2. A construction apply-templates-expression r (at-expression for short) is of the form q(p; z); where q 2 M c , p is a pattern and z is a possibly empty sequence of variables in X and domain elements in D. A selection at- expression is dened as a constructing one with the restriction that p only selects single nodes, that is, for every tree t, each assignment of variables , and each node u of t, p(t; )(u) is a singleton set. We denote the set of construction (selection) at-expression by AT c (AT s ). For instance, the apply-templates expression in the second template of Figure 2 is a constructing one and corresponds in our model to the expression with p the pattern //group[mgr/employee[@id=varID]]/group//employee. Note that application of this pattern eventually leads to the generation of a element. So the expression is constructing in the sense that it eventually will produce output. Denition 3. An attribute expression is an expression of the form a(:) where a is an attribute. An atomic test is one of the following: (i) an expression of the are attribute expressions, variables, or domain or, (ii) an expression of the form root, leaf, rst-child, or last-child. Finally, a test is a Boolean combination of atomic tests. During a computation the expressions a(:) will evaluate to the value of the attribute a of the current node. Further, root, leaf, rst-child, last-child evaluate to true whenever the current node is the root, a leaf, the rst or the last child of its parent. Selection template rules are dened next. Recall that they output one domain element. Denition 4. Let q 2 M c and 2 . A (q; )-selection template rule is of the template (q; x 1 return { all x's and y's are variables (the former are parameters while the latter are local { each r i 2 AT s or is an attribute expression; further, if r i 2 AT s then every variable occurring in it is among y 1 { all c i are tests containing only variables in X := fx and { every z i is a domain element, a variable in X , or a selecting at-expression with the restriction that all variables occurring in it should belong to X . Denition 5. Let q 2 M c and 2 . A (q; )-construction template rule is of the same form as a selection rule only now each z i is a forest in F D[X (recall that these are forests where attributes take values in D [ X and where leaves may be labeled with constructing at-expression) with the restriction that each variable occurring in an at-expression occurring at a leaf of z i should be in X . To keep the model total and deterministic we require the existence of exactly one (q; )-template rule for each mode and each . Further, to ensure that an XSLT program generates tree to tree translations, we require that each z i in a (start; )-construction template rule is a tree (rather than a forest). Example 6. We illustrate the above by translating the program in Figure 2 into our syntax. The patterns p 1 and refer to the patterns in the rst and second template rule, respectively. In the second template rule display(p 2 ,varID) is the tree consisting of one node labeled with display(p 2 ,varID); further, " denotes the empty tree. In the last rule pair[topmgr!varID; employeeID!myID] denotes the tree t consisting of one node where t topmgrID employeeID myID. For readability, we omitted the test 'if true then'. All modes are constructing template organization(start) return template employee(selecttopmgr) return if varID 6= Bill then display(p 2 template employee(display,varID) return 3.3 Semantics To dene the semantics we need the following. Let w consist of a sequence of variables of X and domain elements. For a function D, we denote by the sequence of domain elements obtained from w by replacing each occurrence of the variable x in w by (x). By x 1 nd d we denote the function that maps each x i to d i . We next dene the semantics of an XSLT program P on a tree t. Thereto, we need the following concept. A local conguration is an element of Nodes(t) Intuitively, := (u; q; d means that the program has selected node u in mode q with values d as parameters. For ease of presentation, we dene the result of P on , denoted by P t (), in a direct and procedural way. The latter has the advantage over the usual denition, in terms of rather complicated but formally more correct rewrite relations, that it is more trans- parent. The drawback is that it does not deal with the border case when XSLT programs get into innite cycles. However, it should be clear that P t () is un- dened whenever one of the generated subprocesses computes forever. We defer the formal semantics in terms of rewrite relations to the full version of the paper. We distinguish between two cases. In both of these, let the label of u be . { Suppose q is a selection mode. Then P t () 2 D. Let the (q; )-template rule be of the form as specied in Denition 4, where each r i is q i (p or the attribute expression a i (:). Intuitively, this template is evaluated as follows. First, the values of the variables y 1 are dened. Such a value can be an attribute value of the current node or can be dened by invoking an at-rule that will compute the desired data value. The output then is determined by z i where c i is the rst test that evaluates to true. Suppose the variables y 1 assigned the domain values e 1 is an at-expression, then e maps each x j to d j , for is the node selected by p i , that is, p i (t; is an attribute expression, then e i := t a i (u). Next, suppose c i is the rst condition that evaluates to true by interpreting each y j by e j , x j by d j , a(:) by t a (u), and root, leaf, rst-child, last-child by true i u is the root, a leaf, the rst or the last child of its parent, respectively. To ensure that the translation is total, we require that at least one such c i exists. 5 Then, z i determines the output value in the following way. If z i is a constant, a variable, or an attribute expression then P t () equals the corresponding value. If z i is a selecting at-expression q 0 (p; w), then w[xn d; yne]) where v is the node selected by p, that is, p(t; [xn d; fvg. { Suppose q is a construction mode. Then P t . Let the (q; )-template rule be of the form as specied in Denition 5. Suppose the variables y 1 get assigned the values e 1 is the rst condition that evaluates to true. Then z i determines the output value in the following way. Recall that z i is forest in F D[X (AT c ), that is, a forest where attributes take values in D [ X and where leaves may be labeled with constructing at-expression. Now, P t () is the forest obtained from z i by replacing every occurrence of a y j and a x j as the value of some attribute by the data values e j and d j , respectively; every occurrence q 0 (p w) of an at-expression at a leave of z i by the forest w[xn d; w[xn d; d; denotes document order). Recall that each P t w[xn d; yne]) returns an attributed forest. The initial local conguration is dened as start Denition 7. The result of an XSLT program P on a tree t, denoted by P (t), is dened as P t ( start ). 3.4 Some remarks We conclude this section with some remarks. First, we note that XSLT does not make the explicit distinction between constructing and selecting template rules, 5 Obviously, one could also add an 'otherwise' construct rather than having this condition or even, between the variable denition part and the constructing part of a template rule. However, we feel that by making this explicit, programming becomes more structured. On the other hand, we did not incorporate everything XSLT has to oer. For instance, we refrained from including for-loops. Nevertheless, we show in the next section that we have captured a powerful fragment capable of simulating most existing XML query languages and even more. 4 Expressiveness We next show that XSLT is capable of computing very expressive structural patterns. Thereto, we rst say how we view attributed trees as logical structures (in the sense of mathematical logic [10]) over the binary relation symbols E and <, and the unary relation symbols (O ) 2 . The domain of t, viewed as a structure, equals the set of nodes of t, i.e., Nodes(t). E is the edge relation and equals the set of pairs (v; v i) for every v; v i 2 Nodes(t). The relation < species the ordering of the children of a node, and equals the set of pairs (v Nodes(t). For each , O is the set of nodes that are labeled with a . The logic MSO is MSO over the above vocabulary (with MSO dened in the usual way, see, e.g., [10]) extended with atomic formulas of the form d, where a is an attribute and d 2 D. Denote the latter atomic formula by '. Its semantics is then dened as follows t a d, that is, the attribute a of u has value d. Note that we do not allow atomic formulas of the form so we do not allow joins. Clearly, MSO can dene all XPath matching patterns (they are even FO denable). The next theorem says that XSLT is capable of expressing all unary MSO patterns. In particular, this means that one does not need matching patterns in templates. That is, XSLT actually allows to specify rules like <xsl:template match="p" mode="q"> where p is a pattern rather than just a label. It means that a rule can only be applied on nodes that satisfy p. The next theorem implies that one can test for p in the body of the template rule and, hence, does not need matching patterns. Theorem 8. Let '(x) be an MSO formula. There exists an XSLT program P and a mode q ' such that P t (u; q ' Proof. Due to space limitations we can only give a brief hint of the proof. We refer the interested reader to [17]. We start with some terminology. The subtree of t rooted at v is denoted by t v . The envelope of t at v, denoted by t v , is the tree obtained from t by deleting the subtree rooted at v but keeping v. Note that t v and t v have v in common. Let the quantier-depth of ' be k and denote by all the unary MSO formulas '(x) up to quantier-depth k that hold in t with x interpreted by v. It is well known that k (t; v) is nite for all t and v (for xed k). Further, whether t depends only on k 6 This would not be the case if atomic formulas of the form can be computed by unranked tree automata working on (t v ; v) and t v , respectively [20]. Here, (t v ; v) is the tree t v with v as a distinguished node. Hence, it remains to show how XSLT programs can compute bottom-up unranked tree automata. In brief, this can be done by using variables as look-ahead like the XSLT program in Figure 5. To study decidability of type checking, Milo, Suciu, and Vianu [16] dened the k-pebble tree-transducer as a formalism capturing the expressiveness of most existing XML query languages. Such transducers transform binary trees into other binary trees. 7 We next describe such deterministic transducers with equality tests on data values. The k-pebble deterministic tree-transducer uses up to k pebbles to mark certain nodes in the tree. Transitions are determined in a unique way by the current node symbol, the current state (or mode), the pres- ence/absence of the various pebbles on the current node, and equality tests on the attribute values of the nodes the pebbles are located on. Pebbles are ordered and numbered from 1 to k. The machine can place pebbles on the root, move them around, and remove them (actually, the use of the pebbles is restricted by a stack discipline which ensures that the model does not become too powerful, that is, accepts non-tree-regular languages). There are move transitions and output tran- sitions. Move transitions are of the following kind: move-to-parent, move-to-rst- child, move-to-last-child, move-to-left-sibling, move-to-right-sibling, remain-and- change-state, place-new-pebble, and pick-current-pebble. There are two kinds of output transitions. A binary output outputs a -symbol , possibly with attributes dened as an attribute value of a pebbled node, and spawns two computation branches that compute, independently of each other, the left and the right subtree of . Both branches inherit the positions of all pebbles on the input and do not communicate with each other, that is, each branch moves the pebbles independently of the other. In a nullary output, the node being output is a leaf of the output tree, again possibly with attributes, and the computation halts. It should be clear that, apart from the pebbles, the above described model is extremely close to XSLT: XSLT is equiped with modes (states), can do local movements and the simple output transitions. Under the assumption that each node has a unique id, XSLT can also simulate pebbles. 8 Indeed, we just use k variables x 1 up to x k , where at each time instance x i contains the id of the node on which the i-th pebble is located. The above discussion immediately leads to the next theorem which implies that XSLT can simulate most other current query languages, like for instance, XML-QL [16] . We refer the interested 7 When proving properties of XML transformations, restricting to binary trees is usually sucient as unranked ones can be encoded into ranked ones; of course, this is not the case when one tries to dene a formal model for XSLT which works directly on unranked trees. 8 Actually, this assumption is not necessary as XSLT is equiped with the function generate-id(.) which generates a unique id for the current node. Furthermore, this id only depends on the current node, that is, when invoked for the same node several times it will return the same value. So there is no need to store the node id's; they can be computed on demand. reader to [3] were we show how the XML-QL queries in [9] can be expressed in actual XSLT. Theorem 9. XSLT can simulate k-pebble deterministic tree-transducers with equality tests on data values. We point out that non-deterministic tree-transducers can be simulated by giving a non-deterministic semantics to XSLT in the obvious way. Although by the above discussion k-pebble transducers seem extremely close to our formal model of XSLT, it is not clear whether the former can simulate the latter. Indeed, Theorem 8 shows that XSLT can check any MSO property of the root of the tree. We do not know whether deterministic k-pebble transducers can do this. In fact, this problem is closely related to a seemingly dicult open problem in formal language theory: can tree-walking automata (with or without pebbles) dene all MSO denable tree languages [11, 12, 21]. On the other hand, Theorem 8 does hold for non-deterministic k-pebble transducers. Furthermore, it is not clear whether all deterministic transformations they can express can be simulated by XSLT. Regardless of the above, it is known that query languages based on rst-order logic extended with regular path expressions, like XML-QL, are weaker than MSO [19], hence, by Theorem 8 and Theorem 9, weaker than XSLT. Acknowledgements The last author thanks Bertram Ludascher and Victor Vianu for encouraging and helpful discussions. --R Data on the Web The lorel query language for semistructured data. Examples of translations from XML-QL to XSLT A query language and optimization techniques for unstructured data. XML Path Language (XPath). Extensible stylesheet language (XSL). XSL transformations version 1.0. World Wide Web Consortium. Querying XML data. Finite Model Theory. Trips on trees. Catching the boat with strudel: Experiences with a web-site management system Structured document transformations based on XSL. Type checking for XML transformers. Design and Analysis of Query Languages for Structured Documents Extensions of attribute grammars for structured document queries. Expressive and e Query automata. On the power of tree-walking-automata The design of XQL. Semistructured data and XML. A formal semantics of patterns in XSLT. --TR A query language and optimization techniques for unstructured data Languages, automata, and logic Expressiveness of structured document query languages based on attribute grammars Catching the boat with Strudel Query automata Macro tree transducers, attribute grammars, and MSO definable tree translations Data on the Web Typechecking for XML transformers Expressive and efficient pattern languages for tree-structured data (extended abstract) Quilt Structured Document Transformations Based on XSL Extensions of Attribute Grammars for Structured Document Queries --CTR Frank Neven, Automata theory for XML researchers, ACM SIGMOD Record, v.31 n.3, September 2002 Michael Benedikt , Wenfei Fan , Gabriel Kuper, Structural properties of XPath fragments, Theoretical Computer Science, v.336 n.1, p.3-31, 25 May 2005 Joost Engelfriet , Hendrik Jan Hoogeboom , Bart Samwel, XML transformation by tree-walking transducers with invisible pebbles, Proceedings of the twenty-sixth ACM SIGMOD-SIGACT-SIGART symposium on Principles of database systems, June 11-13, 2007, Beijing, China Andreas Maletti , Heiko Vogler, Incomparability results for classes of polynomial tree series transformations, Journal of Automata, Languages and Combinatorics, v.10 n.4, p.535-568, January 2005 Maarten Marx , Maarten de Rijke, Semantic characterizations of navigational XPath, ACM SIGMOD Record, v.34 n.2, June 2005 Martens , Frank Neven, Frontiers of tractability for typechecking simple XML transformations, Proceedings of the twenty-third ACM SIGMOD-SIGACT-SIGART symposium on Principles of database systems, June 14-16, 2004, Paris, France Martens , Frank Neven, On the complexity of typechecking top-down XML transformations, Theoretical Computer Science, v.336 n.1, p.153-180, 25 May 2005 Frank Neven , Thomas Schwentick, On the power of tree-walking automata, Information and Computation, v.183 n.1, p.86-103, May 25, Frank Neven, On the power of walking for querying tree-structured data, Proceedings of the twenty-first ACM SIGMOD-SIGACT-SIGART symposium on Principles of database systems, June 03-05, 2002, Madison, Wisconsin Makoto Onizuka , Fong Yee Chan , Ryusuke Michigami , Takashi Honishi, Incremental maintenance for materialized XPath/XSLT views, Proceedings of the 14th international conference on World Wide Web, May 10-14, 2005, Chiba, Japan Martens , Frank Neven, Frontiers of tractability for typechecking simple XML transformations, Journal of Computer and System Sciences, v.73 n.3, p.362-390, May, 2007 Frank Neven , Thomas Schwentick , Victor Vianu, Finite state machines for strings over infinite alphabets, ACM Transactions on Computational Logic (TOCL), v.5 n.3, p.403-435, July 2004 Jan Hidders , Philippe Michiels , Jan Paredaens , Roel Vercammen, LiXQuery: a formal foundation for XQuery research, ACM SIGMOD Record, v.34 n.4, p.21-26, December 2005 Thomas Schwentick, Automata for XML---A survey, Journal of Computer and System Sciences, v.73 n.3, p.289-315, May, 2007
XSLT;expressiveness;logic;XML;databases;tree transducers;query languages
603514
Interactive video streaming with proxy servers.
We study caching strategies for proxies that cache VBR-encoded continuous media objects for highly interactive streaming applications. First, we develop a model for streaming VBR-encoded continuous media objects. This model forms the basis for a stream admission control criterion and our study of caching strategies. We find that unlike conventional web caches, proxy caches for continuous media objects need to replicate or stripe objects to achieve high hit rates. We develop novel caching strategies that either implicitly or explicitly track the request pattern and cache (and replicate) objects accordingly. Our numerical results indicate that our caching strategies achieve significantly higher hit rates than caching without object replication.
Introduction The dramatic growth of the World Wide Web has spurred the deployment of proxy caches. These store frequently requested objects close to the clients in the hope of satisfying future client requests without contacting the origin server. Highly localized request patterns, which exhibit hot{spots, i.e., frequent requests for a small number of popular objects, have made caching highly successful in reducing server load, network congestion, and client perceived latency. While most of the caching research to date has focused on caching of textual and image objects, web{based streaming of continuous media, such as video and audio, becomes increasingly popular. In fact, it is expected that by 2003, continuous media will account for more than 50 % of the data available on origin servers [13]. This trend is Corresponding Author: Martin Reisslein, Dept. of Electrical Eng., Arizona State University, P.O. Box 877206, Tempe AZ 85287{7206, phone: (480)965{8593, fax: (480)965{8325, [email protected], http://www.eas.asu.edu/~mre. re ected in a recent study [1], which found that the number of continuous media objects stored on web servers has tripled in the rst 9 months of 1998. Caching and streaming of continuous media objects with proxy servers poses many new challenges [29]. These are due to the real{time constraints imposed by continuous media tra-c and the high degree of interactivity expected by users. In this paper we focus on caching strategies for proxies that cache VBR{encoded continuous media for highly interactive streaming applications in disk arrays. We consider an architecture where the proxy servers cache frequently requested continuous media objects in their local storage, which is typically a disk array. The clients direct their streaming requests to their assigned proxy server. If the proxy can satisfy the streaming request | a cache hit | the object is streamed from the proxy to the client. If the proxy can not satisfy the request | a cache miss | the object is obtained from the appropriate origin server and the proxy decides according to a caching strategy whether or not to cache the object. The contribution of this paper is twofold. First, we develop a stream model for streaming VBR{encoded continuous media objects from the proxy's disk array over an access network to the clients. Based on the stream model we design a scheme for admission control and resource reservation that provides stringent statistical Quality of Service guarantees. Our second contribution is to study caching strategies for continuous media objects. Our study shows that unlike conventional web caches, proxy caches for continuous media should replicate or stripe objects to accommodate the typically highly localized request patterns and to ensure good stream quality. We develop natural extensions of conventional caching strategies which implicitly track the client request pattern by combining object replication with a conventional replacement policy, such as LRU or LFU. We then develop and evaluate a novel caching strategy which explicitly tracks the client request pattern and caches objects accordingly. Our numerical results indicate that the hit rate achieved by our caching strategy with explicit tracking is almost 20 % higher than the hit rate of caching with implicit tracking. Caching with implicit tracking in turn achieves typically 10 % higher hit rates than conventional caching without object replication. 1.1 Related Work There are only few studies of caching and streaming of continuous media objects with proxy servers which are complementary to the issues studied in this paper. Rejaie et al. propose a proxy caching mechanism [26] in conjunction with a congestion control mechanism [24, 25] for layered{encoded video. With layered encoding the compressed video stream is split into a base layer, which contains low quality encoding information, and enhancement layers, which improve the stream quality. The basic idea of their caching mechanism is to cache layers according to the objects' popularities: the more popular an object, the more layers are cached. When streaming an object to a client, the layers that are not cached at the proxy are obtained from the origin server. A related idea is explored by Wang et al. in their study on video staging [39]. With video staging the part of the VBR video stream, that exceeds a certain cut{o rate (i.e., the bursts of the VBR stream) is cached at the proxy while the lower (now smoother) part of the video stream is stored at the origin server. Our work is complementary to these studies on caching of video lay- ers. Our focus is on (1) developing a stream model and admission control conditions that ensure statistical QoS for continuous media streaming, and (2) object replication and striping to accommodate the typically highly localized client request pattern while providing good stream quality. Sen et al. [33] propose to cache a prex (i.e., the initial frames) of video streams at the proxy and to employ work{ahead smoothing while streaming the object from the proxy to the client. The cached prex hides the potentially large initial start{up delay of the work{ahead transmission schedule from the client. A major drawback of this approach is that it is not suited for interactive video stream- ing. The client experiences a potentially large delay after invoking an interaction (such as a temporal jump) since the work{ahead smoothing schedule has to build up a buered reserve at the client before playback can resume. Tewari et al. [38] propose a Resource Based Caching (RBC) scheme for Constant Bit Rate (CBR) encoded video objects. They model the cache as a two resource (storage space and bandwidth) constrained knapsack and study replacement policies that take the objects' sizes as well as CBR bandwidth into account. Our work diers from RBC in that we consider VBR encoded video objects. Also, object replication and striping as well as interactive streaming are not addressed by Tewari et al. There is a large body of literature on striping of video objects in the context of video servers. Most of these studies assume that the videos are CBR encoded; see for instance [12, 8, 19]. Striping for VBR encoded video objects is studied by Shenoy and Vin [35]. They develop an analytical model for the most heavily loaded disk and study the optimal striping placement. Sahu et al. [30] study round based retrieval strategies for VBR video from disk. These studies on striping and retrieval of VBR video assume that the user request pattern is uniform and do not consider interactive delays. Birk [2] proposed an approach where the video blocks are placed randomly on the disk array to overcome the hot{ spot problem. In his scheme interactive requests, which result from client interactions, are given priority over sequential retrievals to ensure short interactive delays. This approach appears promising in the context of proxy streaming of interactive VBR video, although there are some issues that require further research. Most importantly, a stream admission control rule that ensures statistical QoS when retrieving randomly placed blocks of VBR video from the disk array requires more research. Also, the performance of the scheme when the proportion of interactive requests is high needs to be examined. In this section we describe the end{to{end architecture for the delivery of continuous media objects using proxy servers. The architecture is illustrated in Figure 1. The Wide Area Network Origin Server Origin Server Local Access Network Proxy Server Client Client Client Figure 1: Architecture for continuous media streaming with proxy server. continuous media objects are stored on the origin servers. The continuous media objects are prerecorded audio and video objects, such as CD{quality music clips, short video clips (e.g., trailers or music videos) or full{length movies or on{line lectures. The proxy server is located close to the clients. It is connected to the origin servers via a wide area network (e.g., the Internet). The proxy server is connected to the clients via a local access network. The local access network could be a LAN running over Ethernet, or a residential access network using xDSL or HFC technologies. In the following we brie y outline the delivery procedure for continuous media objects. The client directs its request for a particular continuous media object to its assigned proxy server (for instance by using the Real Time Streaming Protocol (RTSP) [32]). If the continuous media object is not cached in the proxy, that is, in the case of a cache miss, the proxy forwards the request to the appropriate origin server. The origin server streams the continuous media object to the proxy server. The proxy relays the stream to the requesting client and at the same time caches the continuous media stream in its local storage. If the local storage (typically disk array) at the proxy is full the proxy decides according to a replacement policy (see Section 5) which continuous media object to remove from the cache to make room for the new object. If the replacement algorithm fails to free up enough disk space for the the new objects (this is the case when not enough objects can be removed without interrupting ongoing streams; see Section 5) the object is streamed from the origin server directly to the client. In the case of a cache miss the proxy server does not reduce the bandwidth usage in the wide area network, neither does it improve the stream quality and the level of interactivity oered to the client. In the case of a cache hit, that is, when the continuous media object requested by the client is cached in the proxy's disk array, the object is streamed from the proxy over the local access network to the client. Before the streaming commences the proxy conducts in both cases admission control tests to verify whether the available disk bandwidth and the bandwidth in the local access network are su-cient to support the new stream. Only if the admission tests are successful is the requested object streamed from the origin server (in the case of a cache miss) or from the proxy (in the case of a cache hit). 3 Model for Continuous Media Streaming from Proxy In this section we model the streaming of continuous media from the proxy. Our analysis applies to any type of continuous media tra-c, however, to x ideas we focus on streaming of video objects. We naturally assume that the video objects are Variable Bit Rate (VBR) encoded. For VBR encoding the quantization scale is kept constant to maintain high video quality even for high action scenes. For the same quality level the le size and average bit rate of a Constant Bit Rate (CBR) encoded movie or sports clip are typically two times or more than the le size and average bit rate of the VBR encoding [4, 37]. Our rst contribution is to develop a unied scheme for admission control and resource reservation in the proxy server as well as the local access network. Toward this end we rst develop a disk model and derive the eective disk bandwidth for the retrieval of continuous media tra-c with tight interactive delay constraints. We then develop a stream model for the VBR{encoded continuous media tra-c and design a scheme for admission control and resource reservation that provides stringent statistical QoS. 3.1 Disk Model We assume that each disk in the proxy's disk array consists of single platter side and a single arm. We assume that the proxy server retrieves data for the ongoing video streams in constant{time rounds; we denote the round length by T . We also assume that each disk in the disk array uses the SCAN scheduling algorithm [20]. Specically, in each round, each disk arm sweeps across its entire platter exactly once with no back tracking. With the SCAN scheduling algorithm, the overhead incurred within a round for a given disk is where I is the number of streams that the disk is servicing. The constant l seek is the maximum seek time of the disk (i.e., the time to move the arm from the center to the edge of the platter, which is equal to the time to move the arm from the edge to the center of the platter). The constant l rot is the per{stream latency, which includes the maximum rotation time of the disk and the track{to{track seek time. Table summarizes our disk notation and the nominal values for the disk parameters. The nominal parameters reect the current performance of high{speed disks [36]. Table 1: Nominal values of disk parameters Parameters Notation Nominal value disk size X 13 Gbytes disk transfer rate r 8.5 Mbytes/sec maximum seek time l seek rotational latency l rot 5 msec The initial start{up delay as well as the responsiveness to an interactive request (pause/resume or a temporal jump) is typically modeled to be twice the round length, 2T , when the SCAN algorithm is used. This delay model is based on the worst{case assumption that the request of the user arrives just after the start of a round, say round k, and arrives too late to be scheduled by the SCAN algorithm for round k. The request has to wait for the start of the next round. The request is included in the disk read schedule of round and the requested video data is read into the disk buer during round k + 1. The disk buer of becomes the network buer of round k and the transmission of the requested video data out of the network buer starts at the beginning of round k 2. Thus, the disk{subsystem introduces a maximum delay of two rounds, i.e., 2T . We shall assume that the maximum disk{subsystem delay is constrained to 0.5 sec. Therefore, we use a round length of sec. Note that the total interactive delay also includes transmission delays as well as client de{smoothing and decoding delays. These additional delays add another 0.25 sec to 0.5 sec to the delay, giving a total delay on the order of .75 sec to 1.0 sec. Thus, with a round length of sec the system is able to give the user a pleasurable interactive experience with less than 1 second delay for all interactions. For the development of the disk model we assume for now that the video objects are placed in the proxy's disk array using the localized placement strategy. With the localized placement strategy each video le is placed contiguously on a single disk. We shall later study a number of more complex striping placement strategies, whereby each video le is striped across a subset of the disks in the proxy's disk array. Now consider one of the disks in the proxy's disk array and suppose that this disk is servicing I streams. Let the number of bits retrieved for the I streams in one round of length T . The disk transfers this video data at the disk transfer rate r. Thus the total disk transfer time within a round is retr(I ; T )=r. The total disk overhead within a round is l seek . Thus the amount of time the disk requires to service the I ongoing streams in a round is retr(I ; T )=r . For lossless service the time required to service the I streams in a round must be no greater than the round length itself: r Rearranging the terms in the above inequality, we obtain the maximum streaming rate for lossless service: r which we refer to as disk bandwidth. With the disk parameters from Table 1 the disk bandwidth is (63:1 1:36 I) Mbps. The disk bandwidth is obviously upper bounded by the disk transfer rate. Note that the disk bandwidth increases for increasing round length T . We therefore use a round length of sec, the largest round length that guarantees a maximum interactive delay of 1 second. Note furthermore that the disk bandwidth decreases as the number of ongoing streams I increases. This is because the disk wastes a larger fraction of the round with seeks and rotations when the number of ongoing streams increases. 3.2 Stream Model We now develop a model for the VBR video streams that are retrieved from the proxy's disk array and sent over the local access network to the clients. We assume in the basic stream model that the video objects are retrieved from a single disk, that is, we assume localized placement in the proxy's disk array. We shall consider streaming from a disk array with striping placement later. In our stream model we assume random stream phases, which accurately model interactive streaming. We base the stream model on the distribution of the frame sizes, as proposed in [21]. We chose this approach because it provides simple and accurate admission control decisions through the Large Deviation Approximation [27]. The many models that are based on Markov modulated processes (e.g., [18]) model tra-c quite accurately. However, for admission control they are either more complex (requiring the calculation of many state transition probabilities) or employ the asymptotic theory of eective bandwidth which is less accurate for small buers and bursty video tra-c [15]. Consider a single disk in the proxy's disk array and suppose that this disk is streaming I video objects. For simplicity we assume that each video object has N frames and a frame rate of F frames per second. Let fn (i) denote the number of bits in the nth encoded frame of video object I . We assume that all video objects are cached in the proxy; the frame size trace ffn (i); 1 n Ng for object i is therefore a sequence of known integers. As pointed out above the video frames are retrieved from disk in rounds of length T . For each ongoing video stream let K denote the number of frames retrieved in one round; clearly our numerical work we use a round length of sec and a frame rate of thus our numerical examples.) Following the terminology of the le server literature [34] we refer to the K frames retrieved in one round as block. Let xm (i) denote the size of the block (in bits) retrieved for video stream i in round m. Assuming that the frames of the video object are retrieved strictly sequentially, that is, the rst K frames are retrieved in round 1, the next K frames are retrieved in round 2, and so on; in other words by excluding client interactions, we have n=(m 1)K+1 We refer to the sequence fxm (i); 1 m N=Kg as block size trace for stream i. Following [21] we model the random start times of the video streams and the client interactions by assigning to video object i the random phase i . (These client interactions such as pause/resume and for- ward/backward temporal jumps can be communicated to the proxy using the Real Time Streaming Protocol (RTSP) [32]; we assume in our model that the temporal jumps have the granularity of blocks, i.e., K frames.) It is natural to assume that the random phases I , are independent and uniformly distributed over [0; N 1]. In our model the amount of data retrieved from disk for video stream i in round m is where the index m wrapped around if it exceeds the number of blocks N=K of the video object. The total amount of data retrieved in round m for the I ongoing video streams is I I We now brie y summarize the main implications of our stream model: 1. For each xed round index m, Xm are independent random variables. 2. The probability mass function of Xm (i) can be obtained directly from the block size trace of the cached video object: Note that the distribution of Xm (i) does not depend on the round index m. To simplify notation we write henceforth X(i) for Xm (i) and X for Xm . We now proceed to develop stream admission rules that ensure a high user perceived quality of the streamed continuous media while e-ciently utilizing the bandwidth resources in the proxy's disk array and the local access net- work. Toward this end we dene statistical QoS require- ments. Specically, we dene the loss probability as the long run average fraction of information (bits) lost due to the limited bandwidth (in disk array and local access net- work) and admit a new stream only if the loss is less than some miniscule , such as Formally, the loss probability due to the limited disk bandwidth is given by where the expectation is over all possible phase proles. Note that up to this point we have considered a single disk in the proxy's disk array. To formally dene the loss probability due to the limited bandwidth in the local access network we consider the aggregate streaming rate from the proxy's disk array (resulting from cache hits) as well as the streaming from the origin servers (resulting from cache misses). Let D denote the number of disks in the proxy's disk array and let X d be the random variable denoting the amount of data retrieved in one round from disk d; D. The aggregate amount of data retrieved from the proxy's D disks in one round is Furthermore, let X o be the random variable denoting the amount of data fed into the local access network in one round from the origin servers. The total amount of data fed into the local access network in one round is The network loss probability is net where C net denotes the bandwidth available for streaming continuous media objects into the local access network. This bandwidth could, for instance, be the bandwidth of the link connecting the proxy to an xDSL central o-ce, or the bandwidth of the cable trunk that the proxy feeds into. The overall streaming loss probability is bounded by the sum of the disk and network loss probabilities. Our statistical QoS requirement is that the streaming loss probability be less than some miniscule : loss loss Before granting a new streaming request we verify whether continues to hold when including the new stream in (2) (for the appropriate disk; recall we are assuming localized placement) and (4). Evaluating the probabilities in (6) involves the convolution of independent random variables, which often leads to numerical problems. We therefore apply the Large Deviation approximation, which is known to be accurate and computationally e-cient [27]. Let X (s) denote the logarithmic moment generating function of X , the amount of data retrieved from a given disk in one round, Clearly, I by the independence of the X(i)'s. The individual X(i) (s)'s are easily obtained from the respective round size traces. The Large Deviation approximation for the disk loss probability is [27]: loss 1 Assuming that the streams retrieved from the D disks in the proxy's disk array are mutually independent it is straightforward to write out the corresponding Large Deviation approximation for P net loss 3.3 Striping Placement In this section we study streaming from a proxy that uses striping placement of video objects in its disk ar- ray. Recall that D denotes the number of disks in the proxy's disk array. We shall at rst focus on full striping, whereby each video object is striped over all D disks in the proxy. There are essentially two dierent striping tech- niques: Fine Grained Striping (FGS) and Coarse Grained Striping (CGS) [7, 17]. With Fine Grained Striping each block (consisting of K frames) is segmented into D equal{ sized parts, called stripes, and each of the disks stores one of the block's stripes. When retrieving a block from the disk array, the server reads all D stripes in parallel. With Coarse Grained Striping (also referred to as Data Interleaving in [11]) each block is stored on a separate disk. The blocks are typically assigned to the disks in a round robin manner, When the proxy retrieves a block from its disk array it reads the entire block from one disk. Therefore, CGS has less overhead than FGS (since the proxy has to access D disks to retrieve one block with FGS). The draw-back of CGS, however, is its large interactive delay, which is due to the large scheduling delay for disk accesses in disk arrays with CGS [7, 17, 23]. The large scheduling delay with CGS severely limits the number of streams that a disk array with CGS can support when a tight interactive delay constraint is imposed. In fact, it is shown in [23] that given a tight interactive delay constraint of 1 second CGS typically supports fewer streams than FGS. We are interested in continuous media streaming with a high degree of interactivity and focus therefore on FGS in this paper. We now proceed to develop a model for streaming from a disk array with FGS placement. For that purpose we adapt the disk model (Section 3.1) and stream model (Section 3.2) for localized placement. First, we consider the disk model. Suppose that the proxy's disk array consists of D disks. Suppose that the proxy is servicing J streams. Consider one of the D disks. The disk will transfer J stripes in one round. With J disk accesses the disk overhead incurred in one round is With a derivation that parallels the development of the disk model for localized placement in Section 3.1 we obtain for the disk bandwidth with FGS: We now adapt the stream model of Section 3.2 to FGS. Consider again one of the D disks. Let X FGS (j) be the random variable denoting the amount of data (i.e., the size of the stripe in bits) retrieved for stream in a given round. Recall that the stripes are obtained by dividing each block of a video object into D equal{sized segments. With our stream model the probability mass function of X FGS (j) can thus be directly obtained from the block size trace of the cached video object: The total amount of data retrieved from the disk in a given round is and the aggregate amount of data retrieved from the entire disk array is Y . It is now straightforward to compute the loss probabilities loss and P net loss using the Large Deviation approximation. We nally consider group striping. With group striping the video objects are striped over W D disks. We refer to W as the striping width. Localized placement and full striping are special cases of group strip- ing. With group striping the proxy's disk array is typically segmented into striping groups, which consist of W disks each. Each cached video object is striped within a striping group. With FGS each block of a video object is segmented into W equal{sized stripes and each disk in the striping group stores one of the block's stripes. The disk model and stream model for streaming from a proxy with group striping are straightforward extensions of the models for full striping. 4 Replication and Striping of Video Objects In this section we study the impact of the placement of video objects in the proxy's disk array on the proxy's per- formance. We show that replication and striping of popular objects in the proxy signicantly improve the hit rate and throughput of the proxy as well as the user{perceived media quality. Throughout our performance study we assume that the requests for continuous media objects follow the Zipf distribution [40]. Specically, if there are M objects, with object 1 being the most popular and object M being the least popular, then the probability that the mth most popular object is requested is e The Zipf distribution, which is characterized by the parameter 0, corresponds to a highly localized request pattern. It has been observed that the requests for movies in video rental stores and Video on Demand systems follow a Zipf distribution with around one [5]. Furthermore, studies of web caches have shown that requests for images and HTML documents are well described by a Zipf distribution with a of roughly one [3]. We expect therefore that requests for on{line continuous media objects will also follow a Zipf distribution. For the numerical investigation in this paper we use traces of MPEG encoded video objects. We obtained 7 MPEG{1 traces, which give the number of bits in each encoded video frame, from the public domain [10, 16, 28]. The 7 video traces were used to create 10 pseudo traces each 40,000 frames long. The statistics of the resulting traces are summarized in Table 2. The bean, bond, lambs, Table 2: Trace statistics Frames Trace Peak [Mbit/s] Peak/Mean Std. Dev. bean 24.9 13.0 2.25 bond 19.3 10.1 2.03 lambs 35.2 18.3 2.94 oz 16.1 8.4 2.39 soccer 13.2 6.9 1.84 star wars 1 20.9 10.9 2.35 star wars 2 25.3 13.2 2.25 star wars 3 23.0 12.0 2.22 star wars 4 16.2 8.4 2.05 terminator 14.0 7.3 1.79 soccer, and terminator traces were created by multiplying the frame sizes of the video traces from [28] by a constant to bring their average bit rates to 2 Mbps. The oz trace was created by taking the rst 40,000 frames of the MPEG encoding from [16] and multiplying the frame sizes by a constant to raise the average bit rate to 2 Mbps. Finally, the four star wars traces were obtained by dividing the MPEG encoding from [10] into four segments of 40,000 frames each and then raising the average bit rate of the segments to 2 Mbps. Although the ten pseudo traces are not traces of actual videos objects, we believe that they reect the characteristics of MPEG{2 encoded video objects (highly bursty, long{range scene dependence, average rate about 2 Mbps). In summary, we have 10 VBR encoded video objects with frames and a frame rate of In our performance evaluation we focus on the impact of the object placement and caching strategies in the proxy's disk array on the proxy performance. Specically, we investigate the object placement and caching strategies that utilize the storage capacity and disk bandwidth of the proxy's disk array most e-ciently. To highlight the impact of the object placement and caching strategies we do not include the streaming over the local access network in our study, that is, we focus on the admission control condition loss . We refer the interested reader to [22, 31, 14, 6] for studies of continuous media streaming over local access networks. To motivate the replication and striping of video objects in the proxy's disk array, we rst consider a very simple caching scenario. Suppose that the 10 video objects from Table 2 are cached in the proxy's disk array. Furthermore, suppose, that each video object is placed on its own disk, that is, a localized placement strategy with one video object per disk is employed. We use the disk model and streaming model of Section 3 to evaluate this simple caching scenario. We impose the statistical QoS requirement that the long run average fraction of video information (bits) lost due to the limited disk bandwidth be loss . For each video object we use the large deviation approximation (7) to calculate the maximum number of simultaneous streams that can be supported by a single disk. The results are reported in Table 3. The table also gives the maximum number of si- Table 3: Number of streams that can be supported by a single disk. Trace Stat. Mux. Peak Allocation bean bond lambs soccer 15 4 star wars 1 14 2 star wars 2 14 2 star wars 3 14 2 star wars 4 14 3 multaneous streams that can be supported when peak rate allocation is used. The video objects have an average rate of 2 Mbps, thus the stability limit is 19 streams. We observe from the table that the statistical admission control criterion allows for signicantly more streams than peak rate allocation. This substantial multiplexing gain comes at the expense of small loss probabilities of the order of 6 . These miniscule losses, however, can be eectively hidden by error concealment techniques and will therefore not be noticed by the viewers. We also observe from Table 3 that the number of simultaneous streams supported by a disk depends on the burstiness of the stored video ob- ject. The disk with the lambs video object, which has the largest peak{to{mean ratio, supports the smallest number of simultaneous streams. On the other hand, the disks storing the soccer and terminator video objects, which have the smallest peak{to{mean ratio, support the most streams. Next, we study the total number of streams that the proxy can typically support, when the requests for the 10 video objects are distributed according to a Zipf distribution with localized placement with one video object per disk, that is, there is one disk with bean, one disk with bond, and so on.) For this illustrative example we assume that the popularity of the video objects in Table 2 decreases in alphabetical order, that is, bean is the most popular object (requested with probability terminator is the least popular object (requested with the probability the typical number of streams, that the proxy can simultaneously support with the following procedure. For a given target number of streams S we generate S requests from the Zipf distribution. We then determine the number of requests that can be supported by the 10 disks using the results from Table 3. We repeat the experiment 1000 times, creating 1000 S requests. If 95 % of these requests can be supported, then we increment S and repeat the entire pro- cedure. The procedure continues until the 95 % criterion is violated. We nd with this procedure that the proxy can typically support 39 simultaneous streams. This, how- ever, is only a small fraction of the disk array's capacity of 138 simultaneous streams (found by adding up the "Stat. Mux" column of Table 3). The reason for this is twofold. First, due to the limited disk bandwidth the proxy cannot satisfy many of the requests for the most popular objects. Secondly, much of the disk bandwidth of the disks housing the less popular objects is underutilized. This phenomenon is commonly referred to as hot{spot problem. The hot{spot problem severely aects the proxy's performance. The proxy either has to reject many requests for the most popular objects (and the clients have to obtain the objects directly from the origin server) or it has to compromise the stream quality by admitting more streams than the QoS criterion loss allows. Both of these options, however, are highly undesirable, as they increase the load on the wide area network and reduce the media quality and level of interactivity oered to the clients. We are thus motivated to study strategies that overcome the hot{spot problem by utilizing the proxy's storage capacity and disk bandwidth more e-ciently. Specically, we study two strategies: Object replication: The proxy stores more than one copy of the popular video objects. The goal is to overcome the hot{spot problem by roughly matching the replication distribution (i.e., the distribution of the number of copies of the objects) to the request distribution Striping placement: The video objects are striped over a subset of the disks in the proxy's disk array. This allows the proxy to use the aggregate disk bandwidth of the entire subset to stream the video objects. If the video objects are striped over the entire disk array (full striping) then the hot{spot problem vanishes and all request distributions can be equally accommodated. Recall that streaming from a proxy with striping placement has been discussed in Section 3.3. We now proceed to discuss object replication in detail. To simplify the discussion we initially assume localized placement. (We shall later study object replication in conjunction with striping). To make the idea of object replication a little more precise, let D denote the number of disks in the proxy's disk array. Let M denote the number of distinct objects in the proxy's cache. Let Cm denote the number of copies of object m in the cache. For simplicity, we initially assume that each disk stores exactly one video object, thus Now suppose that the request pattern for the M object has a known distribution (perhaps a Zipf distribution with known parameter ). To make the replication distribution approximately equal to the request distribution we replicate the objects according to the following replication algorithm: 1. 2. If 3. Calculate 4. If C > D, decrement Cm for the least popular object with Cm > 1, then for the next least popular object with Cm > 1, and so on, until 5. If C < D , increment Cm for the most popular object, then for the next most popular object, and so on, Algorithm 1: Non-uniform replication algorithm. This concludes our discussion of object replication for localized placement. The concept extends to group striping with striping width W > 1 in a straightforward manner. With group striping the video objects are replicated on distinct striping groups. We have conducted a numerical study of object replication and striping placement. In the numerical study we consider a proxy with a disk array consisting of disks. We use the objects from Table 2. In the numerical study the requests for the video objects follow a Zipf distribution with We use the replication algorithm (see Algorithm 1) to match the number of copies of the video objects to the request distribution. We then use the 95 % criterion to determine the number of simultaneous streams that the proxy can typically support. The results are reported in Table 4 for dierent striping widths W . Table 4: Number of simultaneous streams that the proxy can typically support for dierent replication strategies and striping widths. replication strategy W uniform request request The table also gives the number of simultaneous streams that can typically be supported when the video objects are uniformly replicated, that is, there are of each video object in the disk array. Two points are especially noteworthy. First, we observe that replicating objects according to the clients' request pattern signicantly increases the number of streams that the proxy can typically support. For localized placement streaming capacity of the proxy is increased roughly threefold by taking the request pattern into ac- count. The second noteworthy observation is that for uniform replication the streaming capacity increases as the striping width increases from one to two. This is because striping over two disks alleviates the hot{spot problem and thus allows the proxy to better accommodate the clients' requests. As the striping width is increased further, how- ever, the increased seek and rotational overhead of striping becomes the dominant eect, reducing the streaming capacity of the proxy. For the proxy with object replication according to the request pattern localized placement (W =1) gives the largest streaming capacity. This is because localized placement minimizes the disk overhead while object replication according to the request pattern overcomes the hot{spot problem. Table 4 also gives the number of simultaneous streams that the proxy can typically support when the object replication takes the video objects' popularity as well as band-width demand into account. This approach is motivated by the results from Table 3, which indicate that disks housing relatively bursty video objects can support relatively fewer simultaneous streams. To accommodate a given request pattern the proxy should therefore house more copies of objects that consume relatively more disk bandwidth. To make this idea a little more precise let b denote the maximum number of simultaneous streams of object m that can be supported by a single disk. (For the video objects used in the numerical study the b m 's are given in Table 3.) To take an object's bandwidth demand into account we set l c in Step 1 of Algorithm 1. The factor 1 l is larger (smaller) than one for video objects that require relatively more (less) bandwidth. We see from Table 4 that taking the objects' bandwidth demand into consideration increases the proxy performance slightly for localized placement 1). For striping placement this replication strategy does not improve the proxy performance. We next study the robustness of the replication and striping strategies of Table 4 with respect to changes in the request pattern. For this purpose we vary the parameter of the Zipf distribution from which the requests are generated. Throughout this experiment the video objects are replicated according to a Zipf distribution with xed parameter (that is, throughout we use the object replication used in the previous experiment). In other words, the request distribution varies while the replication distribution is held xed. Figure 2 shows the typical number of simultaneous streams that the proxy can support as a function of the Zipf parameter of the request distri- bution. The gure gives plots for uniform replication and replication according to Zipf distribution with localized placement and striping over two disks. We see Uniform (W=1) Uniform (W=2) Zipf, zeta=1 (W=1) Zipf, zeta=1 (W=2) Zipf parameter of request distribution Number of streams Figure 2: Robustness of replication strategies. from the gure that uniform object replication gives good performance only when the client request pattern is fairly uniform, that is, when the Zipf coe-cient of the request pattern is small. For the skewed request distributions that are typical for client request patterns, uniform replication even with striping gives poor proxy performance. Striping over two disks with object replication according to the Zipf distribution with which can be thought of as an estimate of the client request pattern | is very robust to changes in the client request pattern. This strategy can support close to 1050 streams over a wide range of the Zipf coe-cient of the actual request distribution. Striping placement with object replication according to an estimate of the client request pattern thus performs well even when this estimate diers signicantly from the actual request pattern. However, with a good estimate of the request pat- localized placement object replication according the estimate outperforms striping placement. In the studied example, where the estimate of the request pattern is the Zipf distribution with localized placement with object replication according to this estimate outperforms striping placement when the Zipf parameter of the actual request pattern is between 0.6 and 1.4. The localized placement strategy has the added advantage that it is very simple and works well for heterogeneous disk arrays consisting of disks with dierent performance characteristics. Furthermore, localized placement avoids the availability problem of striping placement | if one disk fails then all video les that are striped over this disk become unavailable to the clients. (With localized placement a given disk stores parts of fewer video objects therefore disk failure has less impact of availability.) The availability problem of striping can be mitigated (at the expense of added complexity) through mirroring of video blocks or storing of parity information of the video blocks; see for instance [9] and references therein. Because of its simplicity and potential for improved performance we focus on localized placement in the next section on caching strategies, however, the studied caching strategies apply equally well to striping placement. 5 Caching Strategies In the previous section, which served to motivate object replication and striping in the proxy, we assumed that (i) the requests for video objects follow a known distribution, and (ii) all available objects are cached in the proxy. In this section we consider a more realistic scenario, where (i) the client request pattern is unknown, and (ii) only a subset of the available objects can be cached in the proxy. We propose and evaluate caching and replacement policies that either implicitly or explicitly track the client request pattern. The caching policy determines which object (and how many copies thereof) to cache while the replacement policy determines which objects to evict from the cache to space for new objects. 5.1 Implicit Tracking With implicit tracking the caching policy is invoked whenever the proxy can not satisfy a client's streaming request. This is the case when either (1) the requested object is not cached, or (2) the requested object is cached but the additional stream can not be supported by the cached copy without violating the QoS requirement P disk loss . The basic caching policy is to always try to cache the requested object in case (1). In case (2) we distinguish two policies: caching with object replication and caching without object replication. Caching with object replication attempts to cache an additional copy of the requested object (which is generated internally from the already cached copy). Caching without object replication, on the other hand, leaves the cache contents unchanged and the requested object is streamed from the origin server directly to the client. If there is not enough free disk space to store the new object (or additional copy when caching with replication is employed) we invoke a replacement policy. We emphasize at this juncture that our focus is on the impact of the caching policy on the proxy performance. The studied caching policies (i.e., caching with object replication and caching without object replication) may be combined with any replacement policy. For illustration we consider the simple and well{known Least Recently Used (LRU) and Least Frequently Used (LFU) replacement policies. (We note that a wide variety of replacement policies has been proposed, however, LRU continues to be the very popular policy due to its simplicity.) With LRU replacement we rst check whether we can remove one copy of the object that was requested least recently without interrupting on-going streams. We verify whether the ongoing streams (if any) of the least recently requested object can be supported by the remaining copies (if any). If so, we remove one copy of that object. Otherwise, we move on to the next to least recently requested object and start over. This replacement algorithm terminates when we have freed up enough space to cache the new object or we have considered all cached objects. In the latter case the attempt to cache the new object fails and the object is streamed from the origin server directly to the client. With LFU replacement a request counter is maintained for every object in the cache. When the replacement policy is invoked we consider rst the object with the smallest request counter value, then the object with the next to smallest counter value, and so on. We have conducted a simulation study of these caching strategies. For the simulation study we generate 1000 video objects from the 10 pseudo traces from Table 2 in the following manner. For each of the 1000 video objects we randomly select one of the 10 pseudo traces and a random average rate between 1.5 and 2.5 Mbps. For each video object we furthermore draw a random starting phase into the selected pseudo trace and a random lifetime from an exponential distribution with mean L video frames. In the simulation client requests arrive according to a Poisson pro- cess. For each client request one of the 1000 video objects is drawn according to the Zipf distribution with parameter . (The request arrival rate is set to 0:95D b m=L, where D is the number of disks in the proxy and b m is the average number of streams that a single disk can support subject to P disk loss simplicity we assume that each disk stores at most one video object.) Figure 3 shows the hit rate as a function of the number of disks in the proxy for caching without object replication and caching with object replication both with LRU replacement and LFU replacement (ignore the \Explicit tracking" curves for now). The hit rate is dened as the ratio of the number of requests served out of the cache (without contacting the origin server) to the total number of client requests. (The results for the byte hit rate are sim- ilar.) The Zipf parameter of the client request distribution is set to experiment. The average length of the video objects is set to (corresponding to 3.5 minutes) or responding to 14 minutes). We observe from the plots that caching with object replication outperforms caching without replication by a signicant margin for 0.75 the margin is less pronounced. Interestingly, we see from Figure 3 that the replacement policy (LRU or LFU) has no impact on the proxy performance. In Figure 4 we plot the hit rate as a function of the average length of the video objects (which we assume is identical to the stream lifetimes, i.e., clients receive the entire object). We consider proxies with disks and with disks and Zipf request patterns with and 1.0 in this experiment. The gure reveals that for short{lived streams (< 2000 video frames, corresponding to roughly 1.3 minutes) LFU replacement outperforms LRU replacement. We also see that the caching policy (caching with or without object replication) has no impact on the proxy performance. As the streams become longer lived, however, the replacement policy looses its impact on the proxy performance and the caching policy becomes dominant (especially for the more localized access pattern, 1.0, and the large proxy, 100). The reason for this is that, roughly speaking, it becomes harder to nd an object copy that can be removed without interrupting on-going streams when the streams become longer lived. As a result both replacement policies tend to pick the same object for removal. The main conclusion from this experiment is that object replication is not needed for caching of text and image objects (which can be thought of as having a lifetime of zero). However, for caching of continuous media objects, replication is crucial for good proxy performance, especially when a large proxy serves a client community with a highly localized access pattern. We next investigate how well the caching policies adapt to dierent client request patterns. In Figure 5 we plot the hit rate as a function of the Zipf parameter of the request distribution. In this experiment we consider proxies with disks and disks and the average object length is set to frames. The plots clearly show that caching with object replication outperforms caching without object replication for Zipf request parameters larger than 0.65. Note that the four discussed and evaluated caching strategies (caching with and without object replication, both with LRU and LFU replacement) implicitly track the client request pattern. Popular objects | once cached | tend to stay in the cache since it is very likely that their removal would interrupt ongoing streams. In addition, caching with object replication is able to adapt to highly localized request patterns as it tends to cache more copies of objects that are relatively more popular. A shortcoming of the implicit tracking schemes is that they do not directly take the objects' popularities into consideration. We observed in our simulations that quite frequently, moderately popular objects ll up the cache and prevent very popular objects from being cached. We are therefore motivated to explicitly take the objects' popularities into consideration. 5.2 Explicit Tracking Our explicit tracking approach uses an exponential weighted moving average to estimate the client request pat- tern. Based on the estimated request pattern we determine which objects (and how many copies thereof) to cache in the proxy. The estimation procedure works as follows. The proxy maintains estimates of the request rate (requests per time slot of length , we set our numerical work) for all objects m; requested by its client community. The estimates are updated at the end of every time slot. Let req m denote the number of requests for object m in the just expired time slot. The estimates r m are updated according to where m is an object specic dampening factor. We set m such that (1 m is the \aging time" (in multiples of the slot length) of object m. We propose to set m to a small value for objects that \age" relatively quickly, such as news clips. On the other hand, should be set to a large value for objects that \age" slowly, such as on{line lectures, operating instructions or video clips showcasing products in on{line shopping sys- tems. In our numerical work we set objects. Based on the estimated request rates ^ we calculate the popularity estimates ^ r l Number of disks Hit Rate Explicit Tracking Obj. Rep., LRU Obj. Rep., LFU Number of disks Hit Rate Explicit Tracking Obj. Rep., LRU Obj. Rep., LFU a) Number of disks Hit Rate Explicit Tracking Obj. Rep., LRU Obj. Rep., LFU Number of disks Hit Rate Explicit Tracking Obj. Rep., LRU Obj. Rep., LFU c) Figure 3: Impact of proxy server resources. We use the popularity estimates ^ q m to decide which objects (and how many copies thereof) to cache. Our caching policy strives to match the distribution of the number of copies of the cached objects to the estimated popularities. For- mally, denote the number of copies of object m required to match the estimated popularities denote the number of copies of object m that are currently in the cache. For reasons that will become clear shortly, we distinguish between the number of copies Cm in the cache and the number of copies ^ Cm suggested by the popularity estimates. The Cm 's are matched to the ^ 's with the following replication algorithm: 2. 3. Calculate ^ CM . 4. If ^ Cm for the most popular object, then for the next most popular object, and so on, Algorithm 2: Replication algorithm. The storage overhead of this popularity estimation procedure is O(M ). This is because the estimate , the counter req m , the popularity estimate ^ am , and the object replication have to be maintained for every object requested by the proxy's client com- 7Average Object Length Hit Rate Explicit Tracking Obj. Rep., LRU Obj. Rep., LFU Average Object Length Hit Rate Explicit Tracking Obj. Rep., LRU Obj. Rep., LFU a) Average Object Length Hit Rate Explicit Tracking Obj. Rep., LRU Obj. Rep., LFU Average Object Length Hit Rate Explicit Tracking Obj. Rep., LRU Obj. Rep., LFU c) Figure 4: Impact of average object length. munity. The time complexity of the replication algorithm is approximately O(M ). To see this, note that M iterations are required to compute the popularity estimates ^ am and matching replication ^ Cm . At most D iterations of Step 4 are required until ^ typically D M . For simplicity we assume in the replication algorithm that each disk stores exactly one video object. Note that this replication algorithm diers from the replication algorithm of Section 4 in that it caches only objects with 1=D. Based on the ^ Cm 's obtained with this replication algorithm we propose a caching policy for explicit tracking. Similar to the implicit strategies discussed in the previous section, the caching policy for explicit tracking is invoked whenever the proxy can not satisfy a client's streaming request. This is the case when either (1) the requested object j is not cached (i.e., C or (2) the requested object j is cached but the additional stream can not be supported by the cached copies C j 1 without violating the QoS requirement P disk loss . Our caching policy with explicit tracking works as follows. First, we execute the replication algorithm to determine the current popularity estimates q m and the matching object replication we do not attempt to cache object j and it is streamed from the origin server directly to the client. Otherwise, i.e., if ^ to store a copy of object j in the disk array. In case (1) this is the rst copy of object j , which is obtained via the wide area network from the appropriate origin server. In case (2) this is an additional copy of object j , which is generated internally from the other already cached copy. If there is enough empty disk space in the proxy we place the new/additional copy of object j there, otherwise we invoke the replacement policy. Roughly speaking, the replacement policy tries to remove one copy of an object that has more copies in the Zipf parameter of request distribution Hit Rate Explicit Tracking Obj. Rep., LRU Obj. Rep., LFU Zipf parameter of request distribution Hit Rate Explicit Tracking Obj. Rep., LRU Obj. Rep., LFU a) Zipf parameter of request distribution Hit Rate Explicit Tracking Obj. Rep., LRU Obj. Rep., LFU Zipf parameter of request distribution Hit Rate Explicit Tracking Obj. Rep., LRU Obj. Rep., LFU c) Figure 5: Impact of object request distribution. cache than are required to match its popularity. Formally, g. If R is non{empty we pick some j 2 R and check whether we can remove one copy of object j without interrupting ongoing streams. This amounts to verifying whether the ongoing object{j streams (if any) can be supported by the remaining copies. If so, we remove one copy of object j and the replacement algorithm terminates if enough disk space has been freed up. Otherwise, we remove object j from consideration by setting R Rfjg and start over. The replacement algorithm terminates when we have freed up enough space or end up with an empty R. In the latter case the attempt to cache object j fails and object j is streamed from the origin server directly to the client. The results of our simulation study of the explicit tracking scheme are given in Figures 3, 4 and 5. The plots show that the explicit tracking scheme consistently out-performs the implicit tracking schemes with LRU or LFU replacement. We observe from Figure 4 that the gap in performance widens as the average object length increases; explicit tracking achieves roughly higher hit rates than the implicit tracking schemes when the average object length exceeds 2000 video frames. Also, we observe from Figure 5 that explicit tracking outperforms the other schemes for all requests patterns. In summary, we nd that explicit tracking is a very attractive caching strategy for continuous media objects. Finally, we investigate the impact of the proposed caching strategies on the utilization of the disk array. We note, however, that the disk array utilization is only an auxiliary performance metric of a caching strategy; the hit rate is the decisive performance metric for a caching strategy. In our utilization analysis we focus on the utilization of the disk array bandwidth We dene the cache utilization as the long run ratio of the sum of the average rates of the streams supported by the proxy to the proxy's total disk bandwidth Zipf parameter of request distribution Cache utilisation Explicit Tracking Obj. Rep., LRU Obj. Rep., LFU Figure Cache utilization for varying Zipf parameter (obtained by summing the disk bandwidths given by Eqn. (1)). Figure 6 gives the cache utilization as a function of the Zipf parameter of the request pattern. We consider a proxy with disks and movies with an average length of frames in this experiment. The plots indicate that caching with object replication achieves higher cache utilizations than caching without object replication; explicit tracking gives even higher utilizations. The cache utilization results strengthen our conclusion of the importance of object replication and explicit popularity tracking. 6 Conclusion We have studied caching strategies for continuous media objects in this paper. The basis for our study is our model for VBR video streaming that provides statistical QoS. We nd that for caching of continuous media objects, conventional caching without object replication achieves only small hit rates. We have proposed novel caching strategies that either implicitly or explicitly track the client request pattern. Our numerical evaluation indicates that these novel caching strategies achieve signicantly higher hit rates for continuous media objects. In our ongoing re-search we study renements of the explicit tracking scheme, such as a rened replacement algorithm, which tries to remove one copy of objects with more than one cached copy before considering objects with only one cached copy. --R Streaming media caching white paper. Random RAIDs with selective exploitation of redundancy for high performance video servers. Web caching and zipf-like distributions: Evidence and implications Characterization of quality and tra-c for various video encoding schemes and various encoder control schemes Dynamic batching policies for an on-demand video server A comparison of bandwidth smoothing techiniques for the transmission of prerecorded compressed video. Data striping and reliability aspects in distributed video servers. Data striping and reliability aspects in distributed video servers. Performance and reliability study for distributed video servers: Mirroring or parity. Contributions toward Real-Time Services on Packet Networks Multimedia storage servers: A tutorial. Multimedia storage servers: A tutorial. Storage and I/O Issues in Large-Scale Computing RCBR: A simple and e-cient service for multiple time-scale tra-c Statistical characteristics and multiplexing of MPEG streams. queueing analysis and bandwidth allocation for VBR MPEG-2 video tra-c in ATM networks On the design of a low-cost video-on-demand storage system I/O issues in a multimedia system. Call admission for prerecorded sources with packet loss. Striping for interactive video: Is it worth it? Architectural considerations for playback of quality adaptive video over the internet. Proxy caching mechanism for multimedia playback streams in the internet. Statistical properties of MPEG video tra-c and their impact on tra-c modelling in ATM systems Design considerations for integrated proxy servers. On the ecient retrieval of VBR video in a multimedia server. Supporting stored video: Reducing rate variability and end-to-end resource requirements through optimal smoothing Real time streaming protocol (RTSP). Proxy pre Seagate Disk Detailed Speci A comparison study of variable bit rate versus A network-conscious approach to end-to-end video delivery over wide area networks using proxy servers Human Behavior and Principle of Least E --TR I/O issues in a multimedia system Contributions toward real-time services on packet switched networks RCBR On the design of a low-cost video-on-demand storage system Dynamic batching policies for an on-demand video server Supporting stored video Quality adaptation for congestion controlled video playback over the Internet Data striping and reliability aspects in distributed video servers Multimedia Storage Servers Striping for Interactive Video Performance and Reliability Study for Distributed Video Servers A Comparison of Bandwidth Smoothing Techniques for the Transmission of Prerecorded Compressed Video Statistical characteristics and multiplexing of MPEG streams Characterization of Quality and Traffic for Various Video Encoding Schemes and Various Encoder Control Schemes --CTR Jussi Kangasharju , Felix Hartanto , Martin Reisslein , Keith W. Ross, Distributing Layered Encoded Video through Caches, IEEE Transactions on Computers, v.51 n.6, p.622-636, June 2002 K. Y. Leung , Eric W. Wong , K. H. Yeung, Designing Efficient and Robust Caching Algorithms for Streaming-on-Demand Services on the Internet, World Wide Web, v.7 n.3, p.297-314, September 2004
statistical QoS;streaming;VBR video;continuous media object;object replication;caching;replacement policy
603650
Relative undecidability in term rewriting.
For a hierarchy of properties of term rewriting systems related to termination we prove relative undecidability: For implications X Y in the hierarchy the property X is undecidable for term rewriting systems satisfying Y. For most implications we obtain this result for term rewriting systems consisting of a single rewrite rule.
Introduction In this paper we consider finite term rewriting systems (TRSs) over finite signa- tures. For these systems termination and confluence are desired properties that are sometimes very hard to prove. Classical results ([7, 9]) state that they are undecidable: no decision procedure exists getting an arbitrary finite TRS as input and giving as output whether the TRS is terminating (confluent) or not. In this paper we don't consider only termination and confluence, but also a number of related properties. For termination they are linearly ordered by implication: The acronyms stand for polynomial termination (PT), !-termination (!T), total termination (TT), simple termination (ST), non-self-embeddingness (NSE), termination (strong normalization, SN), non-loopingness (NL), and acyclicity (AC). We call this the termination hierarchy. One motivation for the properties stronger than termination is that they obey better decomposition theorems. For instance, !-termination and simple termination satisfy direct sum modularity ([12]), and total termination allows distribution elimination without linearity conditions ([20]). Termination itself does not have these properties. The properties weaker than termination are motivated by frequently occurring shapes of infinite reductions. An extra implication SN ) WN (weak normalization) can be added as an independent branch in the hierarchy. The confluence hierarchy reads as follows: WCR Partially supported by the Advanced Information Technology Program (AITP) of the Information Technology Promotion Agency (IPA). ?? Email: [email protected]. The acronyms stand for strong confluence (SCR), confluence (or the Church-Rosser property, CR), local confluence (or weak Church-Rosser, WCR), the normal form property (NF), unique normal forms (UN), and unique normal forms with respect to reduction UN ! . For weakly normalizing systems the properties CR, NF, UN, and UN ! coincide. For terminating systems also WCR and CR coincide and are decidable. Undecidability of confluence is well-known ([9]), for the other properties in the confluence hierarchy it is easy to see too. Also undecidability of most of the properties related to termination is known ([7, 17, 1, 15, 22]), sometimes even for single rules ([2, 15, 13]). The undecidability of !-termination is a new result; this paper includes a sketch of the proof. In this paper we do not only provide a general framework for proving this kind of undecidability, for all implications in the hierarchies except one-PT ) !T- we prove the stronger result of relative undecidability : for such an implication we prove that the property X is undecidable for TRSs satisfying Y . As a consequence, relative undecidability of X ) Z immediately follows from validity of the implication Y ) Z and relative undecidability of X ) Y . All of our proofs are given by means of Post's Correspondence Problem (PCP) in the following way: for all of the implications X ) Y and all instances of PCP we construct a TRS that always satisfies Y , and either satisfies X if and only if the PCP instance admits a solution, or satisfies X if and only if the PCP instance admits no solution. Since PCP is known to be undecidable ([18]), this proves relative undecidability of the implication X ) Y . The main part of the paper consists of constructions of such TRSs parametrized by PCP instances and corresponding proofs of the above mentioned properties. In the next section this is done for the confluence hierarchy and in Sect. 3 for the termination hierarchy. These two sections can be read independently. The definitions of the various properties are given in the respective sections; for further preliminaries on term rewriting we refer to [3, 10]. In the remainder of this section we recall the formulation of PCP: given a finite alphabet \Gamma and a finite set , is there some natural number n ? 0 and (ff such that The set P is called an instance of PCP, the string ff 1 a solution for P . Matiyasevich and Senizergues [14] recently showed that PCP is undecidable even when restricted to instances consisting of seven pairs. We assume that \Gamma is fixed throughout the paper. (One may assume that In our TRSs we need for every a 2 \Gamma a unary symbol a (and sometimes also unary symbols - a, - a and ~ a). For any string we define 2 The Confluence Hierarchy In this section we show relative undecidability of all implications in the confluence hierarchy as presented in the introduction. Actually we show the stronger result that relative undecidability holds for linear TRSs. Let us first recall the definitions of the six properties properties in the confluence hierarchy. A TRS R is called confluent (or Church-Rosser, CR) if equivalently, every two convertible terms have a common reduct. A TRS R is called locally confluent (or weakly Church-Rosser, . A TRS R is called strongly confluent (or strongly Church-Rosser, SCR) if /R \Delta !R R \Delta / R . A TRS R is said to have the normal form property (NF) if every term convertible to a normal form reduces to that normal form, or, equivalently, every term that has a normal form is confluent. A TRS R is said to have unique normal forms (UN) if different normal forms are not convertible. A TRS R is said to have unique normal forms with respect to reduction (UN ! ) if every term has at most one normal form. The above definition of strong confluence originates from Huet [8] and is different from the one in Dershowitz and Jouannaud [3]. They call a TRS R strongly confluent if /R \Delta !R R . Klop [10] calls the latter property subcommutativity (WCR Below we use PCP to show that for each of the five implications X ) Y in the confluence hierarchy the property X is undecidable for TRSs satisfying the property Y . A key observation is that an arbitrary PCP instance P admits a solution if and only if A ! for the TRS R To arrive at results for linear TRSs and for some technical convenience this basic system is replaced by Proposition 1. A ! and only if P admits a solution. Proof. Suppose is a solution for P . So We have the following reduction in Conversely, suppose that A ! Beyond the last A occurring in this reduction sequence it is of the form for some In the underbraced part only rewrite rules of the form g(a(x); are used. Hence ff 1 giving a solution for P . ut Below we make frequent use of the following result of Huet [8]. Theorem 2. Every linear strongly closed TRS is strongly confluent. ut Here a TRS R is called strongly closed if both s for every critical pair hs; ti of R. 2.1 NF ) UN Proposition 3. The TRS R 1 (P ) has unique normal forms for every PCP instance Proof. Consider the TRS R 0 Bg. The relations $ Also the normal forms of the two TRSs are the same. The TRS R 0 linear and strongly closed hence (strongly) confluent by Thm. 2. This implies that R 1 (P ) has unique normal forms. ut Proposition 4. The following statements are equivalent: 1. The TRS R 1 (P ) has the normal form property. 2. The TRS R 1 (P ) is confluent. 3. The PCP instance P admits a solution. Proof. Since confluence implies the normal form property, according to Prop. 1 it suffices to show that (i) A ! has the normal form property and (ii) R 1 (P ) is confluent whenever A ! that A / g(c; c) ! B in R 1 (P ) with B a normal form, hence A ! definition of the normal form property. For (ii) we consider the confluent TRS defined in the proof of Prop. 3. From A ! obtain that the relations confluent too. ut 2.2 CR ) NF Bg. Proposition 5. The TRS R 2 (P ) has the normal form property for every PCP instance P . Proof. The set of normal forms of R 2 (P ) coincides with the set of weakly normalizing terms. Hence the normal form property is trivially satisfied. ut Proposition 6. The TRS R 2 (P ) is confluent if and only if P admits a solution. Proof. Since the relations ! confluent if and only if R 1 (P ) is confluent. Hence the result follows from Prop. 4. ut 2.3 SCR ) CR Ag. Proposition 7. The TRS R 3 (P ) is confluent for every PCP instance P . Proof. One easily checks that the linear TRS R 0 Ag is strongly closed hence (strongly) confluent by Thm. 2. Since the relations ! confluent. ut Proposition 8. The TRS R 3 (P ) is strongly confluent if and only if P admits a solution. Proof. In a shortest R 3 (P )-reduction sequence from A to B the rewrite rules are not used. Hence A ! and only if A ! According to Prop. 1 we have to show that R 3 (P ) is strongly confluent if and only if A ! In R 3 (P ) we have B / g(c; c) ! A. If R 3 (P ) is strongly confluent then A. Since any reduction sequence from A to C must pass through B, in both cases we have the desired A ! Conversely, if A ! one easily checks that R 3 (P ) is strongly closed and therefore strongly confluent by Thm. 2. ut 2.4 CR ) WCR Cg. Proposition 9. The TRS R 4 (P ) is locally confluent for every PCP instance P . Proof. One easily checks that all critical pairs of R 4 (P ) are joinable. ut Proposition 10. The TRS R 4 (P ) is confluent if and only if P admits a solution Proof. In a shortest R 4 (P )-reduction sequence from A to B the rewrite rules are not used. Hence A ! and only if According to Prop. 1 we have to show that R 4 (P ) is confluent if and only if A ! In R 4 (P ) we have A / f(c; c) confluent then A ! which is equivalent to A ! Conversely, if we obtain confluence by considering the linear and strongly closed TRS R 0 Cg. ut 2.5 UN In this subsection we assume that PCP instances are presented as ordered lists sets. This entails no loss of generality. be the union of R 1 ng ng ng c) for all a and ff(x; Dg. Note that n depends on the PCP instance P ; for every ng we have a unary function symbol i. Proposition 11. A $ and only if P admits a solution. Proof. Abbreviate R 1 is a solution for P . ng. Let We have the following conversion in R 0 A / f(c; c; c; Conversely suppose that A and B are convertible in R 5 (P ). Consider a shortest conversion between A and B. Since the rewrite rules in R 5 contribute to a shortest conversion between A and B, it must be of the form t such that in the conversion between 5 -steps take place at root positions. Using the fact that linear and non-erasing one easily concludes that there are no R 1 steps in the conversion between f(c; c; c; t) and B. Hence f(c; c; c; t) and B are convertible in R 2 Because the TRS R 2 confluent and B is a normal form, we obtain f(c; c; c; it easy to show that the term t codes a solution for P . ut The sole purpose of the rules f(x; z) is to avoid unwanted normal forms in R 5 (P ), whose presence would considerably complicate the proofs of Props. 12 and 13 below. Note that the above proposition doesn't hold for (the TRSs based because in R 1 (P ) the terms A and B may be convertible even if P admits no solution. For instance, we have A ! f(100(c); 10(c)) / f(0(c); Proposition 12. The TRS R 5 (P ) has unique normal forms with respect to reduction for every PCP instance P . Proof. By induction on the structure of terms we can easily prove that every term has at most one normal form. ut Proposition 13. The TRS R 5 (P ) has unique normal forms if and only if P does not have a solution. Proof. According to Prop. 11 we have to show that R 5 (P ) admits two different convertible normal forms if and only if A and B are convertible. If A and B are convertible then so are the different normal forms B and D: B Conversely, suppose that R 5 (P ) admits two different convertible normal forms . Then we can write t B, D, c or a variable, for 2. Due to the shape of the rules ff 1 is not affected in the conversion ff 1 s 2 are different. Since no non-trivial conversion is possible starting from c or a variable, we conclude that s 1 and s 2 are D and B, or vice versa. Hence D and are convertible, and since A / C ! D also A and B are convertible. ut 3 The Termination Hierarchy In this section we show relative undecidability of the last six implications in the termination hierarchy as presented in the introduction. Before we can define the properties in the termination hierarchy, we need a few preliminary definitions. Throughout the following we assume that F is a finite signature containing at least one constant. A (strict partial) order ? on the set T (F) of ground terms is called monotonic if for all f 2 F and t; and an order ? on T (F) are called compatible if t ? u for all rewrite steps t !R u. For compatibility with a monotonic order it suffices to check that loe ? roe for all rules l ! r in R and all ground substitutions oe. An F-algebra consists of a set A and for every f 2 F a function fA : A n ! A, where n is the arity of f . A monotone F-algebra (A; ?) is an F-algebra A for which the underlying set is provided with an order ? such that every algebra operation is monotonic in all of its arguments. More precisely, for all f 2 F and a; b 2 A with a ? b we have fA called well-founded if ? is a well-founded order. A monotone F-algebra (A; ?) is called simple if for all n-ary f 2 F with n - 1, a an 2 A, and have fA (a an ) - a i . Every monotone F-algebra (A; ?) induces an order ?A on the set of terms T only if [ff](t) ? [ff](u) for all assignments ff A. Here [ff] denotes the homomorphic extension of ff, i.e., the value [ff](t) does not depend on ff and is simply written as [t]. A TRS R and a monotone algebra are called compatible if R and ?A are compatible. The set of rewrite rules is the arity of f , is denoted by Emb(F), or simply by Emb when the signature F can be inferred from the context. The properties in the termination hierarchy are now defined as follows. A TRS is called terminating (or strongly normalizing, SN) if it does not allow infinite reductions, or, equivalently, it is compatible with a well-founded monotone algebra. A TRS R is called weakly normalizing (WN) if every term reduces to at least one normal form. A TRS R over a signature F is called simply terminating equivalently, it is compatible with a simple monotone F-algebra. A TRS over a signature F is called totally terminating if it is compatible with a monotonic well-founded total order on T (F), or, equiva- lently, it is compatible with a well-founded monotone F-algebra (A; ?) in which the order ? is total. A TRS over a signature F is called !-terminating if it is compatible with a well-founded monotone F-algebra (A; ?) in which A = N and ? is the usual order on N. A TRS over a signature F is called polynomially terminating if it is compatible with a well-founded monotone F-algebra (A; ?) in which A = N, ? is the usual order on N, and for which all functions fA are polynomials. A TRS R is called looping if it admits a reduction R C[toe] for some term t, context C, and substitution oe. A TRS R is called cyclic if it admits a reduction R t for some term t. A TRS R is called self-embedding if it admits a reduction R Emb t for some terms t, u. Recent investigations of these notions include [4, 5, 16, 19, 20, 23]. Validity of most of the implications in the termination hierarchy is direct from the defini- tions; only TT ) ST requires some well-known argument, see e.g. [20], and NSE theorem. None of the implications are equivalences: for all implications X ) Y in the termination hierarchy a TRS exists satisfying Y but not X . For infinite TRSs over infinite signatures the termination hierarchy is more complicated: if the notion of embedding is not changed then NSE ) SN does not hold any more, if the notions of embedding and simple termination are adjusted as motivated in [16], then the implication TT ) ST no longer holds ([16]). In this paper however we consider only finite TRSs over finite signatures. All TRSs needed for the termination hierarchy are modifications of two basic TRSs parameterized by an arbitrary PCP instance P . For any string any term t we define - an The two basic TRSs are ae ae The system R(P ) is a minor modification of the basic system from [13]; the system S(P ) is from [22]. The next well-known proposition is the motivation for defining these systems. Proposition 14. The following statements are equivalent: 1. The TRS R(P ) is terminating. 2. The TRS S(P ) is terminating. 3. The PCP instance P admits no solution. Proof. We sketch the proof of the equivalence of 1 and 3; the equivalence proof of 2 and 3 is similar. Suppose is a solution for P . So We have the following cyclic reduction in R(P Conversely, suppose that R(P ) admits an infinite reduction. It is not difficult to see that there exists an infinite reduction in which all steps take place at the root position and both kinds of rewrite rules are used infinitely often. (This can be shown formally using type elimination [20].) Any such reduction must contain a subsequence of the form where in the underbraced part only rewrite rules of the form F (ff(x); fi(y); z) ! are used. Hence solution for P . ut This proves undecidability of termination. Since the constructed infinite reduction is always cyclic, this also proves undecidability of both loopingness and cyclicity. The advantage of S(P ) over R(P ) is that it is length-preserving, which means that substitutions oe. Here jtj denotes the number of function symbols in t. Since for length-preserving TRSs termination and simple termination coincide, this proves that both simple termination and self-embeddingness are undecidable. The main result of [22] is that S(P ) is totally terminating if and only if P admits no solution, proving undecidability of total termination. 3.1 Let ae Proposition 15. The TRS S 1 (P ) is acyclic for every PCP instance P . Proof. For a proof by contradiction, assume a cyclic S 1 (P )-reduction exists. Applying rules of the form F (c; c; strictly increases the number of g symbols, while the other kind of rules does not change the number of g symbols. Hence in a reduction only rules of the second kind are applied. But these rules constitute a terminating system, yielding the desired contradiction. ut Proposition 16. The TRS S 1 (P ) is looping if and only if P admits a solution. Proof. If is a solution for P then we have the S 1 (P )-loop Conversely, if S 1 (P ) is looping then it admits an infinite reduction. Erasing all occurrences of g in any infinite S 1 (P )-reduction yields an infinite R(P )- reduction. According to Prop. 14, P admits a solution. ut 3.2 SN ) NL Let Proposition 17. The TRS S 2 (P ) is non-looping for every PCP instance P . Proof. For arbitrary terms t define inductively: For every S 2 (P )-reduction step t ! u we have Assume S 2 (P ) admits a loop. Choose a loop which the nesting of F symbols in t is minimal. From /(t) - /(C[toe]) we conclude that C only consists of g and h symbols; from we conclude that C is the trivial context. Hence consisting only of unary symbols. Hence D[F Due to minimality not all steps take place inside t 1 , t 2 , t 3 . Moreover, at least one of the steps must affect the context D for otherwise we would have F with only applications of the rules F (ff(x); fi(y); z) ! F (x; y; z) at root positions, but then the size of the maximal topmost part of t 1 consisting entirely of symbols in \Gamma must exceed that of t 1 oe, which is clearly impossible. Hence we obtain a non-empty reduction in the TRS consisting of the three rules Considering size and observing that the first two rules are terminating yields a contradiction. ut Proposition 18. The TRS S 2 (P ) is terminating if and only if P admits no solution. Proof. Let be a solution for P . Write fl(c)). For every we have the S 2 (P )-reduction easily extending to an infinite reduction. Conversely, assume S 2 (P ) admits an infinite reduction. Erasing all occurrences of f , g, and h yields an infinite R(P )- reduction. According to Prop. 14, P admits a solution. ut 3.3 NSE ) SN Let Proposition 19. The TRS S 3 (P ) is terminating for every PCP instance P . Proof. We apply semantic labelling as described in [21]. As model M we choose two elements 0, 1, with interpretations FM (x; right-hand sides of the rules are equal to 1 in this interpretation, M is indeed a model for S 3 (P ). Using this model we label the symbol F by the value of its first argument, yielding the labelled system The main result of semantic labelling states that S 3 (P ) is terminating if and only if S 0 terminating. The latter holds by recursive path order: choose Proposition 20. The TRS S 3 (P ) is self-embedding if and only if P admits a solution. Proof. Let be a solution for P . Then we have the S 3 (P )-reduction self-embedding. Conversely, assume S 3 (P ) is self-embedding. Let /(t) denote the maximal nesting of F and G symbols in a term t: Obviously, Emb t be such that /(t) is minimal. We may assume that the topmost symbol of t is either (i) F or (ii) G. Since we conclude that the root symbols of t and u coincide. Moreover, by our minimality assumption, there is at least one reduction step in at the root position. First we consider case (i). The S 3 (P )-reduction from t to u must start as for otherwise there would be no reduction step at a root position. Since the root symbols of t and u coincide, it further follows that G(a(t 2 Consequently, a(t 2 ) is a solution for P . Next we consider case (ii). Write Note that the rule G(c; c; z) ! F (h(c); c; z) is not applicable at root positions in the S 3 (P )-reduction ( ) from t to u because for no term t 0 there is an S 3 (P )-reduction from F (h(c); c; t 0 ) to u. Hence only rules of the form G(ff(x); are applicable at root positions in ( ) and thus the root symbol of every term in ( ) is G. For every reduction step G(t 0 3 ) in ( ) we have either (1) t 0 the reduction took place in t 0 1 if the reduction took place in t 0 1 , or (3) t 0 1 is a proper subterm of t 0 the reduction took place at the root. By assumption alternative (3) occurs at least once. Using the well-known facts that . \Delta ! . and . \Delta . it follows that there are no reduction steps at root positions in u ! Emb t. Hence . Combining this with t 1 ! yields contradicting the minimality of /(t). We conclude that case (ii) is impossible. ut be the TRS ae Proposition 21. The TRS S 4 (P ) is non-self-embedding for every PCP instance Proof. For a term t, let ktk denote the number of F , a, and - a symbols in t. Clearly for every reduction step t ! For a proof by contradiction, assume a self-embedding reduction kuk, in u ! Emb t only the rule h(x) ! x is applied. Just as in the proof of Prop. 20 we may assume that there is at least one reduction step in at the root position. Hence we may write ( ) as where in the underbraced parts no steps take place at root positions. (Note that no term of the form F (h(v 1 which is a contradiction. ut Proposition 22. The TRS S 4 (P ) is simply terminating if and only if P admits no solution. Proof. According to Prop. 14 it is sufficient to show that S 4 (P ) is simply terminating if and only if S(P ) is terminating. Suppose S(P ) is non-terminating. non-terminating and hence simply terminating. Conversely, assume S(P ) is terminating. Since S(P ) is length-preserving it is simply terminating and thus admits a compatible simple monotone algebra (A; ?). By defining hA becomes a simple monotone algebra compatible with S 4 (P ), hence S 4 (P ) is simply ter- minating. ut Let Proposition 23. The TRS S 5 (P ) is simply terminating for every PCP instance Proof. Since S 5 (P ) is length-preserving it suffices to prove termination. We apply semantic labelling. As model M we choose two elements 0, 1, with interpretations right-hand sides of the rules are equal to 0 in this interpretation, M is indeed a model for S 5 (P ). Using this model we label the symbol F as follows: it is labelled by 1 if the interpretations of the first and the third argument are equal, and by 0 otherwise. This yields the labelled system From [21] we know that S 5 (P ) is terminating if and only if S 0 The latter holds by lexicographic path order: choose for all a 2 \Gamma and compare the arguments of F 1 from left to right. ut Proposition 24. The TRS S 5 (P ) is totally terminating if and only if P admits no solution. Proof. Assume P admits no solution. According to [22] the TRS S(P ) is totally hence admits a compatible well-founded monotone algebra (A; ?) with ? a total order on A. We define the well-founded monotone algebra (B; -) by interpretations One easily verifies that (B; -) is a well-founded monotone algebra compatible with S 5 (P ). Since - is a total order on B, S 5 (P ) is totally terminating. Con- versely, assume that is a solution for P . For a proof by contradiction, suppose that S 5 (P ) is totally terminating. Then S 5 (P ) admits a compatible monotonic well-founded total order ? on ground terms. Let t, u be arbitrary ground terms (remember that a constant c 2 F is assumed) and a 2 \Gamma . If otherwise ~ a(t) and Hence for all ground terms t, u and all a F (a(t); u; a(t); u). Using this result and the compatibility of S 5 (P ) and ? yields where fl is written as fl 1 a, contradicting the irreflexivity of ?. ut be the TRS? ? ! Proposition 25 [6]. The TRS S 6 (P ) is totally terminating for every PCP instance Proof. We use the Knuth-Bendix order ([11]) where h is assigned weight 0, and every other function symbol weight 1. For the precedence we choose h ? F ? a ? c for all a 2 \Gamma . Note that h satisfies the constraint the Knuth-Bendix order requires, namely that every function symbol of weight 0 is unary and greatest in precedence. We take lexicographic status for each function sym- left-to-right and G right-to-left. The induced Knuth-Bendix order orients each rule from left to right. By a result of Ferreira [4, Thm. 4.47] the TRS S 6 (P ) is not only terminating, but even totally terminating. ut Proposition 26 [6]. The TRS S 6 (P ) is !-terminating if and only if P admits no solution. Proof. Let be a solution for P . Then we have for all ground terms t an S 6 (P )-reduction For a proof by contradiction, assume that S 6 (P ) is !-terminating, with compatible well-founded monotone algebra (A; ?) where t). The above reduction proves !-termination of the single rule contradicting [20, Prop. 11]. Hence S 6 (P ) is not !-terminating. This leaves to prove that S 6 (P ) is !-terminating if P has no solution. Here we sketch the proof, for more details we refer to [6]. For a ground term t, let ktk denote the number of barred and unbarred letters in t not below an F , G, or h symbol. An analysis of reduction patterns shows that any reduction starting from a term of the shape h k (G(p; q; with at least 3 kskg steps at the topmost F or G symbol, gives rise to a solution for P . We define len F (p; q; s) to be the maximum number of reduction steps at the topmost F or G symbol, starting from a term of the shape h k Similarly we define len G (p; q; starting terms of the shape h k (G(p; q; We define auxiliary functions on N+ as follows: digits Next an auxiliary function defined recursively as follows: c if h(c) otherwise Now we define the well-founded monotone algebra (A; ?) with GA (x; w)). The definition of - expresses the fact that from [t] one can reconstruct the sequence of barred and unbarred letters of t. This information is essential to determine the estimated maximal topmost reduction length of F and G terms. Formally, structural induction on i shows: for all strings i of barred and unbarred letters and for all ground terms equivalent to the existence of a ground term t 00 such that Structural induction on ff proves that for Now one can show that [loe] ? [roe] for any ground instance loe ! roe of a rule in S 6 (P ). The central step in this proof is 156 for the first type of rules. The functions 0A , 1A , and hA are trivially monotonic. Observing that conc and revc are monotonic, and that bound is weakly monotonic, in every argument, one obtains that - 0A , - 1A are monotonic as well. To establish that FA and GA are monotonic in all arguments, one proves first that if P has no solution then for all x; len F (-(x); -(y); -(z); and len G (-(x); -(y); -(z); Obviously FA and GA are monotonic in their last argument. For the other argu- ments, let x where at least one of these inequalities is strict, and prove that log 156 b FA (x;y;z;w;u) 10u c. So indeed we arrive at a compatible well-founded monotone algebra corresponding to the positive integers N+ , which is order isomorphic to N, hence S 6 (P ) is !- terminating. This completes the proof. ut 3.7 WN and CR None of the TRSs R(P ), S(P confluent for arbitrary PCP instances. This can be repaired by adding appropriate rewrite rules of the shape F (x; affecting any of our propositions. This has the additional benefit of making the normalizing. (Note that S 3 (P ) to S 6 (P ) are always terminating.) Consequently all of our results hold for confluent weakly normalizing TRSs. In particular, the union of R(P ) and the rule F (x; easily seen to be weakly normalizing while it is terminating if and only if P admits no solution as in Prop. 14. This proves relative undecidability of the implication SN ) WN. Conclusions For most of the implications in the confluence and termination hierarchies we proved relative undecidability; only for polynomial termination the question of (relative) undecidability is still open. One can wonder whether similar results hold for TRSs consisting of single rules. Undecidability of termination ([2]), and non-self-embeddingness and simple termination ([15]) of single rules was already known. For the lower four implications in the termination hierarchy indeed relative undecidability for single (even orthogonal) rules can be proved; this work is still in progress. --R Linear Bounded Automata and Rewrite Systems: Influence of Initial Configuration on Decision Properties Simulation of Turing Machines by a Regular Rewrite Rule Rewrite Systems Termination of Term Rewriting: Well-foundedness Total Termination of Term Rewriting On the Uniform Halting Problem for Term Rewriting Systems Abstract Properties ans Applications to Term Rewriting Systems Equations and Rewrite Rules: A Survey Rewriting Systems Simple Word Problems in Universal Algebras Modularity of Simple Termination of Term Rewriting Systems On Termination of One Rule Rewrite Systems Decision Problems for Semi-Thue Systems with a Few Rules Simple Termination is Difficult The Undecidability of Self-Embedding for Term Rewriting Systems A Variant of a Recursively Unsolvable Problem Termination of Term Rewriting: Interpretation and Type Elimination Termination of Term Rewriting by Semantic Labelling Total Termination of Term Rewriting is Undecidable Utrecht University --TR Rewrite systems Simulation of Turing machines by a regular rewrite rule rewriting systems Termination of term rewriting On termination of one rule rewrite systems Total termination of term rewriting is undecidable Omega-termination is undecidable for totally terminating term rewriting systems Simple termination of rewrite systems rewriting and all that Relative undecidability in term rewriting A Complex Example of a Simplifying Rewrite System Relative Undecidability in the Termination Hierarchy of Single Rewrite Rules Problems in Rewriting III Relative Undecidability in Term Rewriting Transforming Termination by Self-Labelling Complexity Classes and Rewrite Systems with Polynomial Interpretation Decision Problems for Semi-Thue Systems with a Few Rules --CTR Alfons Geser , Aart Middeldorp , Enno Ohlebusch , Hans Zantema, Relative undecidability in term rewriting: II. the confluence hierarchy, Information and Computation, v.178 n.1, p.132-148, October 10, 2002 Matiyasevich , Graud Snizergues, Decision problems for semi-Thue systems with a few rules, Theoretical Computer Science, v.330 n.1, p.145-169, 31 January 2005
undecidability;term rewriting;termination
603668
Inheritance-based subtyping.
play a dual role in mainstream statically typed object-oriented languages, serving as both object generators and object types. In such languages, inheritance implies subtyping. In contrast, the theoretical language community has viewed this linkage as a mistake and has focused on subtyping relationships determined by the structure of object types, without regard to their underlying implementations. In this paper, we explore why inheritance-based subtyping relations are useful, and we describe two different approaches to extending the MOBY programming language with inheritance-based subtyping relations. In addition, we present a typed object calculus that supports both structural and inheritance-based subtyping, and which provides a formal accounting of our extensions to MOBY.
Introduction There is a great divide between the study of the foundations of object-oriented languages and the practice of mainstream object-oriented languages like JAVA[AG98] and C ++ [Str97]. One of the most striking examples of this divide is the r-ole that class inheritance plays in defining subtyping relations. In most foundational descriptions of OO languages, and in the language designs that these studies have informed, inheritance does not define any subtyping relation, whereas in languages like JAVA and C ++ , inheritance defines a subtyping hierarchy. What is interesting about this distinction is that there are certain id- ioms, such as friend functions and binary methods, that are natural to express in an inheritance-based subtyping framework, but which require substantial complication to handle in a structural subtyping framework. In this paper, we explore why inheritance-based subtyping relations are useful and present a formal accounting of a small language that supports such subtyping relations. We begin by examining the common object-oriented idiom of friend functions and exploring how one might implement this idiom in MOBY [FR99a], which is a language with only structural subtyping. This example illustrates the deficiency of relying solely on structural subtyping in the language design. We then describe an extension to MOBY in Section 3 that adds class types and inheritance-based subtyping to MOBY. We show how this extension supports a number of common idioms, such as friend functions, binary methods, and object cloning. We then present XMOC in Section 4, which is an object calculus that supports both structural and inheritance-based subtyping, as well as privacy. XMOC provides a model of the type system of extended MOBY, and we prove subject-reduction for its type system to validate the design of Extended MOBY. In Section 5 we describe related work and we conclude in Section 6. 2 The problem with friends Both C ++ and JAVA have mechanisms that allow some classes and functions to have greater access privileges to a class's members than others. In C ++ , a class grants this access by declaring that certain other classes and functions are friends. In JAVA, members that are not annotated as public, protected, or private are visible to other classes in the same package, but not to those outside the package. In this section, we examine how to support this idiom in MOBY, a language with structural subtyping and type Rep <: Bag objtype Bag { meth add : Int -> Unit } val union : (Rep, Rep) -> Unit val mkBag : Unit -> Rep { class Bag { public field items : var List(Int) public meth add { self.items := x :: self.items } public maker mk () { field items = Nil } objtype objtype Bag { meth add : Int -> Unit } { List.app s1.add s2.items } fun mkBag () -> new mk() Figure 1: Bags and friends using type abstraction flexible control over class-member visibility [FR99a] (we include a brief description of MOBY in Appendix A). This study demonstrates that while it is possible to encode the friends idiom in a language with only structural type relations, the resulting encoding is not very appealing. 2.1 Friends via partial type abstraction A standard way to program friends is to use partially abstract types [PT93, KLM94]. For example, Figure 1 gives the MOBY code for an implementation of a Bag class that has a union function as a friend. In this example, we have ascribed the BagM module with a signature that makes the Rep type partially abstract to the module's clients. Outside the module, if we have an object of type Rep, we can use both the union function and the add method (since Rep is a subtype of Bag), but we cannot access the items field. Inside the module, the Rep type allows access to all of the members of the Bag class; 1 the implementation of the union function exploits this access. Unfortunately, this approach only works for final classes. If we want to extend the Bag class, we must reveal the class in the signature of the BagM module (as is done in Figure 2). In this version, an object created using the mk maker cannot be used as an argument to the union function, because it will not have the Rep type. This limitation also applies to objects created from subclasses of Bag. 2.2 Friends via representation methods To support both friends and class extension for the same class requires a public mechanism for mapping from an object to its abstract representation type. With such a mechanism, we can recover the representation type required by the friend functions. For example, suppose we extend our Bag class to include a method that returns the number of items in the bag. We call this new class CBag (for counting bag), and we want to use the union function on objects created from the CBag class. Figure 3 presents this new implementation. Notice that we have added a public method bagRep to the interface of the Bag 1 The MOBY notation typeof(C) is shorthand for the object type that consists of the public members of class C. type Rep <: typeof(Bag) class Bag { public meth add : Int -> Unit public maker mk of Unit val union : (Rep, Rep) -> Unit val mkBag : Unit -> Rep { Figure 2: Revealing the Bag class class, which returns self at the representation type (Rep). To apply the union function to two bags b1 and b2, we write "Bag.union (b1.bagRep(), b2.bagRep())." This expression works even when b1 and/or b2 are counting bags. Also note that the items field is public inside the BagM module, but is not part of Bag's interface outside the module. This is an example of why objects created from subclasses of Bag are not subtypes of Rep. Although this example does not include friends for the CBag class, we have included the representation method in its interface, which illustrates the main weakness of this approach. Namely, for each level in the class hierarchy, we must add representation types and methods. These methods pollute the method namespace and, in effect, partially encode the class hierarchy in the object types. Furthermore, it suffers from the source-code version of the fragile base-class problem: if we refactor the class hierarchy to add a new intermediate class, we have to add a new representation method, which changes the types of the objects created below that point in the hierarchy. While this encoding approach appears to be adequate for most of the examples that require a strong connection between the implementation and types, it is awkward and unpleasant. 3 Extended MOBY In the previous section, we showed how we can use abstract representation types and representation methods to tie object types to specific classes. From the programmer's perspective, a more natural approach is to make the classes themselves serve the r-ole of types when this connection is needed. In this section, we present an extension of MOBY [FR99a] that supports such class types and inheritance-based subtyping. Intuitively, an object has a class type #C if the object was instantiated from C or one of its descendants. Inheritance-based subtyping is a form of by-name subtyping that follows the inheritance hierarchy. We illustrate this extension using several examples. 3.1 Adding inheritance-based subtyping Inheritance-based subtyping requires four additions to MOBY's type system, as well as a couple of changes to the existing rules: ffl For any class C, we define #C to be its class type, which can be used as a type in any context that module BagM : { type Rep <: typeof(Bag) class Bag : { public meth add : Int -> Unit public meth bagRep : Unit -> Rep public maker mkBag of Unit val union : (Rep, Rep) -> Unit { class Bag { public field items : var List(Int) public meth add { self.items := x :: self.items } public meth bagRep () -> Rep { self } public maker mkBag () { field items = Nil } objtype { List.app s1.add s2.items module { type Rep <: typeof(CBag) class CBag : { public meth add : Int -> Unit public meth bagRep : Unit -> BagM.Rep public meth size : Unit -> Int public meth cbagRep : Unit -> Rep public maker mkCBag of Unit { class CBag { inherits BagM.Bag public field nItems : var Int public meth add { self.nItems := self.nItems+1; public meth size () -> Int { self.nItems } public meth cbagRep () -> Rep { self } public maker mkCBag () { super mkBag(); field nItems objtype Figure 3: Bags and friends using representation methods class B { public meth m1 () -> Int { . } public meth m2 . class C { { public meth m2 . } public meth m1 () -> Bool { . } maker mkC of Unit { . } Figure 4: Example of reusing a private method name is in C's scope. Note that the meaning of a class type depends on its context. Inside a method body, the class type of the host class allows access to all members, whereas outside the class, only the public members can be accessed. ffl We extend class interfaces to allow an optional inherits clause. If in a given context, a class C has an interface that includes an "inherits B" clause, then we view #C as a subtype of #B. Omitting the inherits clause from C's interface causes the relationship between B and C to be hidden. ffl We say that #C is a subtype of relation corresponds to Fisher's observation that implementation types are subtypes of interface types [Fis96]). ffl The existing typing judgements for method and field selection require the argument to have an object type. We add new judgements for the case where the argument has a class type. We add new rules, instead adding of subtyping to the existing rules, to avoid a technical problem that is described in Section 3.2. ffl When typing the methods of a class C, we give self the type #C (likewise, if B is C's superclass, then super has the type #B). ffl When typing a new expression, we assign the corresponding class type to the result. 3.2 Inheritance-based subtyping vs. privacy There is a potential problem in the Extended MOBY type system that has to do with the interaction of inheritance-based subtyping and MOBY's support for privacy. Because MOBY allows signature ascription to hide object members (e.g., the items field in Figure 2), #C can be a subtype of #B even when typeof(C) is not a subtype of typeof(B). The problem arises in the case where class C has defined a method that has the same name as one of B's private methods. Consider the code fragment in Figure 4, for example. 2 Given these definitions, how do we typecheck the expression: "(new mkC()).m1()?" If we allow subtyping on the left-hand side of the method selection, then there are two incompatible ways This example uses a class interface annotation on the class B; this syntactic form avoids the need to wrap B in a module and signature to hide the m2 meth. module BagM : { class Bag : { public meth add : Int -> Unit public maker mkBag of Unit val union : (#Bag, #Bag) -> Unit { class Bag { public field items : var List(Int) public meth add { self.items := x :: self.items } public maker mkBag () { field items = Nil } { List.app s1.add s2.items module { class CBag : { inherits BagM.Bag public meth size : Unit -> Int public maker mkCBag of Unit { class CBag { inherits BagM.Bag public field nItems : var Int public meth add { self.nItems := self.nItems+1; public meth size () -> Int { self.nItems } public maker mkCBag () { super mkBag(); field nItems Figure 5: Bags with friends in Extended MOBY to typecheck this expression. To avoid this ambiguity, we have different rules for the case where the left-hand side has a class type vs. an object type. 3 3.3 Friends revisited We can now revisit our bag class example using the inheritance-based subtyping features of Extended MOBY. In this new implementation (see Figure 5), we use the class type #Bag instead of the Rep type, which allows us to simplify the code by both eliminating the Rep type and the representation method. Note that the interface for the CBag class includes an inherits clause that specifies that it is a subclass of Bag. This relation allows the union function to be used on values that have the #CBag type. 3 Note that the MOBY typing rules do not include a subsumption rule. class { public meth getX : Unit -> Int public meth clone : Unit -> #B public maker mkB of Int maker copyB of #B { public meth getX () -> Int { self.pvtX } public meth clone () -> #B { new copyB(self) } public maker mkB { field field maker { field class C { inherits B public meth clone () -> #C { new copyC(self) } public maker mkC (y : Int) { super mkB(y) } maker { super copyB(orig) } Figure Cloning with privacy in Extended MOBY 3.4 Binary methods Binary methods are methods that take another object of the same class as an argument [BCC There are a number of different flavors of binary methods, depending on how objects from subclasses are treated. Using class types, we can implement binary methods that require access to the private fields of their argument objects. For example, the union function in the previous example can be implemented as a binary method as follows: class Bag { field items : var List(Int) public meth add { self.items := x :: self.items } public meth union { List.app self.add s.items } public maker mkBag () { field items = Nil } Object cloning Another case where inheritance-based subtyping is useful is in the typing of copy constructors, which can be used to implement a user-defined object cloning mechanism. 4 Figure 6 gives an example of cloning in Extended MOBY. Class B has a private field (pvtX), which makes object types insufficient to type check C's use of the copyB maker function. The problem arises because the object type associated with self in type-checking C does not have a pvtX field (because that field is private to B), but the copyB maker function requires one. Thus, we need the inheritance-based subtyping relationship to allow the copyC maker to pass self, typed with #C, as a parameter to the copyB maker. Because we 4 Note that in MOBY, constructors are called makers. signature HAS_SHOW { type InitB class { meth show : Unit -> String maker mk of InitB module { class Pr { inherits M.B public meth print () -> Unit { ConsoleIO.print(self.show()) } maker { super mk(x) } class A { public meth show () -> String { "Hi" } public meth anotherMeth () -> Unit { . } maker mk () { } module class PrA { inherits P.Pr public meth anotherMeth () -> Unit { (self : #A).anotherMeth() } Figure 7: Encoding mixins in Extended MOBY know that C inherits from B, this application typechecks. We also exploit this subtyping relation when we override the clone method. 3.6 Encoding mixins MOBY does not support any form of multiple inheritance, but with the combination of parameterized modules and class types, it is possible to encode mixins [BC90, FKF98]. In this encoding, a mixin is implemented as a class parameterized over its base class using a parameterized module. The class interface of the base class contains only those components that are necessary for the mixin. After applying the mixin to a particular base class, we create a new class that inherits from the mixed base class and uses the class types to reconstitute the methods of the base class that were hidden as a result of the module application. Without class types, it would not be possible to make the original class's methods visible again. For example, Figure 7 gives the encoding of a mixin class that adds a print method to a class that has a show method. After applying PrintMix to class A, we define a class PrA that reconstitutes A's anotherMeth method. Notice that we need to use an explicit type constraint to convert the type of self from #PrA to #A, since we do not have subtyping at method dispatch. While this encoding is cumbersome, it illustrates the power of class types. Also, it might serve as the definition of a derived form that supported mixins directly. d ::= class C oe e ::= x new C(e) Figure 8: Syntax of XMOC terms 3.7 Efficiency of method dispatch Although it is not our main motivation, it is worth noting that method dispatch and field selection from an object with a class type can be implemented easily as a constant time operation. When the dispatched method is final in the class type, the compiler can eliminate the dispatch altogether and call the method directly. In contrast, when an object has an object type, the compiler knows nothing about the layout of the object, making access more expensive. Even when the exact layout of the class is not known because of abstraction (e.g., the mixin encoding from the previous section), we can implement dispatch for objects that have a class type with two memory references and an indirect jump [FRR99]. We have developed a functional object calculus, called XMOC, that models the type system of Extended MOBY and validates its design. XMOC supports both traditional structural subtyping and inheritance-based subtyping. In this section, we discuss the intuitions behind XMOC and state subject reduction results; space considerations preclude a more detailed presentation. The full system is given in Appendices B and C. 4.1 Syntax The term syntax of XMOC is given in Figure 8. An XMOC program consists of a sequence of class declarations terminated by an expression. Class declarations come in two forms. In the first, a class C can be declared to inherit from a parent class b (when b is None, we say that C is a base-class). The class is parameterized by x; whenever an object is constructed from C , x is bound to the supplied initial value. In the second form of class declaration, a class C can be derived from an existing class C 0 by class-interface ascription, which produces a class that inherits its implementation from C 0 , but has the more restrictive class interface oe. A class interface gives the type of the class parameter, the name of the nearest revealed ancestor class (or None), and a typed list of available methods. Types include type variables, function types, recursive object types, and class types. In a class declaration, we denote the base class either by the special symbol None or by the name of the base class applied to an argument. Each method (-) takes a single parameter and has an expression for its body. The syntax of expressions (e) includes variables, functions, function application, new object creation, the special variable self (only allowed inside method bodies), and method dispatch. The last expression form (e @C) is an object-view coercion. Unlike Extended MOBY, XMOC does not map the inheritance relation directly to the subtyping relation; instead we rely on object-view coercions to explicitly coerce the type of an expression from a class to one of its superclasses. This approach avoids the problem discussed in Section 3.2 without requiring two typing judgements for method dispatch. It is possible to automatically insert these coercions into the XMOC representation of a program as part of typechecking (such a translation is similar to the type-directed representation wrapping that has been done for polymorphic languages [Ler92]). 4.2 Dynamic Semantics Evaluation of an XMOC program occurs in two phases. The first phase is defined by the class linking relation, written K; p ae K which takes a dynamic class environment K and links the left-most class definition in p to produce K 0 . Class linking terminates with a residual expression once all of the class declarations have been linked. The second phase evaluates the residual expression to a value (assuming termination). This phase is defined by the expression evaluation relation, which we write as Defining the semantics of linking and evaluation requires extending the term syntax with run-time forms. Correctly handling class-interface ascription provides the greatest challenge in defining the semantics for XMOC. Using this mechanism, a public method m in B can be made private in a subclass C , and subsequently m can be reused to name an unrelated method in some descendant class of C (recall the example in Figure 4). Methods inherited from B must invoke the original m method when they send the m message to self, while methods defined in D must get the new version. One solution to this problem is to use Riecke-Stone dictionaries in the semantics [RS98, FR99b]. Dictionaries provide the ff-conversion needed to avoid capture by mapping method names to slots. For XMOC, we use a related technique, which we call views. When we process a class C , we tag each method newly defined in C with the label C , using the notation C :: -. Inherited and overridden methods retain their existing labels. Furthermore, we replace each occurrence of self in C's new and overridden methods with the object view self @C . Rule 4 in Appendix B describes this annotation formally. At runtime, we represent each object as a pair of a raw object (denoted by meta-variable obj ) and a view (denoted by a class name). The raw object contains the list of annotated methods implemented by the object. The view represents the visibility context in which the message send occurs; those methods in scope in class C are available. With this information, we check two conditions when we lookup method m in runtime object hobj ; Ci: first, that m is in the list of methods provided by obj , and second, that C descends from the class annotating the m method. If these two conditions are met, we return the associated method otherwise, we search in the portion of the object inherited from its base class. Rules 1 and 2 in Appendix formally specify method lookup. 4.3 Static semantics The XMOC typing judgements are written with respect to a static environment \Gamma, which consists of a set of bound type variables (A), a subtype assumption map (S), a class environment (C), and a variable environment (V). The definition of these environments and the complete set of XMOC typing judgements are given in Appendix C. Here we briefly discuss some of the more important rules. As mentioned earlier, each XMOC class name doubles as an object type. We associate such a type with an object whenever we instantiate an object from a class, according to the typing rule (C of \Gamma)(C new C(e) . #C which looks up class C in \Gamma, infers a type - 0 for the constructor argument e, and insures that this type is a subtype of the type of the class parameter - . In contexts that allow subtyping, we can treat a class type as an object type according to the following subtyping judgement: This rule corresponds to the property that #C is a subtype of typeof(C) in Extended MOBY. Note that ff cannot occur free in the types - m , but the object type obj is subject to recursive winding and unwinding. Unlike Extended MOBY, we do not treat a class type #C as being a subtype of its superclass type. Instead we use an object view constraint, which is typed as follows: Because we do not treat inheritance directly as subtyping in XMOC, we only need one rule for typing method dispatch. 4.4 Subject reduction We have proven subject reduction theorems for XMOC. The first states that the linking relation produces a dynamic class environment that is consistent with the static environment defined by the program, and that linking does not change the type of the program. Theorem 1 If (fg; fg; fg; fg) ' p . \Gamma; - and fg; p ae K; e, then \Gamma ' K and \Gamma; K ' e . The second theorem states that a well-typed expression evaluations to an expression with a compatible type. Theorem We say that a program p yields the value w and K, if there exists an expression e such that Given this definition, we can characterize the complete evaluation of a program. Theorem 3 If (fg; fg; fg; fg) ' p . \Gamma; - and p yields w and K, then \Gamma; K ' w . - 0 with 5 Related work Our class types are motivated by the r-ole that classes play in languages like C ++ and JAVA. The main difference between Extended MOBY and the class types provided by these other languages is in the way that abstraction is supported. Extended MOBY allows partial hiding of inherited components using signature ascription, which means that typeof(C) may not be a subtype of typeof(B) even when C is known to inherit from B (see Section 3.2). A related mechanism is C ++ 's private inheritance, which allows a subclass to inherit from a base class while hiding the inherited members and concealing the subtyping relationship. Extended MOBY is more flexible, since it allows hiding on a per-member basis. Extended MOBY also allows the class hierarchy to be hidden by omitting the inherits clause in class interfaces. In C ++ and JAVA the full class hierarchy is manifest in the class types (except for classes related using C ++ 's private inheritance). Another point of difference is that Extended MOBY supports structural subtyping on object types; JAVA has object types (called interfaces), but subtyping is by-name. C ++ does not have an independent notion of object type. Fisher's Ph.D. dissertation [Fis96] is the earliest formalization of class types that we are aware of. In her work, each class is tagged with a row variable using a form of bounded existential row. In our work, we adopt classes as a primitive notion and use the names of such classes in a fashion analogous to Fisher's row variables. A weakness of the earlier work is its treatment of private names; it provides no way to hide a method and then later add an unrelated method with the same name. Our use of class names to label methods in an object value in XMOC (see Appendix B) is similar to the use of role tags on methods in Ghelli and Palmerini's calculus for modeling objects with roles [GP99]. Likewise, our pairing of an object's state with the class name that defines the current view of the object is similar to their representation of object values. The main difference between XMOC and their calculus is in the surface language features being modeled. More recently, Igarashi et al. have described Featherweight Java, which is an object calculus designed to model the core features of JAVA's type system [IPW99]. Like our calculus, Featherweight Java has a notion of subtyping based on class inheritance. Our calculus is richer, however, in a number of ways. Our calculus models private members and narrowing of class interfaces. We also have a notion of structural subtyping and we relate the implementation and structural subtyping notions. The notion of type identity based on implementation was present in the original definition of Standard ML in the form of structure sharing [MTH90]. The benefits of structure sharing were fairly limited and it was dropped in the 1997 revision of SML [MTHM97]. 6 Conclusion This paper presents an extension to MOBY that supports classes as types. We have illustrated the utility of this extension with a number of examples. We have also developed a formal model of this extension and have proven subject reduction for it. We are continuing to work on improving our formal treatment of class types and implementation-based inheritance. 5 One minor issue is that XMOC requires that 5 Since this paper was written, we have developed a more elegant treatment of XMOC based on Riecke-Stone dictionaries and have proven type soundness. A paper describing this revised system is available on the MOBY web page (http://www.cs.bell-labs.com/-jhr/moby). class names be unique in a program; this restriction can be avoided by introducing some mechanism, such as stamps, to distinguish top-level names (e.g., see Leroy's approach to module system semantics [Ler96]). We would also like to generalize the rule that relates class types with object types (rule in Appendix C) to allow positive occurrences of #C to be replaced by the object type's bound type variable. While we believe that this generalization is sound, we have not yet proven it. --R The Java Programming Language. The Hopkins Object Group Type Systems for Object-oriented Programming Languages Classes and mixins. The design of a class mechanism for Moby. Foundations for MOBY classes. A calculus for compiling and linking classes. Foundations for extensible objects with roles. Featherweight Java: A minimal core calculus for Java and GJ. A type system for prototyping languages. Unboxed objects and polymorphic typing. A syntactic theory of type generativity and sharing. The Definition of Standard ML. The Definition of Standard ML - Revised <Year>1997</Year> Statically typed friendly functions via partially abstract types. Privacy via subsumption. --TR Mixin-based inheritance Unboxed objects and polymorphic typing A type system for prototyping languages On binary methods Classes and mixins The Java programming language (2nd ed.) The design of a class mechanism for Moby Featherwieght Java The C++ Programming Language, Third Edition The Definition of Standard ML The Definition of Standard ML Type systems for object-oriented programming languages
inheritance;type theory;programming languages;object-orientation;subtyping
603669
On inner classes.
Inner classes in object-oriented languages play a role similar to nested function definitions in functional languages, allowing an object to export other objects that have direct access to its own methods and instance variables. However, the similarity is deceptive: a close look at inner classes reveals significant subtleties arising from their interactions with inheritance. The goal of this work is a precise understanding of the essential features of inner classes; our object of study is a fragment of Java with inner classes and inheritance (and almost nothing else). We begin by giving a direct reduction semantics for this language. We then give an alternative semantics by translation into a yet smaller language with only top-level classes, closely following Java's Inner Classes Specification. We prove that the two semantics coincide, in the sense that translation commutes with reduction, and that both are type-safe.
Introduction It has often been observed that the gap between object-oriented and functional programming styles is not as large as it might first appear; in essence, an object is just a record of function closures. However, there are differences as well as similarities. On the one hand, objects and classes incorporate important mechanisms not present in functions (static members, inheritance, object identity, access protection, etc. On the other hand, functional languages usually allow nested definitions of functions, giving inner functions direct access to the local variables of their enclosing definitions. A few object-oriented languages do support this sort of nesting. For example, Smalltalk [3] has special syntax for "block" objects, similar to anonymous functions. Beta [8] provides patterns, unifying classes and functions, that can be nested arbitrarily. More recently, inner classes have been popularized by their inclusion in Java 1.1 [6]. Inner classes are useful when an object needs to send another object a chunk of code that can manipulate the first object's methods and/or instance variables. Such situations are typical in user-interface programming: for example, Java's Abstract Window Toolkit allows a listener object to be registered with a user-interface component such as a button; when the button is pressed, actionPerformed method of the listener is invoked. For example, suppose we want to increment a counter when a button is pressed. We begin by defining a class Counter with an inner class Listener: class Counter - int x; class Listener implements ActionListner - public void actionPerformed(ActionEvent e) - x++; - void listenTo(Button b) - b.addActionListener(new Listener()); In the definition of the method actionPerformed, the field x of the enclosing Counter object is changed. The method listenTo creates a new listener object and sends it to the given Button. Now we can write Counter new Counter(); new Button("Increment"); to create and display a button that increments a counter every time it is pressed. Inner classes are a powerful abstraction mechanism, allowing programs like the one above to be expressed much more conveniently and transparently than would be possible using only top-level classes. However, this power comes at a significant cost in complexity: inner classes interact with other features of object-oriented programming-especially inheritance-in some quite subtle ways. For example, a closure in a functional language has a simple lexical environment, including all the bindings in whose scope it appears. An inner class, on the other hand, has access, via methods inherited from superclasses, to a chain of environments- including not only the lexical environment in which it appears, but also the lexical environment of each superclass. Conversely, the presence of inner classes complicates our intuitions about inheritance. What should it mean, for example, for an inner class to inherit from its enclosing class? What happens if a top-level class inherits from an inner class defined in a different top-level class? JavaSoft's Inner Classes Specification [6] provides one answer to these questions by showing how to translate a program with inner classes into one using only top-level classes, adding to each inner class an extra field that points to an instance of the enclosing class. This specification gives clear basic intuitions about the behavior of inner classes, but it falls short of a completely satisfying account. First, the style is indirect: it forces programmers to reason about their code by first passing it through a rather heavy transformation. Second, the document itself is somewhat imprecise, consisting only of examples and English prose. Different compilers (even different versions of Sun's JDK!) have interpreted the specification differently in some significant details. The goal of this work is a precise understanding of the essential features of inner classes. Our main contributions are threefold: ffl First, we give a direct operational semantics and typing rules for a small language with inner classes and inheritance. The typing rules are shown to be sound for the operational semantics in the standard sense. To keep the model as simple as possible, we focus on the most basic form of inner classes in Java, omitting the related mechanisms of anonymous classes, local classes within blocks, and static nested classes. Also, we do not deal with the (important) interactions between access annotations (public/private/etc.) and inner classes (cf. [6, 1]). ffl Next, we give a translation from the language with inner classes to an even smaller language with only top-level classes, formalizing the translation semantics of the Java Inner Classes Specification. We show that the translation preserves typing. ffl Finally, we prove that the two semantics define the same behavior for inner classes, in the sense that the translation commutes with the high-level reduction relation in the direct semantics. The basis of our work is a core calculus called Featherweight Java, or FJ. This calculus was originally proposed in the context of a formal study [4] of GJ [2], an extension of Java with parameterized classes. It was designed to omit as many features of Java as possible (even assignment), while maintaining the essential flavor of the language and its type system. Its definition fits comfortably on a page, and its basic properties can be proved with no more difficulty than, say, those of the simply typed lambda-calculus with subtyping. This extreme simplicity makes it an ideal vehicle for the rigorous study of new language features such as parameterized classes and inner classes. The remainder of the paper is organized as follows. Section 2 briefly reviews Featherweight Java. Section 3 defines FJI, an extension of FJ with inner classes, giving its syntax, typing rules, and reduction rules, and stating standard type soundness results. Section 4 defines a compilation from FJI to FJ, modeling the translation semantics of the Inner Classes Specification, and proves its correctness with respect to the direct semantics in the previous section. Section 5 offers concluding remarks. For brevity, proofs of theorems are omitted; they will appear in a forthcoming technical report [5]. We begin by reviewing the basic definitions of Featherweight Java [4]. FJ is a tiny fragment of Java, including only top-level class definitions, object instantiation, field access, and method invocation. (The original version of FJ also included typecasts, which are required to model the compilation of GJ into Java. They are omitted here, since they do not interact with inner classes in any significant way.) Since FJ is a sublanguage of the extension defined in Section 3, we just show its syntax and an example of program execution here. The rest of the definition can be found in Figure 4. The abstract syntax of FJ class declarations, constructor declarations, method declarations, and expressions is given as follows: class C extends C -C f; K M- e ::= x new C(e) The metavariables A, B, C, D, and E range over class names; f and g range over field names; m ranges over method names; x ranges over parameter names; c, d and e range over expressions; L ranges over class declarations; K ranges over constructor declarations; and M ranges over method declarations. We write f as shorthand for f 1 ,. ,fn (and similarly for C, x, e, etc.) and write M as shorthand for M 1 . Mn (with no commas). We write the empty sequence as ffl and denote concatenation of sequences using a comma. The length of a sequence x is written #(x). We abbreviate operations on pairs of sequences in the obvious way, writing "C f" as shorthand for "C 1 f 1 ,. ,Cn fn " and "C f;" as shorthand for "C 1 f 1 ;. Cn fn;" and "this.f=f;" as shorthand for "this.f 1 =f 1 ;. this.f n =fn ;". Sequences of field declarations, parameter names, and method declarations are assumed to contain no duplicate names. A key simplification in FJ is the omission of assignment, making FJ purely functional. 1 An object's fields are initialized by its constructor and never changed afterwards. Moreover, a constructor has a stylized syntax such that there is one parameter for each field, with the same name as the field; the super constructor is invoked on the fields of the supertype; and the remaining fields are initialized to the corresponding parameters. (These constraints are enforced by the typing rules.) This stylized syntax makes the operational semantics simple: a field access expression new C(e).f i just reduces to the corresponding constructor argument e i . Also, since FJ does not have assignment statements, a method body always consists of a single return statement: all the computation in the language goes on in the expressions following these returns. A method invocation expression new C(e).m(d) is reduced by looking up the expression e 0 following the return of method m in class C in the class table, and reducing to the instance of e 0 in which d and the receiver object (new C(e)) are substituted for formal arguments and the special variable this, respectively. Figure 4 states these reduction rules precisely.) A program in FJ is a pair of a class table (a set of class definitions) and an expression (corresponding to the main method in a Java program). The reduction relation is of the form e \Gamma! e reduces to expression e 0 in one step." For example, given the class definitions 1 Of course, most useful examples of programming with inner classes do involve the side-effecting features of Java. However, the core mechanisms of inner classes themselves do not interact with assignment in any interesting way. By omitting assignment from FJ and FJI, we obtain a much simpler model that offers just as much insight into inner classes. class Pair extends Object - Object fst; Object snd; Pair(Object fst, Object snd) - Pair setfst(Object newfst) - return new Pair(newfst, this.snd); class A extends Object - class B extends Object - the expression new Pair(new A(), new B()).setfst(new B()) reduces to new Pair(new B(), new B()) as follows new Pair(new A(), new B()).setfst(new B()) \Gamma! new Pair(new B(), new Pair(new A(), new B()).snd) \Gamma! new Pair(new B(), new B()) where the underlined subexpressions are the ones being reduced at each step. 3 FJ with Inner Classes We now define the language FJI by extending FJ with inner classes. Like FJ, FJI imposes some syntactic restrictions to simplify its operational semantics: (1) receivers of field access, method invocation, or inner class constructor invocation must be explicitly specified (no implicit this); (2) type names are always absolute paths to the classes they denote (no short abbreviations); and (3) an inner class instantiation expression e.new C(e) is annotated with the static type T of e, written e.new!T? C(e). Because of conditions (2) and (3), FJI is not quite a subset of Java (whereas FJ is); instead, we view FJI as an intermediate language, to which the user's programs are translated by a process of elaboration. We describe the elaboration process only informally here, since it is rather complex but not especially deep, consisting mainly of a large number of rules for abbreviating long qualified names; a detailed treatment is given in the companion technical report [5]. We begin with a brief discussion of the key idea of enclosing instances (Section 3.1). Then we discuss the interactions between inner classes and subclassing (Section 3.2). Finally, we arrive at formal definitions of the syntax (3.3) of FJI, some important auxiliary definitions (3.4), operational semantics (3.5), and the typing relation (3.6). Statements of subject reduction and progress properties (3.7) finish the section. 3.1 Enclosing Instances Consider the following FJI class declaration: class Outer extends Object - Pair Outer(Pair p) -super(); class Inner extends Object - Object snd-p - return Outer.this.p.snd; - Outer.Inner make-inner () - return this.new!Outer? Inner(); - Conceptually, each instance o of the class Outer contains a specialized version of the Inner class, which, when instantiated, yields instances of Outer.Inner that refer to o's instance variable p. The object o is called the enclosing instance of these Outer.Inner objects. This enclosing instance can be named explicitly by a "qualified this" expression (found in both Java and FJI), consisting of the simple name of the enclosing class followed by ".this". In general, the class can refer to enclosing instances, C 1 .this to Cn\Gamma1 .this, as well as the usual this, which can also be written Cn .this. In FJI, an object of an inner class is instantiated by an expression of the form e.new!T? C(e), where e is the enclosing instance and T is the static type of e. The result of e.new!T? C(e) is always an instance of T.C, regardless of the run-time type of e. This rigidity reflects the static nature of Java's translation semantics for inner classes. The explicit annotation !T? is used in FJI to "remember" the static type of e. (By contrast, inner classes in Beta are virtual [7], i.e., different constructors may be invoked depending on the run-time type of the enclosing instance; for example, if there were a subclass Outer 0 of the class Outer that also had an inner class Inner, then o.new Inner() might build an instance of either Outer.Inner or Outer 0 .Inner, depending on the dynamic type of o.) The elaboration process allows type names to be abbreviated in Java programs. For example, the FJI program above can be written class Outer extends Object - Pair Outer(Pair p) -super(); class Inner extends Object - Object snd-p () - return p.snd; - Inner make-inner () - return new Inner(); - in Java. Here, the return type Inner of the make-inner method denotes the nearest Inner declara- tion. Also, in Java, enclosing instances can be omitted when they are this or a qualified this. Thus, this.new!Outer? Inner() from the original example is written new Inner() here. 3.2 Subclassing and Inner Classes Almost any form of inheritance involving inner classes is allowed in Java: a top-level class can extend an inner class of another top-level class, or an inner class can extend another inner class from a completely different top-level class. An inner class can even extend its own enclosing class. (Only one case is disallowed: a class cannot extend its own inner class. We discuss the restriction later.) This liberality, however, introduces significant complexity because a method inherited from a superclass must be executed in a "lexical environment" different from subclass's. Figure 1 shows a situation where three inner classes, A1.A2.A3 and B1.B2.B3 and C1.C2.C3, are in a subclass hierarchy. Each white oval represents an enclosing instance and the three shaded ovals indicate the regions of the program where the methods of a C1.C2.C3 object may have been defined. A method inherited from A1.A2.A3 is executed under the environment consisting of enclosing instances A1.this and A2.this and may access members of enclosing classes via A1.this and A2.this; similarly B1.B2.B3 and C1.C2.C3. In general, when a class has n superclasses which are inner, n different environments may be accessed by its methods. Moreover, each environment may consist of more than one enclosing instance; six enclosing instances are required for all the methods of C1.C2.C3 to work in the example above. From the foregoing, we see that we will have to provide, in some way, six enclosing instances to instantiate a C1.C2.C3 object. Recall that, when an object of an inner class is instantiated, the enclosing object is provided by a prefix e of the new expression. For example, a C1.C2.C3 object is instantiated by writing e.new!C1.C2? C3(e), where e is the enclosing instance corresponding to C2.this. Where do the other enclosing instances come from? First, enclosing instances from enclosing classes other than the immediately enclosing class, such as C1.this, do not have to be supplied to a new expression explicitly, because they can be reached via extends extends Figure 1: A chain of environments the direct enclosing instance-for example, the enclosing instance e in e.new!C1.C2? C3(e) has the form new C1(c).new!C1? C2(d), which includes the enclosing instance new C1(c) that corresponds to C1.this. Second, the enclosing instances of superclasses are determined by the constructor of a subclass. Taking a simple example, suppose we extend the inner class Outer.Inner. An enclosing instance corresponding to Outer.this is required to make an instance of the subclass. Here is an example of a subclass of Outer.Inner: class RefinedInner extends Outer.Inner - Object c; RefinedInner(Outer this$Outer$Inner, Object c) - In the declaration of the RefinedInner constructor, the ordinary argument this$Outer$Inner becomes the enclosing instance prefix for the super constructor invocation, providing the value of Outer.this referred to in the inherited method snd-p. Similarly, in the C1.C2.C3 example, the subclass B1.B2.B3 is written as follows: class B1 extends . - class B2 extends . - class B3 extends A1.A2.A3 - Object b3; B3(Object a3, A1.A2 this$A1$A2$A3, Object b3) - Note that, since an enclosing instance corresponding to A1.this is included in an enclosing instance corresponding to A2.this, the B3 constructor takes only one extra argument for enclosing instances. Here is class: class C1 extends . - class C2 extends . - class C3 extends B1.B2.B3 - Object c3; C3(Object a3, A1.A2 this$A1$A2$A3, Object b3, B1.B2 this$B1$B2$B3, Object c3) - Since the constructor of a superclass B1.B2.B3 initializes A2.this, the constructor C3 initializes only B2.this by qualifying the super invocation; the argument this$A1$A2$A3 is just passed to super as an ordinary argument. In FJI, we restrict the qualification of super to be a constructor argument, whereas Java allows any expression for the qualification. This permits the same clean definition of operational semantics we saw in FJ, since all the state information (including fields and enclosing instances) of an object appears in its new expression. Moreover, for technical reasons connected with the name mangling involved in the translation semantics, we require that a constructor argument used for qualification of super be named this$C 1 is the (direct) superclass, as in the example above. Lastly, we can now explain why it is not allowed for a class to extend one of its (direct or indirect) inner classes. It is because there is no sensible way to make an instance of such a class. Suppose we could define the class below: class Foo extends Foo.Bar - class Bar - Since Foo extends Foo.Bar, the constructor Foo will need an instance of Foo as an argument, making it impossible to make an instance of Foo. (Perhaps one could use null as the enclosing instance in this case, but this would not be useful, since inner classes are usually supposed to make use of enclosing instances.) 3.3 Syntax Now, we proceed to the formal definitions of FJI. The abstract syntax of the language is shown at the top left of Figure 2. We use the same notational conventions as in the previous section. The metavariables S, T, and U ranges over types, which are qualified class names (a sequence of simple names C 1 ,. ,C n concatenated by periods). For compactness in the definitions, we introduce the notation ? for a "null qualification" and identify ?:C with C. The metavariable P ranges over types (T) and ? . We write A class declaration L includes declarations of its simple name C, superclass T, fields T f, constructor K, inner classes L, and methods M. There are two kinds of constructor declaration, depending on whether the superclass is inner or top-level: when the superclass is inner, the subclass constructor must call the super constructor with a qualification "f." to provide the enclosing instance visible from the superclass's methods. As we will see in typing rules, constructor arguments should be arranged in the following order: (1) the superclass's fields, initialized by super(f) (or f.super(f)); (2) the enclosing instance of the superclass (if needed); and (3) the fields of the class to be defined, initialized by this.f=f. Like FJ, the body of a method just returns an expression, which is a variable, field access, method invocation, or object instantiation. We assume that the set of variables includes the special variables this and C.this for every C, and that these variables are never used as the names of arguments to methods. A program is a pair of a class table CT (a mapping from types T to class declarations L) and an expression e. Object is treated specially in every FJI program: the definition of the Object class does not appear in the class table and the auxiliary functions that look up fields and method declarations in the class table are equipped with special cases for Object that return the empty sequence of fields and the empty set of methods. To lighten the notation in what follows, we assume a fixed class table CT . From the class table, we can read off the subtype relation between classes. We write subtype of T-the reflexive and transitive closure of the immediate subclass relation given by the extends clauses in CT . This relation is defined formally at the bottom left of Figure 2. We impose the following sanity conditions on the class table: (1) CT class C . for every has an inner class declaration L of name D, then CT Object 62 dom(CT ). (4) For every type T (except Object) appearing anywhere in CT , we have T 2 dom(CT ). (5) For every e 0 .new!T? C(e) (and new C(e), resp.) appearing anywhere in CT , we have T.C 2 dom(CT ) (and C 2 dom(CT ), resp. (6) There are no cycles in the subtyping relation. (7) T 6! : T.U, for any two types T and T.U. By conditions (1) and (2), a class table of FJI can be identified with a set of top-level classes. Condition (7) prohibits a class from extending one of its inner classes. Syntax: class C extends T -T f; K L M- e ::= x new C(e) Computation: new C(e).f i \Gamma! e i cn new C(e) new C(e).m(d) \Gamma! ae x 7! d; this 7! cn ; i21:::n oe cn \Gamma! ae x 7! d; this 7! cn ; i21:::n oe Subtyping: class C extends T - Expression typing: (IT-Field) Method typing: i21:::n class Cn extends S - if mtype(m; (IT-Method) Class typing: M OK in P.C L OK in P.C class C extends D -T f; K L M- OK IN P M OK in P.C L OK in P.C class C extends T.D -T f; K L M- OK IN P Figure 2: FJI: Main Definitions Field lookup: class C extends D -T f; K L M- class C extends U.D -T f; K L M- class C extends S -S f; K L M- class C extends S -S f; K L M- m is not defined in M Method body lookup: class C extends S -S f; K L M- class C extends S -S f; K L M- m is not defined in M Enclosing instance lookup: encl T.C class C extends D -S f; .- encl T (new C(d, (new class C extends U.D -S f; .- encl T (new C(d, d 0 , e)) class C extends D -S f; .- encl T (new class C extends U.D -S f; .- encl T Figure 3: FJI: Auxiliary definitions 3.4 Auxiliary Functions For the typing and reduction rules, we need a few auxiliary definitions, given in Figure 3. The fields of a class T, written fields(T), is a sequence T f pairing the class of each field with its name, for all the fields declared in class T and all of its superclasses. In addition, fields(T) collects the types of (direct) enclosing instances of all the superclasses of T. For example, fields(C1.C2.C3) returns the following sequence: Object a3, (the field from A1.A2.A3) (enclosing instance bound A2.this) Object b3, (the field from B1.B2.B3) (enclosing instance bound to B2.this) Object c3 (the field from C1.C2.C3) The third rule in the definition inserts enclosing instance information between the fields S g of the superclass U.D and the fields T f of the current class. In a well-typed program, fields(T) will always agree with the constructor argument list of T. The type of the method m in class T, written mtype(m; T), is a pair, written S!S, of a sequence of argument types S and a result type S. Similarly, the body of the method m in class T, written mbody(m; T), is a triple, written (x; e; T), of a sequence of parameters x, an expression e, and a class T where the method is defined. The function encl T plays a crucial role in the semantics of FJI. Intuitively, when e is a top-level or inner class instantiation, encl T returns the direct enclosing instance of e that is visible from class T (i.e., the enclosing instance that provides the correct lexical environment for methods inherited from T). The first rule is the simplest case: since the type of an expression e 0 .new!T? C(e) agrees with the subscript T.C, it just returns the (direct) enclosing instance e 0 . The other rules follow a common pattern; we explain the fifth rule as a representative. Since the subscripted type T is different from the type of the argument the enclosing instance e 0 is not the correct answer. We therefore make a recursive call with an object d 0 .new!U? D(d) of the superclass obtained by dropping e 0 and as many arguments e as the fields f of the class S.C. We keep going like this until, finally, the argument becomes an instance of T and we match the first rule. For example: encl A1.A2.A3 (e.new!C1.C2? C3(a, new A1().new!A1? A2(), b, new B1().new!B1? B2(), c)) (new B1().new!B1? B2.new!B1.B2? B3(a, new A1().new!A1? A2(), b)) (new A1().new!A1? A2().new!A1.A2? A3(a)) new A1().new!A1? A2() Note that the encl function outputs only the direct enclosing instance. To obtain outer enclosing instances, such as A1.this, encl can be used repeatedly: encl A1.A2 (encl A1.A2.A3 (e)). Computation As in FJ, the reduction relation of FJI has the form e \Gamma! e 0 . We write \Gamma! for the reflexive and transitive closure of \Gamma!. The reduction rules are given in the middle of the left column of Figure 2. There are four reduction rules, two for field access and two for method invocation. The field access expression new C(e).f i looks up the field names f of C using fields(C) and yields the constructor argument e i in the position corresponding to f i in the field list; e.new!T? C(e).f i behaves similarly. The method invocation expression new C(e).m(d) first calls mbody(m; C) to obtain a triple of the sequence of formal arguments x, the method body e, and the class C 1 . \Delta \Delta \Delta .Cn where m is defined; it yields a substitution instance of the method body in which the x are replaced with the actual arguments d, the special variables this and Cn.this with the receiver object new C(e), and each C i .this (for n) with the corresponding enclosing instance c i , obtained from encl . Since the method to be invoked is defined in C 1 . \Delta \Delta \Delta .Cn , the direct enclosing instance .this is obtained by encl C 1 .\Delta\Delta\Delta.C n (e), where e is the receiver object; similarly, Cn\Gamma2 .this is obtained by encl C1 .\Delta\Delta\Delta.C (encl C1 .\Delta\Delta\Delta.C n (e)), and so on. The reduction rules may be applied at any point in an expression, so we also need the obvious congruence rules (if e \Gamma! e .f, and the like), which we omit here. For example, if the class table includes Outer, RefinedInner, Pair, A, and B, then new RefinedInner(new Outer(new Pair(new A(), new B())), new Object()).snd-p() reduces to new B() as follows, new RefinedInner(new Outer(new Pair(new A(), new B())), new Object()).snd-p() \Gamma! new Outer(new Pair(new A(), new B())).p.snd \Gamma! new Pair(new A(), new B()).snd \Gamma! new B() where the underlined subexpressions are the redices at each reduction step. 3.6 Typing Rules The typing rules for expressions, method declarations, and class declarations are given in the right-hand column of Figure 2. An environment \Gamma is a finite mapping from variables to types, written x:T. The typing judgment for expressions has the form \Gamma ' e 2 T, read "in the environment \Gamma, expression e has type T." The typing rules are syntax directed, with one rule for each form of expression. The typing rules for object instantiations and method invocations check that each actual parameter has a type which is a subtype of the corresponding formal parameter type obtained by fields or mtype; the enclosing object must have a type which is a subtype of the annotated type T in new !T?. The typing judgment for method declarations has the form M OK IN C 1 . \Delta \Delta \Delta .Cn , read "method declaration M is ok if it is declared in class C 1 . \Delta \Delta \Delta .Cn ." The body of the method is typed under the context in which the formal parameters of the method have their declared types and each C i .this has the type C 1 . \Delta \Delta \Delta .C i . If a method with the same name is declared in the superclass then it must have the same type in the subclass. The typing judgment for class declarations has the form L OK IN P, read "class declaration L is ok if it is declared in P." If P is a type T, the class declaration L is an inner class; otherwise, L is a top-level class. The typing rules check that the constructor applies super to the fields of the superclass and initializes the fields declared in this class, and that each method declaration and inner class declaration in the class is ok. The condition C 62 P ensures that the (simple) class name to be defined is not also a simple name of one of the enclosing classes, so as to avoid ambiguity of the meaning of C.this. 3.7 Properties It is easy to show that FJI programs enjoy standard subject reduction and progress properties, which together guarantee that well-typed programs never cause NoSuchFieldError or NoSuchMethodError. 3.7.1 Theorem [Subject Reduction]: If \Gamma ' e 2 T and e \Gamma! e 0 such that Proof sketch: The main property required in the proof is the following term-substitution lemma: If This is proved by induction on the derivation of \Gamma; plus the following lemma: such that Similarly for e 0 The theorem itself is now proved by induction on the derivation of e \Gamma! e 0 , with a case analysis on the last rule used. The cases for IR-InvkT and IR-InvkI are easy using the lemmas above. The other base cases are also straightforward, as are the induction steps. \Xi 3.7.2 Theorem [Progress]: Suppose e is a well-typed expression. (1) If e includes new C 0 (e).f as a subexpression, then fields(C 0 Similarly, if e includes (2) If e includes new C 0 (e).m(d) as a subexpression, then mbody(m; C Similarly, if e includes e 0 and Translation Semantics In this section we consider the other style of semantics: translation from FJI to FJ. Every inner class is compiled to a top-level class with one additional field holding a reference to the direct enclosing in- stance; occurrences of qualified this are translated into accesses to this field. For example, the Outer and RefinedInner classes in the previous section are compiled to the following three FJ classes. class Outer extends Object - Pair Outer$Inner make-inner () - return new Outer$Inner(this); - class Outer$Inner extends Object - Outer Outer$Inner(Outer this$Outer$Inner) - Object snd-p - return this.this$Outer$Inner.p.snd; - class RefinedInner extends Outer$Inner - Object c; RefinedInner(Outer this$Outer$Inner, Object c) - The inner class Outer.Inner is compiled to the top-level class Outer$Inner; the field this$Outer$Inner holds an Outer object, which corresponds to the direct enclosing instance Outer.this in the original FJI program; thus, Outer.this is compiled to the field access expression this.this$Outer$Inner. We give a compilation function j \Delta j for each syntactic category. Except for types, the compilation functions take as their second argument the FJI class name (or, ?) where the entity being translated is defined, written (or 4.1 Types, Expressions and Methods Every qualified class name is translated to a simple name obtained by syntactic replacement of . with $. The compilation of expressions, written jej T , is given below. We write jej T as shorthand for je (and similarly for and jnew D(e)j T new D( jej T new jT.Dj ( jej T As we saw above, a compiled inner class has one additional field, called this$ jTj, where T is the original class name. C i .this in the class C 1 . \Delta \Delta \Delta .Cn becomes an expression that follows references to the direct enclosing instance in sequence until it reaches the correct one. An enclosing instance e 0 of e 0 .new!T? C(e) will become the last argument of the compiled constructor invocation. Compilation of methods, written jMj T , is straightforward. stands for jT 1 4.2 Constructors and Classes Compilation of constructors, written jKj T , is given below. It has four cases, depending on whether the current class is a top-level class or an inner class and whether its superclass is a top-level class or an inner class. When the current class is an inner class, one more argument corresponding to the enclosing instance is added to the argument list; the name of the constructor becomes jT.Cj, the translation of the qualified name of the class. When the superclass is inner, the argument used for the qualification of f.super(f) becomes the last argument of the super() invocation. Finally, the compilation of classes, written jLj P , is as follows: class C extends S -T f; K L M- class C extends jSj - class C extends S -T f; K L M- class jT.Cj extends jSj - The constructor, inner classes, and methods of class C defined in P are compiled with auxiliary argument P.C. Inner classes L become top-level classes. As in constructor compilation, when the compiled class is inner, its name changes to jT.Cj and the field this$ jT.Cj, holding an enclosing instance, is added. The compilation of the class table, written jCT j, is achieved by compiling all top-level classes L in CT (i.e., 4.3 Properties of Translation Semantics It is easy to show that the translation semantics preserves typing, in the sense that a well-typed FJI program is compiled to a well-typed FJ program. 4.3.1 Theorem [Compilation preserves typing]: If CT is ok and with respect to CT , with respect to jCT j and jCT j is ok. Finally, we come to the main result of this section: the correspondence of the direct semantics presented in the previous section and the translation semantics defined here. We show that the behavior of a compiled program exactly reflects the behavior of the original program in FJI: for every step of reduction of an well-typed FJI program, the compiled program takes one or more steps and reaches a corresponding state. 4.3.2 Theorem [Compilation commutes with reduction]: If \Gamma ' FJI e 2 T and e\Gamma! FJI e \Gamma! FJ Proof straightforward induction on the derivation of e \Gamma! FJI e 0 with a case analysis on the last rule used. The main lemma for the cases IR-InvkT and IR-InvkI is: Suppose 2. If we have jnew C(e)j ? (new C(e))j ? Similarly, if This lemma shows that the calculation of encl T (e) is correctly mimicked by field access to the mangled fields in the translation. Since method invocation in the direct semantics may involve calculation of encl (\Delta \Delta \Delta) several times, the low-level reduction may require more than one step to mimic one step at the FJI level. \Xi 5 Conclusions and Future Work We have formalized two styles of semantics for inner classes: a direct style and a translation style, where semantics is given by compilation to a low-level language without inner classes, following Java's Inner Classes Specification. We have proved that the two styles correspond, in the sense that the translation commutes with the high-level reduction relation in the direct semantics. Besides deepening our own understanding of inner classes, this work has uncovered several bugs in various Java compilers. For future work, the interaction between inner classes and access restrictions in Java is clearly worth investigating. We also hope to be able to model Java's other forms of inner classes: anonymous classes and local classes, which can be declared in method bodies; these are slightly more complicated, since method arguments (not just fields) can occur in them as free variables, but we expect they can be captured by a variant of FJI. Acknowledgments This work was supported by the University of Pennsylvania and the National Science Foundation under grant CCR-9701826, Principled Foundations for Programming with Objects. Igarashi is a research fellow of the Japan Society of the Promotion of Science. We would like to thank bug parade in Java Developer Connection (http://developer.java.sun.com/developer/bugParade/index.html) for providing useful information. --R A secure implementation of java inner classes. Making the future safe for the past: Adding genericity to the Java programming language. Featherweight Java: A minimal core calculus for Java and GJ. On inner classes. Birger M-ller-Pedersen --TR Smalltalk-80: the language and its implementation Virtual classes: a powerful mechanism in object-oriented programming Java<i><sub>light</sub></i> is type-safeMYAMPERSANDmdash;definitely Classes and mixins Making the future safe for the past Is the Java type system sound? Semantic analysis of virtual classes and tested classes Featherwieght Java The C++ Programming Language, Third Edition The Java Language Specification A Statically Safe Alternative to Virtual Types Protection in Programming-Language Translations --CTR Nathaniel Nystrom , Stephen Chong , Andrew C. Myers, Scalable extensibility via nested inheritance, ACM SIGPLAN Notices, v.39 n.10, October 2004 D. Ancona , C. Anderson , F. Damiani , S. Drossopoulou , P. Giannini , E. Zucca, A provenly correct translation of Fickle into Java, ACM Transactions on Programming Languages and Systems (TOPLAS), v.29 n.2, p.13-es, April 2007 Christopher League , Zhong Shao , Valery Trifonov, Type-preserving compilation of Featherweight Java, ACM Transactions on Programming Languages and Systems (TOPLAS), v.24 n.2, p.112-152, March 2002 Radha Jagadeesan , Alan Jeffrey , James Riely, Typed parametric polymorphism for aspects, Science of Computer Programming, v.63 n.3, p.267-296, 15 December 2006
language design;inner classes;language semantics
603795
Generating functions for generating trees.
Certain families of combinatorial objects admit recursive descriptions in terms of generating trees: each node of the tree corresponds to an object, and the branch leading to the node encodes the choices made in the construction of the object. Generating trees lead to a fast computation of enumeration sequences (sometimes, to explicit formulae as well) and provide efficient random generation algorithms. We investigate the links between the structural properties of the rewriting rules defining such trees and the rationality, algebraicity, or transcendence of the corresponding generating function.
Introduction Only the simplest combinatorial structures - like binary strings, permutations, or pure involutions (i.e., involutions with no fixed point) - admit product decompositions. In that case, the set\Omega n of objects of size n is isomorphic to a product Two properties result from such a strong decomposability property: (i) enumeration is easy, since the cardinality of\Omega n is e 1 random generation is efficient since it reduces to a sequence of random independent draws from intervals. A simple infinite tree, called a uniform generating tree is determined by the e i : the root has degree e 1 , each of its e 1 descendents has degree e 2 , and so on. This tree describes the sequence of all possible choices and the objects of size n are then in natural correspondence with the branches of length n, or equivalently with the nodes of generation n in the tree. The generating tree is thus fully described by its root degree (e 1 ) and by rewriting rules, here of the special form, where the power notation is used to express repetitions. For instance binary strings, permu- tations, and pure involutions are determined by Corresponding author. A powerful generalization of this idea consists in considering unconstrained generating trees where any set of rules is allowed. Here, the axiom specifies the degree of the root, while the productions e i;k list the degrees of the k descendents of a node labeled k. Following Barcucci, Del Lungo, Pergola and Pinzani, we call \Sigma an ECO-system (ECO stands for "Enumerating Combinatorial Objects"). Obviously, much more leeway is available and there is hope to describe a much wider class of structures than those corresponding to product forms and uniform generating trees. The idea of generating trees has surfaced occasionally in the literature. West introduced it in the context of enumeration of permutations with forbidden subsequences [27, 28]; this idea has been further exploited in closely related problems [6, 5, 12, 13]. A major contribution in this area is due to Barcucci, Del Lungo, Pergola, and Pinzani [4, 3] who showed that a fairly large number of classical combinatorial structures can be described by generating trees. A form equivalent to generating trees is well worth noting at this stage. Consider the walks on the integer half-line that start at point (s 0 ) and such that the only allowable transitions are those specified by \Sigma (the steps corresponding to transitions with multiplicities being labeled). Then, the walks of length n are in bijective correspondence with the nodes of generation n in the tree. These walks are constrained by the consistency requirement of trees, namely, that the number of outgoing edges from point k on the half-line has to be exactly k. Example 1. 123-avoiding permutations The method of "local expansion" sometimes gives good results in the enumeration of permutations avoiding specified patterns. Consider for example the set S n (123) of permutations of length n that avoid the pattern 123: there exist no integers k such that oe(k). For instance, belongs to S 4 (123) but does not, as Observe that if - 2 S n+1 (123), then the permutation oe obtained by erasing the entry n+ 1 from - belongs to S n (123). Conversely, for every oe 2 S n (123), insert the value n+ 1 in each place that gives an element of S n+1 (123) (this is the local expansion). For example, the permutation by insertion of 4 in first, second and third place respectively. The permutation 2134, resulting from the insertion of 4 in the last place, does not belong to S 4 (123). This process can be described by a tree whose nodes are the permutations avoiding 123: the root is 1, and the children of any node oe are the permutations derived as above. Figure 1(a) presents the first four levels of this tree. Let us now label the nodes by their number of children: we obtain the tree of Figure 1(b). It can be proved that the k children of any node labeled k are labeled respectively k (see [27]). Thus the tree we have constructed is the generating tree obtained from the following rewriting rules: The interpretation of this system in terms of paths implies that 123-avoiding permutations are equinumerous with "walks with returns" on the half-line, themselves isomorphic to / Lukasiewicz codes of plane trees (see, e.g., [26, p. 31-35]). We thus recover a classic result [18]: 123-avoiding permutations are counted by Catalan numbers; more precisely, (a) (b) Figure 1: The generating tree of 123-avoiding permutations. (a) Nodes labeled by the per- mutations. (b) Nodes labeled by the numbers of children. We shall see below that (certain) generating trees correspond to enumeration sequences of relatively low computational complexity and provide fast random generation algorithms. Hence, there is an obvious interest in delineating as precisely as possible which combinatorial classes admit a generating tree specification. Generating functions condense structural information in a simple analytic entity. We can thus wonder what kind of generating function can be obtained through generating trees. More precisely, we study in this paper the connections between the structural properties of the rewriting rules and the algebraic properties of the corresponding generating function. We shall prove several conjectures that were presented to us by Pinzani and his coauthors in March 1998. Our main results can be roughly described as follows. Rational systems. Systems satisfying strong regularity conditions lead to rational generating functions (Section 2). This covers systems that have a finite number of allowed degrees, as well as systems like (2:a), (2:b), (2:c) and (2:d) below where the labels are constant except for a fixed number of labels that depend linearly and uniformly on k. Algebraic systems. Systems of a factorial form, i.e., where a finite modification of the set is reachable from k, lead to algebraic generating functions (Section 3). This includes in particular cases (2:f) and (2:g). Transcendental systems. One possible reason for a system to give a transcendental series is the fact that its coefficients grow too fast, so that its radius of convergence is zero. This is the case for System (2:h) below. Transcendental generating functions are also associated with systems that are too "irregular". An example is System (2:e). We shall also discuss the holonomy of transcendental systems (Section 4). Example 2. A zoo of rewriting systems Here is a list of examples recurring throughout this paper. (In (2:e), we make use of Iverson's brackets: [P Notations. From now on, we adopt functional notations for rewriting rules: systems will be of the form where s 0 is a constant and each e i is a function of k. Moreover, we assume that all the values appearing in the generating tree are positive: each node has at least one descendent. In the generating tree, let f n be the number of nodes at level n and s n the sum of the labels of these nodes. By convention, the root is at level 0, so that f In terms of walks, f n is the number of walks of length n. The generating function associated with the system is Remark that s and that the sequence (f n ) n is nondecreasing. Now let f n;k be the number of nodes at level n having label k (or the number of walks of length n ending at position k). The following generating functions will be also of interest: We have F (z). Furthermore, the F k 's satisfy the relation denotes the number of one-step transitions from j to k. This is equivalent to the following recurrence for the numbers f n;k , that results from tracing all the paths that lead to k in n Counting and random generation. The recurrence (3) gives rise to an algorithm that computes the successive rows of the matrix (f n;k ) by "forward propagation": to compute the (n propagate the contribution f n;j to f n+1;e i (j) for all pairs (i; j) such that j. Assume the system is linearly bounded : this means that the labels of the nodes that can be reached in m steps are bounded by a linear function of m. (All the systems given in Example 2, except for (2:b), are linearly bounded; more generally, systems where forward jumps are bounded by a constant are linearly bounded.) Clearly, the forward propagation algorithm provides a counting algorithm of arithmetic complexity that is at most cubic. For a linearly bounded system, uniform random generation can also be achieved in polynomial time, as shown in [2]. We present here the general principle. Let g n;k be the number of walks of length n that start from label k. These numbers are determined by the recurrence g that traces all the possible continuations of a path given its initial step. Obviously, f the axiom of the system. As above, the g n;k can be determined in time O(n 3 ) and O(n 2 ) storage. random generation is then achieved as follows: In order to generate a walk of length n starting from state k, pick up a transition i with probability g n\Gamma1;e i (k) =g n;k , and generate recursively a walk of length starting from state e i (k). The cost of a single random generation is then O(n 2 ) if a sequential search is used over the O(n) possibilities of each of the n random drawings; the time complexity goes down to O(n log n) if binary search is used, but at the expense of an increase in storage complexity of O(n 3 ) (arising from O(n 2 ) arrays of size O(n) that binary search requires). Rational systems We give in this section three main criteria (and a variation on one of them) implying that the generating function of a given ECO-system is rational. Our first and simplest criterion applies to systems in which the functions e i are uniformly bounded. Proposition 1 If finitely many labels appear in the tree, then F (z) is rational. Proof. Only a finite number of F k 's are nonzero, and they are related by linear equations like Equation (2) above. Example 3. The Fibonacci numbers The system [(1); can be also written as (1)(2)g]. Hence the only labels that occur in the tree are 1 and 2. Eq. (2) gives F 1 Finally, the well-known Fibonacci generating function. 2 None of the systems of Example 2 satisfy the assumptions of Proposition 1. However, the following criterion can be applied to systems (2:a) and (2:b). Proposition 2 Let oe is an affine function of k, say fi, then the series F (z) is rational. More precisely: Proof. Let denote the labels of the f n nodes at level n. Then We know that f . The result follows. Example 4. Bisection of Fibonacci sequence The system [(2); \Delta, the generating function for Fibonacci numbers of even index. (Changing the axiom to leads to the other half of the Fibonacci sequence.) Some other systems, like lead to the same function F (z) since 2. However, the generating trees are different, as are the bivariate functions F (z; u). 2 Example 5. Prime numbers and rational generating functions Amazingly, it is possible to construct a generating tree whose set of labels is the set of prime numbers but that has a rational generating function F (z). This is a bit unexpected, as prime numbers are usually thought "too irregular" to be associated with rational generating functions. For n - 1, let p n denote the nth prime; hence (p Assume for the moment that the Goldbach conjecture is true: every even number larger than 3 is the sum of two primes. Remember that, according to Bertrand's postulate, for all n (see, e.g., [23, p. 140]). For the number 2p is an even number larger than 3. Let q n and r n be two primes such that 2p In particular, q 2. Consider the system It satisfies the criterion of Proposition 2, with 3. Hence, the generating function of the associated generating tree is Consequently, the number of nodes at level n is simply f )=2. This can be checked on the first few levels of the tree drawn in Figure 2. Now, one can object that the Goldbach conjecture is not proved; however, it is known that every even number is the sum of at most six primes [22], and a similar example can be constructed using this result. Figure 2: A generating tree with prime labels and rational generating function. Proposition 2 can be adapted to apply to systems that "almost" satisfy the criterion of Proposition 2, like System (2:c) or (2:d). Let us consider a system of the form Assume, moreover, that: (i) the corresponding functions oe 0 and oe 1 are affine and have the same leading coefficient ff, say oe exactly m odd labels occur in the right-hand side of each rule, for some m - 0. Proposition 3 If a system satisfies properties (i) and (ii) above, then Of course, if fi we recover the generating function of Proposition 2. Proof. The proof is similar to that of Proposition 2. The only new ingredient is the fact that, for n - 1, the number of nodes of odd label at level n is mf System (2:c) satisfies properties (i) and (ii) above with 5. Consequently, its generating function is F . System (2:d), although very close to (2:c), does not satisfy property (ii) above, so that Proposition 3 does not apply. However, another minor variation on the argument of Proposition 2, based on the fact that the number o n of odd labels at level n satisfies proves the rationality of F (z). Alternatively, rationality follows from the last criterion of this section, which is of a different nature. We consider systems [(s 0 that can be written as am and the functions c i are uniformly bounded. Let (k)g. Proposition 4 Consider the system (4), and let - all the series are rational, then so is the series F (z). Proof. We form an infinite system of equations defining the series F k (z) by writing Eq. (2) for all k - 1. In particular, for k ? C, we obtain with F j This part of the system is easy to solve in terms of F Indeed, for k 2 Z: where the P i;k are polynomials in z defined by the following recurrence: for all z Using (5), we find According to (6), for all i - C, the series is a rational function of z and t, of rational in z. Hence, to prove the rationality of F (z), it suffices to prove the rationality of the F i (z), for i - C. Let us go back to the C first equations of our system; using (5), we find, for k - C: Again, is a rational function of z and t (the Hadamard product of two rational series is rational). Thus the series F k (z), for k - C, satisfy a linear system with rational coefficients: they are rational themselves, as well as F (z). Examples (2:a), (2:c), (2:d) and (2:e) have the form (4). The above proposition implies that the first three have a rational generating function. System (2:e) will be discussed in Section 4, and proved to have a transcendental generating function. 3 Factorial walks and algebraic systems In this section, we consider systems that are of a factorial form. By this, we mean informally that the set of successors of (k) is a finite modification of the integer interval As was detailed in the introduction, ECO-systems can be rephrased in terms of walks over the integer half-line. We thus consider the problem of enumerating walks over the integer half-line such that the set of allowed moves from point k is a finite modification of the integer interval [0; k]. We shall mostly study modifications around the point k (although some examples where the interval is modified around 0 as well are given at the end of the section). Precisely, a factorial walk is defined by a finite (multi)set A ae Z and a finite set specifying respectively the allowed supplementary jumps (possibly labeled) and the forbidden backward jumps. In other words, the possible moves from k are given by the rule: Observe that these walk models are not necessarily ECO-systems, first because we allow labels to be zero - but a simple translation can take us back to a model with positive labels - and second because we do not require (k) to have exactly k successors. We say that an ECO-system is factorial if a shift of indices transforms it into a factorial walk. Hence the rules of a factorial ECO-system are of the form that is, The generating function F (z) for such an ECO-system, taken with axiom generating function for the walk model (7), taken with axiom remember that the rewriting rules defining a generating tree have to obey the additional condition that a node labeled k has exactly k successors. Taking in (8), this implies that Taking implies that r so that finally strictly speaking, either one has a "fake" factorial ECO-system (that is some of its initial rules are not of the factorial type), either one has a "real" factorial ECO-system and then it is given by rules of the form where A is a multiset of integers of cardinality r. For instance, Systems (2:f) and (2:g) are factorial. We shall prove that all factorial walks have an algebraic generating function. The result naturally applies to factorial ECO-systems. We consider again the generating function F (z; is the number of walks of length n ending at point k. We also denote by F k (z) the coefficient of k in this series, and by f n (u) the coefficient of z n . The first ingredient of the proof is a linear operator M , acting on formal power series in u, that encodes the possible moves. More precisely, for all n - 0, we will have: The operator M is constructed step by step as follows. - The set of moves from k to all the positions 0; described by the operator L 0 that maps u k to u As L 0 is a linear operator, we have, for any series g(u): - The fact that transitions near k are modified, with those of type k allowed and those of type expressed by a Laurent polynomial a The degree of P is a := maxA, the largest forward jump and b := max(0; \GammaB; \GammaA) is largest forbidden backward jump or the largest supplementary backward jumps (we if the set B is empty). The operator describes the extension of a walk by one step. - Finally, the operator M is given by where fu !0 gh(u) is the sum of all the monomials in h(u) having a negative exponent. Hence M is nothing but L stripped of the negative exponent monomials, which correspond to walks ending on the nonpositive half-line. Observe that, for any series g(u), the only part of L[g](u) that is likely to contain monomials with negative exponents is Consequently, and if Assume for simplicity that the initial point of the walk is 0; other cases follow the same argument. The linear relation f n+1 Thanks to (9), we can write where r k (u) is a Laurent polynomials (defined by Equation whose exponents belong to satisfies the following functional equation: F (z; u) z Let us take an example. The moves lead to so that the functional equation defining F (z; u) is F (z; u) The second ingredient of the proof, sometimes called the kernel method , seems to belong to the "mathematical folklore" since the 1970's. It has been used in various combinatorial problems [10, 18, 20] and in probabilities [14]. See also [8, 9, 21] for more recent and systematic applications. This method consists in cancelling the left-hand side of the fundamental functional equation (10) by coupling z and u, so that the coefficient of the (unknown) quantity F (z; u) is zero. This constraint defines u as one of the branches of an algebraic function of z. Each branch that can be substituted analytically into the functional equation yields a linear relation between the unknown series F (z; 1) and F k (z), b. If enough branches can be substituted analytically, we obtain a system of linear equations, whose solution gives F (z; 1) and the F k (z) as algebraic functions. From there, an expression for F (z; u) also results in the form of a bivariate algebraic function. Let us multiply Eq. (10) by u b (1 \Gamma u) to obtain an equation with polynomial coefficients (remind that we take if the set B of forbidden backward steps is empty). The new equation reads K(z; u)F (z; is the kernel of the equation: This polynomial has degree a u, and hence, admits a are algebraic functions of z. The classical theory of algebraic functions and the Newton polygon construction enable us to expand the solutions near any point as Puiseux series (that is, series involving fractional exponents; see [11]). The a expanded around 0, can be classified as follows: - the "unit" branch, denoted by u 0 , is a power series in z with constant term branches, denoted by u are power series in z 1=b whose first nonzero term is iz 1=b , with - a "large" branches, denoted by v a , are Laurent series in z 1=a whose first nonzero term is iz \Gamma1=a , with i a In particular, all the roots are distinct. (It is not difficult to check "by hand" the existence of these solutions: for instance, plugging confirms the existence of the b small branches.) Note that there are exactly b branches: the unit branch u 0 and the b small branches As F (z; u) is a series in z with polynomial coefficients in u, these b having no negative exponents, can be substituted for u in F (z; u). More specifically, let us replace u by u i in (10): the right-hand side of the equation vanishes, giving a linear equation relating the b b. Hence the b branches give a set of b relating the series. One could solve directly this system, but the following argument is more elegant. The right-hand side of (10), once multiplied by u By construction, it is a polynomial in u of degree b leading coefficient \Gamma1. Hence, it admits which depend on z. Replacing u by the series u in Eq. (10) shows that these series are exactly the b roots of R, so that Y Let p a := [u a ]P (u) be the multiplicity of the largest forward jump. Then the coefficient of u a+b+1 in K(z; u) is p a z, and we can write Y a Y Finally, as K(z; u)F (z; a z We have thus proved the following result. Proposition 5 The generating function F (z; u) for factorial walks defined by (7) and starting from 0 is algebraic; it is given by (12), where u a ) are the finite (resp. infinite) solutions at of the equation K(z; and the kernel K is defined by (11). In particular, the generating function for all walks, irrespective of their endpoint, is z Y and the generating function for excursions, i.e., walks ending at 0, is, for b ! 0: z Y (for the relation becomes F (z; These results could be derived by a detour via multivariate linear recurrences, and the present treatment is closely related to [9, 21]; however, our results were obtained independently in March 1998 [1]. The asymptotic behaviour of the number of n-step walks can be established via singularity analysis or saddle point methods. The series u i have "in general" a square root singularity, yielding an asymptotic behaviour of the form A- n n \Gamma3=2 : We plan to develop this study in a forthcoming paper. Example 6. Catalan numbers This is the simplest factorial walk, which corresponds to the ECO-system (2:f ). The operator M is given by The kernel is K(z; 2z , so that z the generating function of the Catalan numbers (sequence M1459 1 ). This result could be expected, given the obvious relation between these walks and / Lukasiewicz codes. 2 Example 7. Motzkin numbers This example, due to Pinzani and his co-authors, is derived from the previous one by forbidding "forward" jumps of length zero. The rule is then The operator M is The kernel is K(z; leading to the generating function for Motzkin numbers (sequence M1184). 2 Example 8. Schr-oder numbers This example is also due to the Florentine group. The rule is From Proposition 5, we derive The coefficients are the Schr-oder numbers (M2898: Schr-oder's second problem). We give in Table 1 at the end of the paper a generalization of Catalan and Schr-oder numbers, corresponding to the rule . This generalized rule has recently been shown to describe a set of permutations avoiding certain patterns [19]. 2 1 The numbers Mxxxx are identifiers of the sequences in The Encyclopedia of Integer Sequences [24]. The above examples were all quadratic. However, it is clear from our treatment that algebraic functions of arbitrary degree can be obtained: it suffices that the set of "exceptions" around k have a span greater than 1. Let us start with a family of ECO-systems where supplementary forward jumps of length larger than one are allowed. Example 9. Ternary trees, dissections of a polygon, and m-ary trees The ECO-system with axiom is equivalent to the walk The kernel is K(z; and the generating function 3n z counts ternary trees (M2926). More generally, the system with axiom (m) and rewriting rules yields the m-Catalan numbers, 1), that count m-ary trees. The kernel and the generating function F (z; 1) satisfies F (z; In particular, the 4-Catalan numbers in [24] (sequence M3587) and count dissections of a polygon.In the above examples, all backward jumps are allowed. In other words, each of these examples corresponds to an ECO-system. Let us now give an example where backward jumps of length 1 are forbidden. Example 10. Consider the following modification of the Motzkin rule: The kernel is now K(z; according to (12), the series F infinite at we find that the algebraic equation defining G is: So far, we have only dealt with walks for which the set of allowed moves was obtained by modifying the interval [0; k] around k. One can also modify this interval around 0: we shall see - in examples - that the generating function remains algebraic. However, it is interesting to note that in these examples, the kernel method does not immediately provide enough equations between the "unknown functions" to solve the functional equation. Let us first explain how we modify the interval [0; k] around 0. The walks we wish to count are still specified by a multiset A of allowed supplementary jumps and a set B of forbidden backward jumps. But, in addition, we forbid backward jumps to end up in C, where C is a given finite subset of N . In other words, the possible moves from k are given by the rule Again, we can write a functional equation defining F (z; u): where, as above, the new terms in the equations being G F fi+fl (z): Observe that the first three terms are the same as in the case ;. The equation, once multiplied by u by (11) and The kernel is not modified by the introduction of C. As above, it has degree a+b+1 in u, and admits roots unknown functions, namely F (z; 1), the F k (z), and the G fl (z), fl 2 C. The degree of R in u is no longer roots of K that can be substituted for u in Eq. (13) provide b equations between the b unknown functions. Additional equations will be obtained by extracting the coefficient of u j from Eq. (13), for some values of j. In general, we have: It is possible to construct a finite subset S ae N such that the combination of the b equations obtained via the kernel method and the equations (14) written for j 2 S determines all unknown functions as algebraic functions of z - more precisely, as rational functions of z and the roots u of the kernel. However, this is a long development, and these classes of walks play a marginal role in the context of ECO-systems. For these reasons, we shall merely give two examples. The details on the general procedure for constructing the set S can be found in [7]. Example 11. This example is obtained by modifying the Motzkin rule of Example 7 around the point 0. ;. The rewriting rule is The functional equation reads with G 1 (z). The kernel has a unique finite root at z = 0: whereas the right-hand side of Eq. (15) contains two unknown functions. Writing Eq. (14) These two equations allow us to express F 0 and F 1 , and hence G 1 , in terms of F (z; 1): This equation relates the two unknown functions of Eq. (15). We replace G 1 (z) by the above expression in (15), so that only one unknown function, namely F (z; 1), is left. The kernel method finally gives: Let us choose f2g. The rewriting rule is now: The functional equation reads F (z; u) with G 2 Only three roots, can be substituted for u in the kernel, while the right-hand side of the equation contains four unknown Writing (14) for The second equation is not of much use but, by combining the first and third one, we find Replacing F 0 (z) by this expression in (16) gives: We are left with three unknown functions, related by three linear equations obtained by cancelling the kernel. Solving these equations would give F (z; 1) as an enormous rational function of z, u in the u i . This implies that F (z; 1) can also be written as a rational function of z and v j v 1 , the fourth and last root of the kernel. In particular, F (z; 1) is algebraic of degree at most 4. In order to obtain directly an expression of F (z; 1) in terms of z and v, we can proceed as follows. Let R 0 (z; u) denote the right-hand side of Eq. (17). Then R 0 (z; u) is a polynomial in u of degree 5, and three of its roots are u Consequently, as a polynomial in u, the kernel K(z; u) divides Let us evaluate we obtain a polynomial of degree 3 in u, whose coefficients depend on z; v; F (z; 1); F 1 (z) and G 2 (z). This polynomial has to be zero: this gives a system of four (dependent) equations relating the three unknown functions F (z; 1); F 1 (z) and G 2 (z). Solving the first three of these equations yields Eliminating v between this expression and K(z; equation satisfied by F (z; 1). 2 4 Transcendental systems 4.1 Transcendence The radius of convergence of an algebraic series is always positive. Hence, one possible reason for a system to give a transcendental series is the fact that its coefficients grow too fast, so that its radius of convergence is zero. This is the case for System (2:h), as proved by the following proposition. Proposition 6 Let b be a nonnegative integer. For k - 1, let Assume that: 1: for all k, there exists a forward jump from k (i.e., e i 2: the sequence (m(k)) k is nondecreasing and tends to infinity. Then the (ordinary) generating function of the system has radius of convergence 0. Proof. Let s 0 be the axiom of the system. Let us denote by h n the product m(s us prove that the generating tree contains at least h n nodes at level 1). At level nb, take a node v labeled k, with nb. Such a node exists thanks to the first assumption. By definition of m(k), this node v has m(k) sons whose label is at least As m is non decreasing, v has at least m(s sons of label at least s Iterating this procedure shows that, at level nb+ i, at least m(s 0 descendents of v have a label larger than or equal to s 0 In particular, at level n(b + 1) at least h n descendents of v whose label is at least s 0 . Hence f n(b+1) - h n . But as h n =h goes to infinity with n, the series z n(b+1) has radius of convergence 0, and the same is true for F In particular, this proposition implies that the generating function of any ECO-system in which the length of backward jumps is bounded has radius of convergence 0. Many examples of this type will be given in the next subsection, in which we shall study whether the corresponding generating function is holonomic or not. The following example, in which backward jumps are not bounded, was suggested by Nantel Bergeron. Example 13. A fake factorial walk Consider the system with axiom (1) and rewriting rules applies with bk=2c. Note that the radius of convergence of F (z) is zero although all the functions e i are bounded, and indeed constant: e i The series F (z) is of course transcendental. Note, however, that F (z; u) satisfies a functional equation that is at first sight reminiscent of the equations studied in Section 3: :The following example shows that Proposition 6 is not far from optimal: an ECO-system in which all functions e i grow linearly can have a finite radius of convergence. Example 14. The system with axiom (1) and rules leads to a generating function with a positive radius of convergence. Let us start from the recursion defining the numbers f n;k . We have f The largest label occurring at level n in the tree is n + 1. Let us introduce the numbers n. The above recursion can be rewritten as: We have Hence Eq. (18) implies that for k - 0, the sequence (g n;k ) n is nondecreasing and reaches a constant value g(k) as soon as n - Going back to the number f n of nodes at level n, we have Table 1: The numbers f n;k and g n;k . Observe the convergence of the coefficients. z n and hence it suffices to prove that the generating function for the numbers g(k) has a finite radius of convergence, that is, that these numbers grow at most exponentially. Writing (18) for Iterating this formula for i between 1 and k yields This inequality, together with the fact that implies that for all k - 0, g(k) - e g(k), where the sequence e is defined by e But the series k e g(k)z k is rational, equal to (1 \Gamma z) 2 has a finite radius of convergence. Consequently, the numbers e g(k) and g(k) grow at most exponentially.Algebraic generating functions are strongly constrained in their algebraic structure (by a polynomial equation) as well as in their analytic structure (in terms of singularities and asymptotic behaviour). In particular, they have a finite number of singularities, which are algebraic numbers, and they admit local asymptotic expansions that involve only rational exponents. A contrario, a generating function that has infinitely many singularities (e.g., a natural boundary) or that involves a transcendental element (e.g., a logarithm) in a local asymptotic expansion is by necessity transcendental; see [16] for a discussion of such transcendence criteria. In the case of generating trees, this means that the presence of a condition involving a transcendental element is expected to lead to a transcendental generating function. This is the case in the following example. Example 15. A Fredholm system We examine System (2:e), in which the rules are irregular at powers of 2: 2: This example will involve the Fredholm series h(z) := , which is well-known to admit the unit circle as a natural boundary. (This can be seen by way of the functional equation from which there results that h(z) is infinite at all iterated square-roots of unity.) According to Eq. (2), we have, for k ? 3, F k so that 3: writing Eq. (2) for For Solving for F 2 (z) and F 3 (z), then summing The functions h(z) and F (z) are rationally related, so that F (z) is itself transcendental. The series h has radius 1, but the denominator of F vanishes before z reaches 1 - actually, before z reaches 1=2. Hence the radius of F is the smallest root of its denominator. Its value is easily determined numerically and found to be about 0.360102. 2 4.2 Holonomy In the transcendental case, one can also discuss the holonomic character of the generating function F (z). A series is said to be holonomic, or D-finite [25], if it satisfies a linear differential equation with polynomial coefficients in z. Equivalently, its coefficients f n satisfy a linear recurrence relation with polynomial coefficients in n. Consequently, given a sequence f n , the ordinary generating function z n is holonomic if and only if the exponential generating function holonomic. The set of holonomic series has nice closure properties: the sum or product of two of them is still holonomic, and the substitution of an algebraic series into an holonomic one gives an holonomic series. Holonomic series include algebraic series, and have a finite number of singularities. This implies that Example 15, for which F (z) has a natural boundary, is not holonomic. We study below five ECO-systems that, at first sight, do not look to be very different. In particular, for each of them, forward and backward jumps are bounded. Consequently, Proposition 6 implies that the corresponding ordinary generating function has radius of convergence zero. However, we shall see that the first three systems have an holonomic generating function, while the last two have not. We have no general criterion that would allow us to distinguish between systems leading to holonomic generating functions and those leading to nonholonomic generating functions. Among the systems with bounded jumps, those for which e i belongs to f\Gamma1; 0; 1g for all i - k have a nice property: the generating function for the corresponding excursions (walks starting and ending at level 0) can be written as the following continued fraction where the coefficients a k ; b k and c k are the multiplicities appearing in the rules, which read Example 16. Arrangements The system a sequence that starts with It is not hard to see that the triangular array f n;k+2 is given by the arrangement numbers k! so that the exponential generating function (EGF) of the sequence is e This system satisfies the conditions of Proposition 6 with Accordingly, one has f n - e n!, so that the ordinary generating function F (z) has radius of convergence 0 and cannot be algebraic. However, e is holonomic, and so is F (z). 2 Example 17. Involutions and Hermite polynomials The system generates a sequence that starts with These numbers count involutions: more precisely, one easily derives from the recursion satisfied by the coefficients f n;k that f n;k is the number of involutions on n points, of which are fixed. Proposition 6 applies with The corresponding EGF is e and its value at The polynomials f n counting involutions on n points are in fact closely related to the Hermite polynomials, defined by: Indeed, comparing the above identity with (19) shows that f n Example 18. Partial permutations and Laguerre polynomials The rewriting rule a sequence that starts with 1; 2; 7; 34; 209; ::: (M1795). From the recursion satisfied by the coefficients f n;k , we derive that f n;n+k is the number of partial injections of f1; ng into itself in which are unmatched. From this, we obtain: e exp where L n (u) is the nth Laguerre polynomial. Again, e The next two systems, as announced, lead to nonholonomic generating functions. Example 19. Set partitions and Stirling polynomials Let us consider the system [(1); From the recursion satisfied by the coefficients f n;k , we derive that f n;k+1 is equal to the Stirling number of the second kind which counts partitions of n objects into k nonempty subsets. The corresponding EGF is e At generating function specializes to e z n This is the exponential generating function of the Bell numbers (M1484). It is known that log log log n+O(n) (see [20]), and this cannot be the asymptotic behaviour of the logarithm of the coefficients of an holonomic series (see [29] for admissible types). Hence, e F (z; 1), as well as F (z; 1), is nonholonomic. 2 Example 20. Bessel numbers We study the system with axiom (2) and rewriting rules 3: (20) We shift the labels by 2 to obtain a walk model with axiom (0) and rules The corresponding bivariate generating function F (z; u) satisfies the functional differential equation F (z; u) which is certainly not obvious to solve. However, as observed in [15], it is easy to obtain a continued fraction expansion of the excursion generating function: is the generating function of Bessel numbers (M1462) and counts non-overlapping partitions [17]. As F (z; itself, the series B(z) has radius of convergence zero. The fast increase of B From [17], we know that log B prevents F (z; from being holonomic. In order to prove that F (z; 1) itself is nonholonomic, we are going to prove that its coefficients f n have the same asymptotic behaviour as the coefficients of F (z; 0). Clearly, To find an upper bound for f n , we compare the system (20) (denoted \Sigma 1 below) to the system 1). This system generates a tree with counting sequence g n . The form of the rules implies that the (unlabeled) tree associated with \Sigma 1 is a subtree of the tree associated with \Sigma 2 . Hence f n - g n . Comparing \Sigma 2 to the system studied in the previous example shows that g n is the Bell number B n+1 , the logarithm of which is also known to be n log log log n+O(n) (see [20]). Hence log f and this prevents the series F (z; 1) from being holonomic. 2 Axiom System Name Id. Generating Function Rational OGF OGF 3: Fibonacci M0692 1 even Fibonacci M1439 1\Gammaz Algebraic OGF OGF 7: Motzkin numbers M1184 1\Gammaz\Gamma Dissections of a polygon M3587 Holonomic EGF transcendental OGF Permutations M1675 1=(1 \Gamma z) Involutions M1221 e z+ 1z 2 permutations M1795 e z=(1\Gammaz) problem M1461 e 2z+ 1z 2 Bicolored involutions M1648 e 2z+z 2 Nonholonomic OGF EGF Bicolored partitions M1662 e 2(e z \Gamma1) Table 2: Some ECO-systems of combinatorial interest. A small catalog of ECO-systems To conclude, we present in Table 2 a small catalog of ECO-systems that lead to sequences of combinatorial interest. Several examples are detailed in the paper; others are due to West [27, 28] or Barcucci, Del Lungo, Pergola, Pinzani [4, 6, 5, 3], or are folklore. Each of them is an instance of application of our criteria. Acknowledgements . We thank Elisa Pergola and Renzo Pinzani who presented us the problem we deal with in this paper. We are also very grateful for helpful discussions with Jean-Paul Allouche. --R Combinatoire analytique random generation of trees and other combinatorial objects. A methodology for plane tree enumeration. ECO: a methodology for the enumeration of combinatorial objects. From Motzkin to Catalan permutations. Permutations avoiding an increasing number of length increasing forbidden subsequences. Linear recurrences with constant coefficients: the multivariate case. Enum'eration des graphes planaires Infinitesimal calculus. A. combinatorial proof of Permutations with forbidden subsequences and nonseparable planar maps. Solutions of functional equations arising in the analysis of two-server queueing models Combinatorial aspects of continued fractions. Analytic models and ambiguity of context-free languages The Art of Computer Programming. Permutations with forbidden subsequences and a generalized Schr-oder num- ber Asymptotic enumeration methods. The irrational chess knight. The little book of big primes. The Encyclopedia of Integer Sequences. Differentiably finite power series. Enumerative combinatorics Generating trees and the Catalan and Schr-oder numbers Generating trees and forbidden subsequences. Resurrecting the asymptotics of linear recurrences. --TR Analytic models and ambiguity of context-free languages Non-overlapping partitions, continued fractions, bessel functions and divergent series The little book of big primes Generating trees and the Catalan and SchroMYAMPERSANDuml;der numbers Permutations with forbidden subsequences and nonseparable planar maps Asymptotic enumeration methods Generating trees and forbidden subsequences The art of computer programming, volume 1 (3rd ed.) A methodology for plane tree enumeration A combinatorial proof of J. West''s conjecture Random generation of trees and other combinatorial objects From Motzkin to Catalan permutations Permutations with forbidden subsequences and a generalized SchrMYAMPERSANDouml;der number Solutions of Functional Equations Arising in the Analysis of Two Server Queueing Models --CTR Martin Klazar, Bell numbers, their relatives, and algebraic differential equations, Journal of Combinatorial Theory Series A, v.102 n.1, p.63-87, April D. Merlini , R. Sprugnoli , M. C. Verri, Waiting patterns for a printer, Discrete Applied Mathematics, v.144 n.3, p.359-373, 15 December 2004 Anna de Mier , Marc Noy, A solution to the tennis ball problem, Theoretical Computer Science, v.346 n.2, p.254-264, 28 November 2005 M. Bousquet-Mlou , A. Rechnitzer, The site-perimeter of bargraphs, Advances in Applied Mathematics, v.31 n.1, p.86-112, 1 July Mireille Bousquet-Mlou , Arnaud Jehanne, Polynomial equations with one catalytic variable, algebraic series and map enumeration, Journal of Combinatorial Theory Series B, v.96 n.5, p.623-672, September 2006 Enrica Duchi , Jean-Marc Fedou , Simone Rinaldi, From object grammars to ECO systems, Theoretical Computer Science, v.314 n.1, p.57-95, 25 February 2004 G. Castiglione , A. Frosini , A. Restivo , S. Rinaldi, Enumeration of L-convex polyominoes by rows and columns, Theoretical Computer Science, v.347 n.1-2, p.336-352, November 2005 Mireille Bousquet-Mlou , Marko Petkovek, Walks confined in a quadrant are not always D-finite, Theoretical Computer Science, v.307 n.2, p.257-276, 7 October Petter Brndn , Toufik Mansour, Finite automata and pattern avoidance in words, Journal of Combinatorial Theory Series A, v.110 n.1, p.127-145, April 2005
walks on a half-line;algebraic generating functions;d-finite generating functions;generating trees
603848
CDMA uplink power control as a noncooperative game.
We present a game-theoretic treatment of distributed power control in CDMA wireless systems. We make use of the conceptual framework of noncooperative game theory to obtain a distributed and market-based control mechanism. Thus, we address not only the power control problem, but also pricing and allocation of a single resource among several users. A cost function is introduced as the difference between the pricing and utility functions, and the existence of a unique Nash equilibrium is established. In addition, two update algorithms, namely, parallel update and random update, are shown to be globally stable under specific conditions. Convergence properties and robustness of each algorithm are also studied through extensive simulations.
Introduction In wireless communication systems, mobile users respond to the time-varying nature of the channel, described using short-term and long-term fading phenomena [1], by regulating their transmitter powers. Specically, in a code division multiple access (CDMA) system, where signals of other users can be modeled as interfering noise signals, the major goal of this regulation is to achieve a certain signal to interference (SIR) ratio regardless of channel conditions while minimizing the interference due to user transmit power level. Hence, there are two major reasons for a user to exercise power control: the rst one is the limit on the battery energy available to the mobile, and the second reason is the increase in capacity, which can be achieved by minimizing the interference. Power control in CDMA systems are in either open-loop or closed-loop form. In open-loop power control, the mobile regulates its transmitted power inversely proportional to the received power. In closed-loop power control, on the other hand, commands are transmitted to the mobile over the downlink to increase or decrease its uplink power [2, pp.182]. Research supported in part by grants NSF ANI 98-13710, NSF INT 98-04950, NSF CCR 00-85917, AFOSR MURI AF DC 5-36128, and ARMY OSP 35352-6086. All correspondence should be forwarded to: Prof. Tamer Basar, Coordinated Science Laboratory, University of Illinois, 1308 West Main Street, Urbana, IL 61801-2307 USA. Coordinated Science Laboratory, University of Illinois, 1308 West Main Street, Urbana, IL 61801 USA. 3 INRIA B.P. 93, 06902 Sophia Antipolis Cedex, France, and CESIMO, Facultad de Ingeneria, Univeridad de Los Andes, Merida, Venezuela. A specic proposal to implement distributed power control made by Yates [3] relies on each user updating its power based on the total received power at the base station. It has been shown in [3] that the resulting distributed power control algorithm converges under a wide variety of interference models. Another distributed power control scheme has been introduced in [4], which is adaptive and uses local measurements of the mean and the variance of the interference. The authors have shown that this algorithm is convergent provided that a certain condition is satised. Game theory provides a natural framework for developing pricing mechanisms of direct relevance to the power control problem in wireless networks. In such networks, the users behave noncooperatively, i.e., each user attempts to minimize its own cost function (or maximize its utility in response to the actions of the other users. This makes the use of noncooperative game theory [5] for uplink power control most appropriate, with the relevant solution concept being the noncooperative Nash equilibrium. In this approach, a noncooperative network game is dened where each user attempts to minimize a specic cost function by adjusting his transmission power, with the remaining users' power levels xed. The main advantage of this approach is that it not only leads to distributed control as in [3], but also naturally suggests pricing schemes, as we will see in this paper. Possible utility functions in a game theoretical framework, and their properties for both voice and data sources have been investigated in detail in [6], which formulates a class of utility functions that also account for forward error control, and shows the existence of a Nash equilibrium and the uniqueness of an optimal response. One interesting feature of this framework is that it provides utility functions for wireless data transmission, where power control directly aects the capacity of mobiles' data transmission rates. Reference [6] also proposes a linear pricing scheme in order to achieve a Pareto improvement in the utilities of mobiles. In an earlier study [7], Nash equilibria achieved under a pricing scheme have been characterized by using supermodularity. It has been shown that a noncooperative power control game with a pricing scheme is superior to one without pricing. One deciency of this game setup, however, is that it does not guarantee social optimality for the equilibrium points. Linear and exponential utility functions based on carrier(signal)-to-interference ratio are also proposed in [8]. The existence of a Nash equilibrium is shown under some assumptions on the utility functions, and an algorithm for solving the noncooperative power control game is suggested. In this paper, we propose a power control game similar to the ones in [8, 6]. In the model we adopt, however, we use a cost function dened as the dierence between a linear pricing scheme proportional to transmitted power, and a logarithmic, strictly concave utility function based on SIR of the mobile. Furthermore, the utility function is made user-specic by multiplying it with a utility parameter re ecting the individual user preferences. We then rigorously prove the existence and uniqueness of a Nash equilibrium. We also investigate possible boundary equilibrium solutions, and hence derive a quantitative criterion for admission control. As in [3], one way of extending the model is to include certain SIR constraints. As an alternative, we suggest a pricing strategy to meet the given constraints, and analyze the relation between price, SIR, and user preferences as re ected by the utility parameter. Thus, we address not only the power control problem, but also pricing and allocation of a single resource among several users. Furthermore, we study dierent pricing strategies, and obtain a distributed and market-based power control mechanism. Finally, under a su-cient condition we prove the convergence of two algorithms, parallel update (PUA) and random update (RUA), to the unique Nash equilibrium. In order to illustrate the convergence, stability and robustness of the update algorithms, we use extensive simulations using MATLAB. Moreover, we study the eect of the various parameters of the model, especially dierent pricing schemes. In order for the simulations to capture realistic scenarios, we introduce feedback delay and modeling disturbances, where the latter is caused by variations in the number and location of users in the network. The next section describes the model adopted and the cost function. In Section 3, we prove the existence and uniqueness of the Nash equilibrium. We present update algorithms for mobiles in Section 4, whereas Section 5 introduces dierent pricing strategies at the base station. The simulation results are given in Section 6, which is followed by the concluding remarks of Section 7. 2 The Model and Cost Function We describe here the simple model adopted in this paper for a single cell CDMA system with up to M users. The number of users is limited under an admission control scheme that ensures the minimum necessary SIR for each user in the cell. For the i th user, we dene the cost function J i as the dierence between the utility function of the user and its pricing function, J . The utility function, U i , is chosen as a logarithmic function of the i th user's SIR, which we denote by i . This utility function can be interpreted as being proportional to the Shannon capacity [1, 9] for user i, if we make the simplifying assumption that the noise plus the interference of all other users constitute an independent Gaussian noise. This means that this part of the utility is simply linear in the throughput that can be achieved (or approached) by user i using an appropriate coding, as a function of its transmission power. This logarithmic function is further weighted by a user-specic utility parameter, u i > 0, to capture the user's level of \desire" for SIR. The pricing function denes the instantaneous \price" a user pays for using a specic amount of power that causes interference in the system. It is a linear function of p i , the power level of the user. Accordingly, the cost function of the i th user is dened as denotes the vector of power levels of all users except the i th one, and i is the SIR function for user i, given by Here, R is the spreading gain of the CDMA system, where W is the chip rate and R is the total rate; we assume throughout that L > 1. The parameter h j , 0 < h j < 1, is the channel gain from user j to the base station in the cell, and 2 > 0 is the interference. For notational convenience, let us denote the i th user's power level received at the base station as y i := h i p i , introduce the quantity and further dene a user specic parameter (a i ) for the i th user as a 3 Existence and Uniqueness of Nash Equilibrium The i th user's optimization problem is to minimize its cost, given the sum of powers of other users as received at the base station, noise. The nonnegativity of the power vector (p i is an inherent physical constraint of the model. Taking the derivative of the cost function (2.1) with respect to p i , we obtain the rst-order necessary condition: In the case of a positive inner solution, (3.1) holds with equality. It is easy to see that the second derivative is also positive, and hence the inner solution, if it exists, is the unique point minimizing the cost function. The boundary solution, is the other possible optimal point for the constrained optimization problem. If the user's cost function, J i (p attains its minimum for a power value less than zero, p i;min < 0, the optimal solution will be the boundary point. Solving Equation (3.1) and invoking the positivity constraint p i 0, we obtain the reaction function, i , of the i th user: [a iL The reaction function is the optimal response of the user to the varying parameters in the model. It depends not only on the user-specic parameters, like u i , i , and h i , but also on the network parameter, L, and total power level received at the base station, Actually (3.2) shows dependence only on y i , but adding ( 1 both sides, and dividing both sides by (1 1 can express the response of the i th user as a function of the quantity . The base station provides the user with total received power level using the downlink. If the frequency of user updates is su-ciently high, this can be done incrementally in order to decrease the overhead to the system. A simplied block diagram of the system is shown in Figure 1. Similar to the transmission control protocol (TCP) in the Internet [10], there is an inherent feedback mechanism here, built into the reaction function of the user. In this model, the total received power at the base station provides the user with information about the \demand" in the network, which is comparable to congestion in case of the TCP. However, one major dierence is that here the reaction function itself takes the place of the window based algorithms in the TCP. In order for the i th mobile to be \active", or p i > 0 the following conditions from (3.2) have to hold: a i > 0 and intuitive interpretation for these conditions is the following: If the Mobile 1 Mobile 2 Mobile M BS l l l Figure 1: A simplied block diagram of the system. price, i , is set too high for a mobile, the mobile prefers not to transmit at all, depending on its channel gain and utility parameter, and the spreading gain and interference level. For any equilibrium solution, the set of xed point equations can be written in matrix form by exploiting the linearity of (3.2). In case of a boundary solution, the rows and columns corresponding to users with zero equilibrium power are deleted, and the equation below involves only the users with positive powers. Hence we have (assuming here that all M users have positive power levels at hM hM where the variable c i is dened as c . Note that c i > 0 if a i is positive. Theorem 3.1. In the power game just dened (with M users), let the indexing be done such that a i < a with the ordering picked arbitrarily if a be the largest integer ~ M for which the following condition is satised: a ~ ~ Then, the power game admits a unique Nash equilibrium (NE), which has the property that users have zero power levels, p 1. The equilibrium power levels of the rst users are obtained uniquely from (3.3) with M replaced by M , and are given by f L a If there is no ~ M for which (3.4) is satised, then the NE solution is again unique, but assigns zero power level to all M users. Proof. We rst state and prove the following lemma, which will be useful in the proof of the theorem. Lemma 3.2. If condition (3.4) is satised for ~ , it is also satised for all ~ M such that M . Proof. Suppose that condition (3.4) holds for ~ then we argue that it also holds for ~ M 1. Substituting in M for ~ M , we rewrite it as: Due to the indexing of users, we have a ^ M . Substituting a ^ for a ^ above, we obtain Hence, (3.4) is satised for ~ M 1. The proof then follows by induction on ~ M . Returning to the proof of the theorem, we rst show that the matrix A in equation (3.3) is full rank and hence invertible, and thereby the solution to (3.3), p , is unique. Then we show that the solution is strictly positive (i.e. p only if, condition (3.4) is satised for ~ . Finally, we relax condition and allow for boundary solutions, and conclude the proof by proving the uniqueness of the boundary solution. In order for the matrix A in (3.3) to be full rank and hence invertible, there should not exist a nonzero vector This equation can be written as: Summing up this set of equations over all users, The term above is nonzero, and hence the sum has to be zero. Since the channel gains are strictly positive, h i > 0 8i, and L > 1, it follows from (3.6) that q Accordingly, the matrix A is full rank and hence invertible, which leads to a unique solution for equation (3.3). Simple manipulations lead to (3.5), with M , for this unique solution. If the NE exists and is strictly positive, then (3.3) has to have a unique positive solution, which we already know is given by (3.5). Hence, (3.5) has to be positive, which is precisely condition (3.4) in view of also the indexing of the users. On the other hand, if (3.4) holds for ~ then we obtain from (3.5) that the equilibrium power level of each user is strictly positive. The existence and uniqueness of the NE follows from (3.3). We thus conclude that condition (3.4) with ~ is both necessary and su-cient for the existence of a unique positive Nash equilibrium. To complete the proof for the case M possible boundary solutions need to be investigated to conclude the uniqueness of the inner Nash equilibrium. We have to show that there cannot be another NE, with a subset ~ M of ~ users transmitting with positive power, and the remaining users having zero power level. In this case, the reactive power level of the i th mobile, M, is given by (3.5) with M M . For any i th mobile, M, in order for the zero power level to be part of a Nash equilibrium, condition should fail according to the reaction function (3.2) of the mobile. Summing up the equilibrium power levels as received by the base station of ~ users with positive power levels (from (3.5) with M) results inL a j (3.8) Substituting in (3.7) the expression (3.8) for a On the other hand, from Lemma 3.2, and (3.4), we have for any i th user in the indexed set 1g the following a ~ Also, from the indexing of the users it follows that Using this in (3.10), we see that inequality (3.9) is satised for any i th user regardless of the choice of the subset ~ M. We note that there exists at least one user belonging to the set 1g, but not the subset ~ M. Thus, the power of that mobile must be positive, and hence the boundary solution cannot be a Nash equilibrium. As this argument is valid for any subset ~ M, all boundary solutions fail similarly for being an equilibrium, including the trivial solution, the origin. We thus conclude that the inner Nash equilibrium is unique. This completes the proof for the case M If M < M in condition (3.4), then the equilibrium (whenever it exists) will clearly be a boundary point. If condition (3.4) fails for users M users are indexed as described in Theorem 3.1, then these users use zero power in the equilibrium. Hence, for any i th user among should fail. It was shown above that equation (3.8) holds with ~ As condition (3.4) does not hold for the i th user, equation (3.9), and hence (3.7) fails. Thus, from (3.2) power level of the i th user is zero, 0, at the equilibrium. As this holds for any i Mg, the equilibrium power levels for these users are zero. We now argue that the given boundary solution is unique. One possibility is the existence of an i th user, where 1 i M , to have zero power. This cannot be a Nash equilibrium, as it follows from (3.8) and (3.9) with ~ Another possibility is the existence of an i th user, transmitting with positive power level. This cannot be an equilibrium, either, as it was shown above that (3.7) fails for such an i th user, and directly from the reaction function (3.2). All possible boundary solutions can be captured by various combinations of these two cases. Consider the case where a subset of users among use zero power whereas some of the users among M use positive power levels. Since for the subset of users with positive power levels among M condition (3.4) does not hold, they cannot be in equilibrium following an argument similar to the one above. Otherwise, as condition (3.4) holds for the subset of users with zero power level among they cannot be in equilibrium, either. We conclude, therefore, that the boundary solution is unique. Finally, in the case where no M exists satisfying condition (3.4), all users fail to satisfy (3.4), and the only solution is the trivial one, p 4 Update Schemes for Mobiles, and Stability In this section, we investigate the stability of the Nash equilibrium in the given model under two relevant asynchronous update schemes: parallel and random update. We establish a su-cient condition which guarantees the convergence to the unique equilibrium point for both algorithms. 4.1 Parallel Update Algorithm (PUA) In the PUA, users optimize their power levels at each iteration (in discrete time intervals) using the reaction function (3.2). If the time intervals are chosen to be longer than twice the maximum delay in the transmission of power level information, it is possible to model the system as a delay-free one. In a system with delays, there are subsets of users, updating their power levels given the delayed information. The algorithm is given by [a iL y (n) or equivalently by y (n) whose global stability is established in the next theorem. This means that PUA converges to the unique Nash equilibrium of Theorem 3.1 given as [a iL from any feasible initial point, p i 0 8i. Theorem 4.1. PUA is globally stable, and converges to the unique equilibrium solution from any feasible starting point if the following condition is satised: Proof. Let us dene the distance between the i th user's power level received in the base station at any time (n) and received equilibrium power level as 4y (n) . We consider rst the case when y for an arbitrary i th user. Then, given the received power levels of all users except the th one at time n, we have the following from (4.1) and (4.2): j4y (n+1) Thus, we obtain j4y (n+1) j4y (n) Next, we consider the case when the received equilibrium power level for an arbitrary i th user is zero, y Then, from (4.1) and (4.2) it follows that j4y (n+1) Thus, the inequality (4.4) holds for any i th user at any time instant n for both cases. We now show that (4.3) is a su-cient condition for the right-hand side of (4.4) to be a contraction mapping. Let denote the l 1 -norm of the vector (4y 1 4y Then, from (4.4), jj4y j4y (n) Hence, (4.4) is a contraction mapping under condition (4.3), which leads to the stability and global convergence of the PUA (4.1). We nally note that using an initial admission control mechanism and user dropping scheme, which limits the number, M , of users in the cell, this condition can easily be satised for a given L. Thus, the stability and convergence of the algorithm follows. 4.2 Random Update Algorithm (RUA) Random update scheme is a stochastic modication of PUA. The users optimize their power levels in discrete time intervals and innitely often, with a predened probability 0 < i < 1. Thus, at each iteration a set of randomly picked users among the M update their power levels. The system with delay is also similar to PUA. The users make decisions based on delayed information at the updates, if the round trip delay is longer than the discrete time interval. The RUA algorithm is described by y (n) where i was dened in (4.1). We already know from the proof of Theorem 4.1 that if user i updates, then (4.4) holds. Hence, for each Ej4y (n+1) user i updates at time ng i +Efj4y (n) user i does not update at time ng(1 i ) Ej4y (n) Using again the l 1 -norm dened in (4.5), but with j4y i j replaced by Ej4y i j (that is, jj4yjj 1 := following steps similar to the ones of PUA, we obtain Ej4y (n+1) which leads to jj4y where < 1 and > 0 are the upper and lower limits for the update probability of the i th user respectively, < i < . Therefore, is a su-cient condition for the right-hand side of (4.6) to be a contraction mapping, and for the stability and convergence of RUA in norm. We also note that when all users have the same update probability, condition simplies to (M 1)=L < 1, same su-cient condition (4.3) as the one for PUA. We show next a stronger result, almost sure (a.s.) convergence of RUA, under condition (4.7). By the Markov inequality and using the denition of the l 1 -norm, we haveX Ej4y (n) "X where P (:) denotes the underlying probability measure. Since Ej4y (n) contracting sequence with respect to the l 1 -norm as shown, 1. Using this in (4.8), it follows thatX and thus follows,X where K is a constant (actually, Hence, the increasing sequence of partial sums bounded above by K "(1 ) . Thus, it converges for every " > 0. From the Lemma [11, 12], it then follows that Hence, RUA converges also a.s. under condition (4.7). 4.3 Comparison of PUA and RUA One important feature of PUA is that it ascribes a myopic behavior to the users, that is they optimize their power levels based on instantaneous costs and parameters, ignoring future implications of their actions. This behavior of users is realistic for the analyzed wireless network as it may not be feasible or even possible for a mobile to estimate future values of total interference in the cell or future variations in its own channel gain. In the case of RUA, the users are again myopic and update their power levels based on instantaneous parameters. But, not all of them act at every iteration; whether a particular user responds or not is determined probabilistically. In the limiting case when all update probabilities, i , are equal to 1, RUA is the same as PUA. An advantage of RUA, however, is that through it one can investigate the convergence of the proposed scheme when there are random delays in the system. Such delays may be due to dierences in the processing or propagation times. As we will see in the simulations included in Section 6, in a delay-free system if all the users have the same initial power level, then RUA performs better than PUA. This is due to the myopic behavior of users, as well as the inherent randomization in the case of RUA. On the other hand, the opposite is true for a system with delay as variations in delay provide su-cient randomization, and PUA becomes more advantageous due to frequent updates. More detailed observations on the convergence of both algorithms can be found in Section 6 for both delay-free and delayed cases. Pricing Strategies at the Base Station In a noncooperative network, pricing is an important design tool as it creates an incentive for the users to adjust their strategies, in this case power levels, in line with the goals of the network. In the CDMA system we are studying here, the price per unit power of the i th user, i , is determined by the base station in a manner to be discussed shortly. We introduce a pricing scheme where the price charged to each user is proportional to the received power from the user at the base station. Thus, the price is proportional to the channel gain of the i th user, The inner Nash solution by itself does not guarantee that the users with nonzero power levels will meet the minimum SIR requirement to establish a connection to the base station. Achieving the necessary SIR level is obviously crucial to the successful operation of the system. Furthermore, one has to recognize that dierent communication applications in wireless systems leads to dierent types of users and SIR requirements in addition to the minimum SIR level. In view of these considerations, we will consider in this section two dierent pricing schemes: (i) A centralized pricing scheme: Users are divided into classes, with all users belonging to a particular class having the same utility function parameter (u i ). Further, all users within a class have the same SIR requirement. The role of the base station is to set prices for these dierent classes such that, under the resulting Nash equilibrium, the SIR targets of the users are met. (ii) Decentralized, market-based pricing: The base station sets a single price for all users, and the users choose their willingness to pay parameter, (u i ), to satisfy their QoS requirements. As compared to the centralized scheme, this one is more exible, and allows users to compete for the system resources by adjusting their individual u i 's. 5.1 Centralized Pricing Schemes and Admission Control First, we consider the symmetric-user case where every mobile has the same SIR requirement, and for convenience we let u 1. It is possible to nd a simple pricing strategy by picking the price directly proportional to the channel gain, the pricing factor, k, is user independent. The parameter k is a function of the number of users and the desired SIR level. Notice that this approach is equivalent to centralized power control as the prices are adjusted by the base station in such a way that the mobiles use the power levels determined by the unique Nash equilibrium as a result of their individual optimization. Moreover, the base station can set the prices such that the SIR requirements of the users are satised. A precise result covering this case is now captured by the following theorem. Theorem 5.1. Assume that the users are symmetric in their utilities, u they have the same minimum SIR requirement, , and are charged proportional to their channel gain, Then the maximum number of users, M , the system can accomodate is bounded by Moreover, the pricing parameter k under which M M users achieve the SIR level is Proof. Solving for the user-independent y i from (3.2), we have Combining this result and the SIR function in (2.2), and taking the minimum SIR, , as input, we obtain (5.2) for a single class of users in a cell. To ensure that (5.2) is well dened, we require the condition in (5.1). Based on (5.2), condition (5.1) satises (3.4). Thus, both the necessary and su-cient conditions for a unique positive Nash equilibrium are satised if (5.1) holds. Then, the unique solution is strictly positive according to Theorem 3.1, and all M M users attain the desired SIR level, . We note that if M > M , all users fall below the desired SIR level ( due to the symmetry. In this case, dropping some of the users from the system in order to decrease the number of users M below the threshold (M ) would lead to a viable solution. Next, we consider the case where the network may provide multiple service levels and multiple pricing schemes. For this more general case, it is convenient to split the mobiles in a cell into multiple groups according to their need for bandwidth, or in our context, their desired SIR levels, where the users within each group are symmetric. Using a multiple pricing scheme, a solution capturing multiple user groups can be obtained straightforwardly. 5.2 Market-Based Scheme It is natural to think of each user within a cell having dierent SIR requirements, which can be quantied with the user-specic utility parameter u. The base station can implement a natural pricing strategy by formulating the pricing parameter directly proportional to the channel gain, However, it is impossible in this case for the base station to calculate the parameter k, as the user preferences are unknown to the base station. Hence, after the base station sets an appropriate value for price (k), each user dynamically updates its power level by minimizing its cost under parallel update (PUA) or random update (RUA) algorithms. As a result, a distributed and market-based power control scheme is obtained. Due to the interference in the CDMA system, each user aects others. Hence, the i th mobile can adjust its utility parameter, u i , dynamically according to its minimum SIR level, given the interference at the base station. From (3.2) and (2.2), it follows that The parameter u i is bounded below by the total received power at the base station. This can be interpreted as follows: If a mobile is in a cell where the interference is low, the mobile can achieve the desired SIR level with a low power, hence paying a lower price. However, in a situation where many users compete for the SIR, the mobile has to use more power, and pay a higher price to reach the same SIR level. In the latter case, the user's willingness to spend more can be justied with a higher u i based on (3.2). We note that, together with the utility function, the utility parameter u i quanties the user's desire for the SIR. The base station can limit aggressive requests for SIR even in the case when a user pays for its excessive usage of power, by setting an upper-limit, y max , for the received power of the i th user at the base station: y i y max . Hence, unresponsive users can be punished by the base station in order to preserve network resources. From (3.2), we can obtain an upper-bound on the value of u i . Furthermore, this bound depends only on user-independent parameters, such as the upper limit of the total received power at the based station, maximum number of mobiles, and the spreading gain, L, if proportional pricing is used: When this bound is combined with a simple admission control scheme, limiting the number of mobiles to M max , the base station can provide guarantees for a minimum SIR level A tradeo is observed in the choice of the design parameters versus M max . If the network wants to provide guarantees for a high SIR level, then it has to make a sacrice by limiting the number of users. In addition, users may implement a distributed admission scheme according to their budget constraints and desired SIR levels. If the price necessary to reach a SIR level exceeds the budget, B i , of the user, that is k then the user may simply choose not to transmit at all. 6 Simulation Studies The proposed power control scheme has been simulated numerically using MATLAB. Here, we rst investigate dierent pricing schemes for symmetric mobiles in the xed-utility case. Then, we analyze the robustness of the system under varying parameters such as noise, the number of users, and channel gains. Furthermore, the rate of convergence of both update schemes, PUA and RUA, are studied both in the delay-free and delayed cases. Finally, we investigate a system consisting of users with various utility parameters. All results of the simulations are valid for both update schemes, PUA and RUA, where the only dierence between the two is the convergence rate. Simulation parameters are chosen as follows, unless otherwise stated. The spreading gain 128 is chosen in accordance with IS-95 standard [1]. Noise factor is the stopping criterion or distance to equilibrium is given by . The users are assumed to be located randomly in the cell where the distance of the i th user to the base station, d i , is uniformly distributed between d 100. The channel gains of users are determined by a simple large-scale path loss formula the path loss exponent is chosen as 2 corresponding to open air path loss. Under the xed-utility case, users have the same utility parameter, 8i. The initial condition for simulations is 8i, an estimated value for establishing initial communication between the mobile and the base station. In the simulations, a discrete time scale is used. The delay-free case is characterized by a time span that is long enough for perfect information ow to users. Subsequently, delay is introduced to the system to make the setting more realistic. 6.1 Eect of the Pricing Parameters In the rst simulation, proportional and xed pricing schemes are compared. For simplicity, we rst choose the users being symmetric under both xed pricing, proportional pricing, . For illustrative purposes the number of users is chosen small, In Figure 2, the equilibrium power and the SIR values of each user can be seen under both pricing schemes. In the top graph, power values of the users with dierent channel gains are almost the same under xed pricing. Hence, the users with lower channel gains achieve lower SIR values. In contrast, all users meet a minimum SIR level under proportional pricing, regardless of their channel gain. An intuitive explanation is that under proportional pricing the distant users are allowed to use more power to attain the necessary SIR level. We also note that, proportional pricing is 'fair' in the sense that the users are not aected by their distance to the base station. Convergence of users' power levels to their equilibrium values is demonstrated in Figure 3 (a) under PUA, and Figure 3 (b) under RUA with update probability being 0:6. In both cases there are 10 users and The eect of pricing is investigated in the next simulation for a single class of users by varying the pricing parameter, k, under proportional pricing. Equivalently, this simulation can be interpreted Power Curves of N=20 users -2020SIR Values (in dB) Proportional Pricing Fixed Pricing Channel Gains Users Figure 2: Comparison of power and SIR nal values of the mobiles for the xed and proportional pricing schemes. Power Values vs. Number of Iterations under PUA (L=20,N=10) Iterations Power level Power Values vs. Number of Iterations under RUA (pi=0.6,L=20,N=10) Iterations Power level (a) (b) Figure 3: Convergence of users' individual power levels to the equilibrium values versus number of iterations under (a) PUA, and (b) RUA with as varying the utility parameter, u. Both parameters play a crucial role in the system by aecting the overall power and SIR levels. From (3.2), the eect of u i on the system is inversely proportional to k i . In Figure 4 it can be observed that a gradual increase in k from 1 to 4, i.e. an increase in price, aects the system in a such a way that both power and SIR values decrease. Since, with an increase in the price, the users decrease their powers to the same extent leading to lower SIR values given a constant noise level. Equivalently, a decrease in u, the users' level of request for SIR, gives the same result. Furthermore, the observations match theoretical calculations for the single class case in accordance with (5.2). (in dB) of Users versus Pricing (or 1/Utility) Parameter Power Levels of Usersversus Pricing (or 1/Utility) Parameter Users Figure 4: Eect of the pricing parameter, k, (utility parameter 1=u) on the SIR and the power levels of users. 6.2 Convergence Rate and Robustness of Algorithms 6.2.1 Simulations without Delay The convergence rate of the two update schemes is of great importance, as it has a direct eect on the robustness of the system. We have simulated PUA and RUA for dierent numbers of symmetric users under a single pricing scheme. In Figure 5, the number of iterations to the equilibrium point is shown for dierent probability values of RUA and also for PUA (which corresponds to RUA with the update probability equal to one). As the number of users increase the optimal update probability decreases. This result is in accordance with the one in [13] where it is shown that in a quadratic system without delay, an approximate value for the optimal update probability is 2, as number of users goes to innity. On the other hand, if number of users is much smaller than the spreading gain, M L, then PUA is superior to RUA. 02004000204060Number of Users RUA for different Nbr. of users and Update Prob. Update Probability Number of Iterations Figure 5: Convergence rate for dierent update probabilities and increasing numbers of users. Next, we investigate the robustness of the system in the delay-free case. First, we analyze it under increasing noise, 2 . The background noise is increased step by step up to 100% of its initial value. Accordingly, the base station allows users to increase their powers by decreasing the prices by the same percentage in the xed-utility case. The simulation is repeated with users under a proportional pricing scheme. We observe in Figure 6 (a) that the power values increase in response to the increasing noise to keep the initial SIR constant. Similarly, we increase the number of mobiles in the system threefold in Figure 6 (b). It has the same eect as increasing the noise due to the nature of CDMA. Again by adjusting the prices accordingly, all users keep their SIR levels. Same results are obtained equivalently under the market-based pricing scheme, where users adjust their utility parameter, u, dynamically while the pricing parameter determined by the base station is kept constant. As a conclusion, these observations conrm the robustness of the proposed power control scheme. Finally, we simulate the system in a realistic setting under a single pricing scheme: The number of users, taken as initial value, is modeled as a Markov chain. Arrival of new mobiles is chosen to be Poisson with an average of 2 new users per time interval. Call durations are exponentially distributed with an average of 20 time intervals. We observe the average percentage dierence between the theoretical equilibrium and the current operating point of the system in terms of power values of users for some period of time. In the simulation, PUA is chosen as the update algorithm. The initial condition is the equilibrium point for users. The simulated system operates within 1% range of the equilibrium points, and the results are very similar to those of in Figure 7. Heretofore, robustness of the system was investigated for static mobiles. The movements of the Robustness under varying Noise Power Values Users Values Robustness under varying number of Users Power Values 020Users User Number in System Values (a) (b) Figure Power and SIR nal values for increasing noise (a) and numbers of users (b). users within the cell result in varying channel gains. In the next simulation, the locations, hence, channel gains of users are varied randomly. The movement of i th user is modelled after a random walk where a random value is added to the distance of the user to the base station d i at each time instant. Hence, we obtain d uniformly distributed. Furthermore, the setting used in this simulation is the same as previous one. From Figure 7, the system again operates within 1% distance to equilibrium. 6.2.2 Simulations with Delay We introduce the delay factor into the system in the following way: users are divided into d equal size groups, and each group has an increasing number of units of delay. First, the convergence rates of the two update schemes are compared and contrasted under delay-free and delayed conditions. The update probability of RUA is chosen as 0:66 which corresponds to the optimal update probability for a large number of users. In the delay-free case RUA outperforms PUA as the number of users increases. In the delayed case, however, PUA is always superior to RUA. Then, the simulation investigating the convergence rate of RUA for various update probabilities is repeated in the delayed case. The result shown in Figure 8 is dierent from the previous one in Figure 5. Here, PUA converges faster than RUA for any number of users verifying previous results. Finally, a market-based pricing scheme with proportional pricing at the base station, investigated. There are two groups of users, which are symmetric within themselves. Users in each group have dierent utility parameters, u. The group with higher u is labeled as the \priority" user group, while the other one is called the \regular" user group. In order to observe the eect of varying number of users on the SIR levels, we let a sample user from each group make a long enough call. At the same time, the number of users in each group and channel gains of the users are varied similar to those in previous robustness simulations to create realistic disturbances in the system. For simplicity, the values of the utility parameters are kept constant throughout the Percentage Distance to Equilibrium per User vs Time 200204060Number of Users vs Time Figure 7: Average percentage distance to the equilibrium point vs. time. Channel gains, h i , are varied based on random movements of users. 020040010305070Number of Users RUA for different Nbr. of users and Update Prob. (with delay) Update Probability Number of Iterations Figure 8: Convergence rate for dierent update probabilities and increasing numbers of users (with delay). SIR of two Selected Users vs Time Received Power (=Price) of Users h*P Regular User Priority User 2003050Number of Users Time Figure 9: SIR and power levels at the base station (or prices) of two selected users from priority and regular user groups versus time. simulation. In Figure 9, it is observed that a priority user always obtains a higher SIR than a regular user. Another observation is that priority users use a higher power level, and therefore pay more than regular users, as expected. The uctuation in the power levels is due to the varying number of users, and varying total demand for SIR in the system. 7 Conclusion In this paper, we have developed a mathematical model within the framework of noncooperative game theory, and have obtained distributed, asynchronous control mechanisms for the uplink power control problem in a single cell CDMA wireless network. Existence of a unique Nash equilibrium has been proven, and convergence properties of parallel and random update schemes have been investigated analytically and numerically. Moreover, conditions for the stability of the unique equilibrium point under the update algorithms have been obtained and analyzed accordingly. We have shown that the unique Nash equilibrium has the property that, depending on the parameter values, only a subset of the total number of mobiles are active. Some of the users are dropped from the system as a result of the power optimization. By dening a utility function and a utility parameter, user requests for SIR were modeled dynamically. Furthermore, the relationship between the SIR level of the users and the pricing has been investigated for two dierent pricing schemes for the xed and varying utility cases. It has been shown both analytically and through simulations that choosing an appropriate pricing strategy guarantees meeting the minimum desired SIR levels for the active users in the xed-utility case. In addition, the principles for an admission scheme have been investigated under the market-based scheme. The results obtained indicate that the proposed framework provides a satisfactory decentralized and market-based solution. The algorithms in this model are practically implementable, as the only information a user requires to update its power other than own preferences and xed parameters is the total received power level from the base station. This information may be conveyed incrementally to reduce the overhead in the case of frequent updates. Although a specic cost structure is chosen in this paper, most of the results may be extended to more general cost functions. Another possible extension to this work is to a multiple cells model, where the eect of neighboring cells are taken into account. A further topic of interest is the development of the counterparts of the results in the case of multiple base stations, which brings up the challenging issue of hando. --R Principles and Practice CDMA Principles of Spread Spectrum Communication Computer Networks: A system approach New York Probability and Measure --TR CDMA Non-cooperative uplink power control in cellular radio systems Computer networks Communications --CTR Patrick Maill , Bruno Tuffin, The Progressive Second Price Mechanism in a Stochastic Environment, Netnomics, v.5 n.2, p.119-147, November Haitao Lin , Mainak Chatterjee , Sajal K. Das , Kalyan Basu, ARC: an integrated admission and rate control framework for CDMA data networks based on non-cooperative games, Proceedings of the 9th annual international conference on Mobile computing and networking, September 14-19, 2003, San Diego, CA, USA Haitao Lin , Mainak Chatterjee , Sajal K. Das , Kalyan Basu, ARC: An Integrated Admission and Rate Control Framework for Competitive Wireless CDMA Data Networks Using Noncooperative Games, IEEE Transactions on Mobile Computing, v.4 n.3, p.243-258, May 2005 A. Siris, Resource Control for Hybrid Code and Time Division Scheduling Wireless Systems, Wireless Personal Communications: An International Journal, v.40 n.2, p.171-184, January 2007 Jianwei Huang , Randall A. Berry , Michael L. Honig, Auction-based spectrum sharing, Mobile Networks and Applications, v.11 n.3, p.405-418, June 2006 Sarah Koskie , Zoran Gajic, A Nash game algorithm for SIR-based power control in 3G wireless CDMA networks, IEEE/ACM Transactions on Networking (TON), v.13 n.5, p.1017-1026, October 2005 Altman , T. Boulogne , R. El-Azouzi , T. Jimnez , L. Wynter, A survey on networking games in telecommunications, Computers and Operations Research, v.33 n.2, p.286-311, February 2006
game theory;CDMA;power control;pricing;resource allocation
603891
Multivariate locally adaptive density estimation.
Multivariate versions of variable bandwidth kernel density estimators can lead to improvement over kernel density estimators using global bandwidth choices. These estimators are more flexible and better able to model complex (multimodal) densities. In this work, two variable bandwidth estimators are discussed: the balloon estimator which varies the smoothing matrix with each estimation point and the sample point estimator which uses a different smoothing matrix for each data point. A binned version of the sample point estimator is developed that, for various situations in low to moderate dimensions, exhibits less error (MISE) than the fixed bandwidth estimator and the balloon estimator. A practical implementation of the sample point estimator is shown through simulation and example to do a better job at reconstructing features of the underlying density than fixed bandwidth estimators. Computational details, including parameterization of the smoothing matrix, are discussed throughout.
Introduction The kernel density estimator has become a staple in the data analysis tool box largely because of the flexibility and generality of the method. Much research has been done on the theoretical properties of the kernel estimator and the superiority over such naive estimators as histograms is well-established. With cross-validation (Rudemo, 1982; Bowman, 1984) and plug-in (Sheather and Jones, 1991) rules for choosing smoothing parameters, data- driven, automatic bandwidth selection has achieved a certain level of maturity. Rules for choosing bandwidths are generally based on the relatively simple but important idea of balancing bias and variance globally. This idea works well for most regular densities, i.e. those densities that are unimodal and are not extremely skewed. Consider the multivariate kernel density estimator given by =n is a d-variate random sample with density f . The kernel, K, is taken to be a d-variate density function with I d . The contours of the kernel are restricted to be spherically symmetric and the smoothing parameter, h, controls the size of the kernels. Straightforward asymptotic approximations yield integrated squared bias (ISB) and integrated variance (IV) equal to nh d and Z R K 2 (w)dw, tr indicates the trace of a matrix, and 5 2 f(x) is the Hessian (matrix of second partial derivatives) of f . Combining these terms yields an estimate of the mean integrated squared error, dx. The optimal bandwidth can then be easily derived and is equal to oe 4 This choice of h yields an For a univariate standard normal distribution, the globally optimal smoothing parameter for a sample of size 0:421. This value reflects the best trade-off between variance and bias for this density and sample size. Interestingly, the optimal smoothing parameter for the region near the mode, (\Gamma1; 1), is slightly smaller than the global bandwidth. For either of the tails (-1,-1) and (1,1), the optimal bandwidth is larger, reflecting the sparseness of data and an attempt control the higher variability in the tails. Ultimately, the global bandwidth is closer to the bandwidth optimal for the mode as the largest contribution to the error comes from the area near the mode. The effect of the tails is not substantial enough to greatly influence the global bandwidth. As the dimensionality increases however, the so-called curse of dimensionality becomes influential. The effect on multivariate density estimates is well noted (Friedman and Stue- zle, 1981, and Scott and Wand, 1991). Due to the sparseness of data in higher dimensions, multivariate neighborhoods are generally empty, particularly in the "tails" of the density (Exercise 4.1 in Wand and Jones, 1995). Furthermore, there is less probability mass near the mode. Not only does this have the effect of slowing the convergence rate of the MISE as dimensionality increases, but the relative contributions of variance and bias change. In the univariate setting, the ratio of bias to variance is 4:1. For general dimensions, this ratio is 4:d. Hence, as the dimension increases, larger and larger bandwidths are necessary to control the increased variability, particularly the contributions from the tails. However, this also has adverse effect of averaging away features near the modes. Sain and Scott (1996) give another example of where this trade-off between variance and bias fails. Consider a bimodal normal mixture of the form 1=4OE 1=3 normal density with mean and variance oe 2 . This mixture is characteristic of a density that is difficult for the kernel estimator in that the modes are of equal height but have differing scales. The globally optimal smoothing parameter of a sample of size 0:248. Considering the sample sizes associated with each mode, the optimal smoothing parameters are Again, the global value reflects an attempt to find some sort of middle ground between what is optimal for each mode. However, this value of h will undersmooth or oversmooth, depending on the mode, and the analyst will be faced with the difficult decision of choosing which features are real and which are noise. Graphical ideas such those proposed by Minnotte and Scott (1993) and Chaudhuri and Marron (1997) have proven to be effective aids for exploring structure in univariate multi-modal densities. Both approaches use a family of kernel estimates, where the bandwidth is allowed to range from small to large. These methods are attractive in that they allow the user to change "resolution" by focusing on large bandwidths to gain insight into general structure and then smaller bandwidths for finer detail. However, they serve to emphasize the lesson that a single smoothing parameter can be ineffective for more complex densities. There are proposals to vary the amount of smoothing in some fashion. Intuitively, the task seems straightforward. More smoothing is necessary where data are scarce (i.e. tails and valleys) and less smoothing is necessary near modes. However, it is not so easy as to model the bandwidth function on the level of the underlying density alone. Some attempt to account for the curvature must be made as well (Sain and Scott, 1996). Actually, it has proven difficult to gain understanding of exactly how to vary the bandwidth and, further- more, how to apply this understanding to varying the bandwidth in practice, particularly in the multivariate case. In this paper, variable bandwidth estimators will be studied in the multivariate setting, building on the work of Terrell and Scott (1992) and Sain and Scott (1996). Following a brief introduction to the issues involved with a more general fixed bandwidth multivariate kernel estimator (Section 2), a comparison of two common approaches to variable bandwidth estimators is presented (Sections 3 and 4). Finally, a brief discussion of some of the issues and problems of variable bandwidth estimation in practice is presented in Section 5. Fixed Bandwidth Estimators The general multivariate kernel density estimator is given by K(H \Gamma1=2 Unlike (1) the smoothing parameter, H, is actually a symmetric positive definite matrix that is analogous to the covariance matrix of K. Hence, KH Straightforward asymptotic analysis involving multivariate Taylor's series expansions can yield an estimate of the MISE. Following Scott (1992) or Wand and Jones (1995), an asymptotic approximation of the MISE is given by Z indicates the determinant of a matrix. Choosing the form of H depends on the complexity of the underlying density and the number of parameters that must be estimated. Wand and Jones (1993) give an excellent discussion of the issues in the bivariate case. There are three primary classes for parameterizing the smoothing matrix. Assuming that K is a multivariate normal kernel, i.e. x=2), the first class was introduced in (1). This kernel has contours that are restricted to be spherically symmetric and it has only one independent smoothing parameter. In keeping with the notation of Wand and Jones (1993), this class will be denoted as H 1 where H The second class, H 2 , allows kernels that are ellipsoidal. However, the axes are restricted to be parallel to the coordinate axis. Here, d independent smoothing parameters are allowed diag indicates a diagonal matrix. This class is commonly referred to as the product kernel estimator and allows different amounts of smoothing in each dimension. The optimal bandwidths, h are still proportional to n \Gamma1=(d+4) and the AMISE is of the same order as H 1 . However, some gain can be obtained by using different smoothing parameters for each dimension, especially when the scales of the variables differ. The final class, in which a full smoothing matrix is employed, involves d(d independent smoothing parameters and is denoted as H 3 . This class allows ellipsoidal kernels of arbitrary orientation and is given by Unfortunately, there is no closed form expression for the optimal smoothing matrix in this case. Numerical methods are required to find H for a candidate density and a particular sample size. If the underlying density has spherically symmetric contours (such as the standard nor- mal), then the optimal smoothing matrix for each class will be the same, i.e. proportional to the identity matrix. However, it is an interesting exercise to compare the smoothing parameterizations in other cases in order to evaluate the gain in terms of the AMISE, as well as developing some understanding how the smoothing matrix adapts to the shape of the density for each class. Consider the case of a bivariate normal density centered at the origin with oe 0:6. The sample size is In this case, the optimal bandwidth matrices for each class are given by 1:0 0:0 0:0 1:0 0:5 0:0 0:0 2:0 0:625 0:75 0:75 2:5 for smoothing matrices in H 1 , H 2 , and H 3 , respectively and a standard normal kernel. Note that these smoothing matrices are written in the form h controls the size of the kernel and A controls the orientation (see Scott, 1992). The most restrictive case of a single smoothing parameter yields a smaller kernel as it tries to adjust to the structure of the density, e.g. different scales and the correlation. Both H 2 and H 3 correctly adjust for scale as the squared smoothing parameters are four times larger in the second dimension. The unrestricted kernel, H 3 , has the largest area suggesting a trade-off between the flexibility to model the orientation and scale of the density and the size of the kernel. The unrestricted and the product kernel estimators yield AMISE values that are 30% and 16% smaller than using just one smoothing parameter. In practice, a common approach is to scale the data so that the sample variances are the same in each dimension or to sphere the data in which a linear transformation is applied that yields an identity sample covariance matrix. These approaches are essentially dimension reduction ideas as they allow for the use of a single smoothing parameter with the transformed data. However, Wand and Jones (1993) urge caution when using these approaches as they are not guaranteed to give the correct transformation or rotation to achieve the gains possible by using the full smoothing matrix. Many authors have noted that for most densities, in particular unimodal ones, allowing different amounts of smoothing for each dimension (the product kernel estimator) is adequate. With more complex densities, especially multimodal ones, the situation is less clear, although rotations can help if the structure of the distribution can be aligned with the coordinate axis (Wand and Jones, 1993). 3 Locally Adaptive Density Estimation It is conceivable to consider a bandwidth function that adapts to not only the point of estimation, but also the observed data points and the shape of the underlying density. As a matter of practice, however, two simplified versions have been studied. The first varies the bandwidth at each estimation point and is referred to as the balloon estimator. The second varies the bandwidth for each data point and is referred as the sample-point estimator. See Jones (1990) for a detailed comparison of the two estimators in the univariate case. 3.1 Balloon Estimators The general form of the balloon estimator is given by where H(x) is the smoothing matrix for the estimation point x. Considered pointwise, the construction of this estimator is the same as the fixed bandwidth estimator given in (2). For each point at which the density is to be estimated, kernels of the same size and orientation are centered at each data point and the density estimate is computed by taking the average of the heights of the kernels at the estimation point. This type estimator was introduced by Loftsgaarden and Quesenberry (1965) as the kth nearest neighbor estimator. While not generally considered a kernel estimator directly, it can be be written as in (4) by taking K to be a uniform density on the unit sphere and by restricting the smoothing matrix to H 1 . Thus, the bandwidth function can be written as which measures the distance from x to the kth nearest data point. Much has been written about the kth nearest neighbor estimator and it seems clear that it is not an effective density estimator in the univariate case. The bandwidth function is discontinuous and these discontinuities manifest themselves directly in the density estimate (Silverman, 1986). Furthermore, the estimator suffers from severe bias problems, particularly in the tails (Mack and Rosenblatt, 1979; Hall, 1983; Terrell and Scott, 1992). However, Terrell and Scott (1992) show that the kth nearest neighbor estimator improves as dimensionality increases and will perform well in dimensions greater than 4. Terrell and Scott (1992) also study error properties of the general balloon estimator and found some remarkable results. Applied pointwise, the balloon estimator behaves just like the fixed bandwidth estimator. The authors show that by choosing the orientation of the smoothing matrix appropriately, the bias can be dramatically reduced. In fact, the bias will be of higher-order. In the following, this important result of Terrell and Scott (1992) will be outlined with some extensions not shown in that paper that will allow comparison with the sample point estimator. Consider using (4) pointwise with 1. For notational conve- nience, the argument of H will be dropped in the following. Here, h controls the size of the kernel and A the orientation. Then, an asymptotic approximation for the bias can be written as where S x is the matrix of second partial derivatives of the underlying density. Terrell and Scott (1992) look at three cases based on the form of S x . To demonstrate, consider f to be a bivariate standard normal density and K a bivariate standard normal kernel. In the first, S x is assumed to be positive or negative definite. No choice of A will make the asymptotic bias equal to zero and the best possible asymptotic mean square error is O(n \Gamma4=(d+4) ), the same order as the fixed bandwidth estimator. In the example, this case corresponds to points inside the unit ball, A is chosen to minimize the bias and is a solution to AA x . Given the form of A, h is computing by minimizing the resulting pointwise AMSE, resulting in The second case corresponds to the density being saddle shaped with some eigenvalues of S x being positive and some negative. In this case, it can be shown that by properly choosing A, the leading of the bias can be made to be zero. In the example, this corresponds to points outside the unit ball, jjxjj ? 1. Choose A to be of the form is the absolute value of the eigenvalues of S x , O is the matrix of eigenvectors of S x , and a is chosen such that finding A in this fashion, h can be chosen to minimize the AMSE. To determine the AMSE and the resulting value of h, the fourth order terms in the Taylor's series expansion of the expectation in the bias must be considered. The expectation is given by K(h Z Z Z is the ijth element of A, and f i represents the ith partial derivative of f with respect to x i . By the assumptions on the kernel and the proper choice of A, the expectation reduces to f ijkl Z Z yielding a bias of O(h 4 ). Writing the bias as where C(f; K) is a constant dependent on the mixed fourth-order partial derivatives of f evaluated at x and the mixed fourth-order moments of K and combining the bias with the asymptotic expression for the variance, the pointwise MSE for points outside the unit ball is given by Taking the partial derivative with respect to h, setting to zero, and solving for h gives The third case corresponds to S x being positive or negative semidefinite, with some eigenvalues equal to zero. Hence, the Hessian is of lower rank and the bias is of higher order (with proper choice of A). This corresponds to points in the example on the unit circle, Unfortunately, there is no closed form expression for the MISE that can be computed from these expressions for the optimal pointwise smoothing matrices. However, as Terrell and Scott (1992) point out, the asymptotic MSE can be numerically integrated to study the behavior of the balloon estimator. 3.2 Sample-Point Estimators The multivariate sample-point estimator is given by where H(x i ) is the smoothing matrix associate with x i . The sample-point estimator still places a kernel at each data point, but these kernels each have their own size and orientation regardless of where the density is to be estimated. This type of estimator was introduced by Breiman, Meisel, and Purcell (1977) who suggested using H(x i is the distance from x i to the kth nearest data point. Asymptotically, this is equivalent to choosing h(x i d is the dimension of the data. Abramson (1982a,b) suggested the square-root law, i.e. setting in practice, using a pilot estimate of the density to calibrate the bandwidth function. This formulation of the bandwidth function has been popular in no small part due to the early results that show that the bias associated with the square-root law was of higher order (Silverman, 1986; Hall and Marron, 1988; Jones, 1990). However, recent work has shown that this early result may not always hold due to bias contributions from the tails (Hall, 1992; McKay, 1993; Terrell and Scott, 1992; Hall, Hu, and Marron, 1994; Sain and Scott, 1996). The square-root law suffers from bias properties that can diminish the gains of varying the bandwidth asymptotically, but it also suffers from a certain inflexibility by restricting the bandwidth function to be only a function of the height of the density. Sain and Scott introduce a binned version of the sample-point estimator that uses a piecewise constant bandwidth function in an attempt to provide a more general study of the properties of the estimator. In that work, the authors showed that the estimator did not exhibit a higher-order MISE but it did lead to substantial improvement over the fixed bandwidth estimator in the univariate case. A multivariate version of the binned sample-point estimator is given by is the number of data points in the jth bin, t j is the center of the jth bin, and is the smoothing matrix associated with the jth bin. In general, an equally spaced mesh of points is laid down over the support of the density to define the bins, although other binning rules such as the linear binning defined in Hall and Wand (1996) could be considered. Binning has been used in density estimation for a variety of reasons. Hall (1982) studied rounded and truncated data. Silverman (1982), Hardle and Scott (1992), Wand (1994), and Hall and Wand (1996) use binning as a device that can radically reduce computing time. Scott and Sheather (1985) build on the result of Hall (1982) and show that binning results in an inflated bias but that the MISE is insensitive to reasonable amounts of binning. For adaptive estimation, binning becomes much more than a computational tool. Computing the bias of an adaptive estimator is difficult, if not impossible, without specifying the form of the bandwidth function as was done with the square root law. Through binning, the expectation of the estimator in (6) is easy to compute by noting that the only random quantities are the n These counts can be thought of as a realization of a multinomial distribution with parameters R denotes that jth bin. Assuming that K is a multivariate normal kernel and following Sain and Scott (1996), the MISE of the multivariate binned-sample point estimator is given by Z Z Z \Gamman Z Z Note that the normal integrals follow directly from formulae such as those presented in the appendices to Wand and Jones (1995). By specifying f , usually as some sort of normal mixture, the probabilities can be computed and then the MISE function optimized over the collection of smoothing matrices H 4 A Comparison of Variable Bandwidth Methods Comparing optimal bandwidth functions for the balloon and the sample-point estimator is a difficult task, especially in the multivariate setting. However, developing an understanding of how optimal smoothing parameters behave will yield insight, particularly when designing practical algorithms. It would seem reasonable that there is some sort of fundamental relationship between the two methods, at least asymptotically. Sain and Scott (1996) noticed some similarities between the sample-point estimator and the so-called zero-bias bandwidths discussed by Hazelton (1996), Sain and Scott (1997), and Devroye (1998). However, for finite multivariate samples, some differences appear. To illustrate, let f to be a bivariate standard normal and let K also be standard normal. Figure 1 display optimal kernels for the fixed bandwidth estimator, the balloon estimator and the binned sample-point estimator using an equally spaced mesh with 9 bins per dimension. Two versions of the sample-point estimator are considered. One restricts the contours of the kernels to be circular (H 1 ) while the second allows unrestricted size and orientation (H 3 ). Optimal kernels were computed using the formulae and techniques discussed in the previous sections. Four cases are considered, corresponding to bins centered at the origin and along the x-axis at 0.9, 1.8, and 2.7. These correspond to the mesh for the sample-point estimator being laid down on the square defined by (\Gamma3; 3). Since the contours of the density are radially symmetric, it follows that the contours of the optimal kernels centered at different bins, but at the same distance from the origin, will behave similarly. Figure 1: Optimal kernels for a fixed bandwidth estimator (solid line), balloon estimator (dotted lines), sample-point estimator with the smoothing matrix restricted to H 1 (short dashed lines), and sample-point estimator with an unrestricted smoothing matrix (long dashed lines). Ellipses are 95% contours of the kernels. The optimal kernel for the fixed bandwidth estimator has contours that are circular regardless of where the density is being estimated, which data point, or which parameterization of the smoothing matrix is used. The 95% contour of this kernel is plotted in Figure 1 as a solid line. It is centered at the origin as a reference and an indication of scale for the variable bandwidth kernels. When examining the optimal kernels for the balloon estimator and the sample-point estimator, it is important to keep in mind the construction of the estimator. For the balloon estimators, the plotted kernels are centered at the estimation point, but the density is constructed by centering the kernels at each data point. For the binned-sample point estimator, the density is estimated by placing a weighted kernel at the center of the bin with each bin having a different size and orientation. In practice, the kernels are assumed to be the same for each data point in the bin. First, consider the kernels at the origin (jjxjj = 0:0) in Figure 1. All of the kernels are circular which is no surprise considering the structure of this density at the origin. However, all of the variable bandwidth kernels are smaller than the fixed bandwidth kernel. In the next plot, 0:9, the center of the bin is still within the unit circle. The fixed bandwidth kernel is still much larger than the sample-point kernels which are still roughly circular. The balloon estimator kernel is already adjusting to the local curvature and the major axis of the ellipse is parallel to the line between the origin to the center of the bin. The third plot, shows the kernels for the bin just outside the unit circle. Now the variable bandwidth kernels are much larger than the fixed bandwidth kernel. However, a distinct change in orientation is noted between the balloon kernel and the unrestricted sample-point kernel. Recall the balloon kernel has higher-order bias in this region and is based on the fourth-order derivatives of the density. Hence, the orientation changes, with the major axis of the ellipse being perpendicular to the line between the origin and the center of the bin. The major axis of the unrestricted kernel retains the lower-order bias behavior with the major axis of the kernel parallel to the origin. Moving even further out into the tails of the density, 2:7, the variable bandwidth kernels dwarf the fixed bandwidth kernel, with the restricted sample-point kernel being exceptionally large. This phenomenon is explained by the sample-point estimator with the restricted kernels attempt to minimize variability in the tails by trading a much larger size for the correct orientation. Note that the kernel for the sample-point estimator is much larger than the balloon estimator kernel. The binned sample-point estimator allows head-to-head comparisons between a general sample-point estimator and the fixed bandwidth estimator or the balloon estimator. In actuality, the binned sample-point estimator is not entirely general in that the smoothing matrix is assumed to be constant for all data points in a particular bin. However, through the optimization, the smoothing matrices are allowed to adapt to level and curvature, something that the square-root law cannot accomplish. Estimator Bins per Dimension Fixed Table 1: MISE values for fixed and sample-point adaptive methods using a normal kernel with H 1 and a N(0; I d ) density. Sample size is Scott and Sheather (1985) and Hall and Wand (1996) showed that binning can inflate the bias. Sain and Scott (1996) showed that the binned sample-point estimator needed enough bins to counteract this bias and give sufficient flexibility to improve on the fixed bandwidth estimator. The same is true in the multivariate case. In fact, Table 1 shows that more bins per dimension may be needed to achieve that same gain. Table 1 is based on a multivariate standard normal density and 100. For the fixed bandwidth method, the MISE was computed using the expressions derived by Worton (1989) and Marron and Wand (1992). The kernels for the binned sample-point estimator were restricted to be spherically simplicity. An equally spaced mesh was laid down over the approximate support of the density (assumed to be (-3,3) in each dimension for consistency). What is clear from Table 1 is that considerable gain in terms of the MISE can be achieved with a relatively small number of bins per dimension and restricting the shape of the kernels. For using only 5 bins was actually worse than the fixed bandwidth estimator. However, for using 5 bins per dimension (125 total bins) was able to achieve some gain over the fixed bandwidth estimator. Using bins achieved a 44% gain in MISE for This suggests that it may be necessary to use more bins per dimension or use the more general smoothing matrices for each bin. In Table 2 MISE values are also computed for the bivariate standard normal. However, a sample-point estimator included that allows unrestricted smoothing matrices. A considerable gain in terms of the MISE is realized as the restriction on the kernels is removed. The restricted kernel sample-point estimator with bins leads to a 29% improvement in the MISE while the unrestricted smoothing matrices leads to a 51% reduction in the MISE. Fixed Balloon Table 2: MISE values for fixed, sample-point, and balloon estimators using a normal kernel and a N(0; I 2 ). For the sample-point estimator, The binned sample-point estimator also allows a direct comparison with the balloon estimator. In this case, the unrestricted sample-point estimator actually gives a slight improvement over the balloon estimator. This implies that the sample-point estimator is doing a better job even near the mode which is the only place the estimators actually compete as the balloon estimator is of higher order in the tails. The results also suggest that it is not a small sample curiosity as the improvement is also achieved for the more moderate sample size of n = 1000. However, for larger d, the results will likely change as the impact of the tails (where the balloon estimator is of higher order) becomes more pronounced. While varying the bandwidth can aid in combating the curse of dimensionality, the real power of the sample-point estimator may lie in the ability to model more complex, multimodal distributions. Consider the normal mixture density, labeled "K" in Wand and Jones (1993). This is a bivariate, trimodal density comprised of three normal components with parameters p3 p3 Contours of this mixture are shown in the left frame of Figure 2. This density poses problems for the fixed bandwidth kernel, even with unrestricted orientation because the covariance structure of the entire density is not far from the identity. The modes, however, have varying heights and different covariance structures. Table 3 shows a comparison of the MISE for a fixed kernel estimator with a smoothing Estimator MISE Fixed Table 3: MISE values for fixed and sample-point estimators using a normal kernel and a trimodal normal mixture. Sample size is matrix in H 1 and a unrestrictive smoothing matrix in H 3 . The sample point estimator with bins per dimension is also considered for the two smoothing matrix struc- tures. The results for the two parameterizations of the fixed bandwidth estimator are not terribly different with a slight improvement going to the unrestricted smoothing matrix. However, allowing the kernels to vary can lead to significant reduction in the MISE. Even just allowing the size of the kernels to vary can give significant gains with the restricted sample-point estimator giving a 35% reduction in the MISE. Contours of the optimal band-width function are shown in the right frame of Figure 2. The roughness of the contours is due to interpolating the piecewise constant bandwidth function. However, it is clear from the contours that the size of the kernels mirror the shape of the density. What is difficult to discern from the plot, however, is that the kernels are not adapting simply based on heights alone. Curvature is also taken into account as the kernels near the left mode (first component of the mixture) are much smaller than the those near the top right mode (second component of the mixture) despite the similar heights of these modes. Finally, the unrestricted sample-point estimator yields even more promising results and has a MISE that is 62% smaller than the unrestricted fixed estimator. 5 Practical Algorithms The previous section shows that varying the bandwidth in some fashion can lead to substantial theoretical gains. Designing a practical, data-based algorithm to realize these gains in practice is a difficult task. There are many more things to consider than in the univariate case, not least of these is estimating the bandwidth function and parameterization of the Figure 2: Contours of normal mixture distribution (left frame) and contours of the optimal bandwidth function (right frame) for the binned sample-point estimator kernels. For example, the balloon estimator is attractive for a variety of reasons. It has tremendous potential when good pointwise estimates of the density in the tails are required. How- ever, the orientation of the balloon kernel leading to a higher-order bias requires knowledge of the fourth order derivatives. A pilot estimate could be used to calibrate the kernels, as suggested by Terrell and Scott (1992), but estimating fourth-order derivatives is generally perceived as harder than estimating the density itself and the gains from adaptivity would be overwhelmed from the error in estimating the derivatives. For the sample-point estimator, there are currently no asymptotic approximations to the MISE that would allow a plug-in style bandwidth selector. This is due in part to the traditional asymptotic approximations and the inability to model the behavior of the optimal bandwidth function (Sain and Scott, 1996). However, least-squares cross-validation offers a method that is an unbiased estimate of the MISE and does not rely on an asymptotic approximation. It was also shown in Sain and Scott (1996) to perform well in the univariate setting at estimating the optimal bandwidth function. Hence, it will be used as a test case to illustrate some of the difficulties that may be encountered. Least-squares cross-validation, also referred to as unbiased cross-validation (UCV), was introduced by Rudemo (1982) and Bowman (1984) and is an approximation of the integrated squared error. On average, this criterion is equal to the MISE; hence the term unbiased cross-validation. In this setting, the UCV function is given as where and Note that this is not a fully binned version of UCV because the actual data are used in the estimation of the cross-product. As with the expression for the MISE, the bin counts are computed and then the criterion minimized over the space of the smoothing matrices, m. As an illustration, consider the lipid data of Scott, et al. (1978). These data consist of measurements of cholesterol and triglycerides for 320 men diagnosed with coronary artery disease. The original paper showed that the data were bimodal, indicating an increased risk for heart disease associated with increased cholesterol level. Further study of the data reveals the potential of a third mode. Figure 3 shows a scatterplot of the data with the mesh used to bin the data for the sample point estimator shown by the dotted lines. An 11\Theta11 mesh was used; only the bins with data are indicated on the plot. Note that the data were scaled to have zero mean and unit variance in each dimension. Figure 4 shows perspective and contour plots for a fixed bandwidth estimator using a smoothing matrix in H 1 . The smoothing parameter was selected by cross-validation. The estimate shows evidence of two distinct modes, while the third mode is marginal. There is also a considerable amount of noise exhibited by spurious modes in the tails. Figure 3: Scatterplot of cholesterol and triglyceride levels for males with heart disease. The grid indicates the mesh used for the sample-point estimator. The data have been scaled to have zero mean and unit variance in each dimension. -22 -22 Figure 4: Perspective and contour plots of the fixed bandwidth (H 1 ) estimate for the lipid data. The bandwidths for the sample-point estimate with smoothing matrices restricted to are shown in Figure 5. The observed pattern is consistent with intuition, having larger bandwidths in the tails and smaller near the modes. The estimate is shown in Figure 6 and initially appears oversmoothed. However, the modes are actually more pronounced (higher) and there are three clear modes in the adaptive estimate. There is also little evidence of the spurious modes in the tails of the distribution. The resulting estimator achieves the goals of the adaptive procedure, namely to correctly emphasize features (both heights and positions of modes) while minimizing noise and spurious modes. Figure 7 shows the sample-point estimate using unrestricted kernels (H 3 ) chosen by UCV. Unfortunately, this estimate does not reflect the promise of the MISE results in the previous section. The estimate is quite rough with many spurious modes. To determine the cause, consider an examination of the estimated kernels. Those kernels near the modes are shown in Figure 8. Here, the source of the difficulties can be found. Many of the appear close to degenerate and most seem to have wildly varying orientations. This may be an artifact of the well-established aggressive behavior of cross-validation to yield highly variable bandwidths that are often much smaller than optimal. Unfortunately, there are just too many parameters to estimate, in this case 48\Theta3=144, for such a moderate sample size. Clearly, attempting to estimate the fully parameterized smoothing matrices will require much more data or a more stable procedure. One way to reduce the dimensionality of the problem is based on the notion that the fixed bandwidth procedure is adequate for unimodal distributions. Hence a pilot estimate could be used to calibrate the bandwidth function, using the same bandwidth for each data point near a sample mode. An example is shown in Figure 9. Here the fixed bandwidth estimate from Figure 4 is used to partition the data. There are 16 sample modes in the estimate. Each data point is assigned to the nearest mode and each mode is assigned a separate smoothing parameter. This has the effect of defining a piecewise constant bandwidth function; only now the mesh is not equally spaced. Figure 9 shows the estimated bandwidths using the restricted smoothing matrices (H 1 ). The behavior is as expected with smaller bandwidths near dominant modes and larger bandwidths out in the tails. The estimate using these bandwidths is plotted in Figure 2.59 1.86 2.18 1.73 0.7 0.8 1.55 2.09 2.09 2.02 Figure 5: Estimated bandwidths for the restricted sample-point estimate. -22 Figure Perspective and contour plots of the sample-point estimate (H 1 ) for the lipid data. Figure 7: Perspective and contour plots of the estimated density using a fully parameterized bandwidth matrix (H 3 ). -22 Figure 8: Estimated kernels for fully parameterized bandwidth matrix. 1.378 2.2210.3480.4332.9562.3431.901 Figure 9: Left plot: modes and partitions for calibrating the smoothing matrix. Right plot: estimated bandwidths based on the partitions. -22 Figure 10: Perspective and contour plots of the estimated density using the bandwidth function calibrated by the pilot estimate. and it shows the two modes clearly and the third mode is apparent. Most of the variability in the tails is also diminished. While not as good as the sample-point estimate shown in Figure 6, this estimate is still an improvement over the fixed bandwidth estimate, particularly in the tails where the number of spurious modes is reduced. One interpretation of the result is that some improvement can be gained by using a more restrictive bandwidth function that puts the adaptivity where it may be needed the most, that is out in the tails. 6 Conclusions There are two primary points to be made from this work. First, locally adaptive density estimation that allows smoothing to vary in some fashion can lead to substantial gains over fixed bandwidth density estimation and, to some extent, combat the curse of dimensionality. The results are even more promising when the underlying density is complex, exhibiting multiple modes with differences in scale and orientation. Second, it is possible to achieve gains in practice, but it is not necessarily easy and overparameterizing the smoothing matrices is a concern. More work is certainly required in understanding the complex theory behind locally adaptive methods and their connections to mixture models. More work is certainly required in building practical algorithms. Least-squares cross-validation holds a lot of promise, but it certainly has problems as well. This research is blurring the lines between parametric and nonparametric density es- timation. What has been proposed here is certainly inspired by kernel estimators and motivated by a desire to learn more about variable bandwidth kernel estimators and applications in higher dimensions. Kernel estimators already possess a great flexibility, and locally adaptive kernel estimators add significantly to an already rich class. There is some concern as the kernels that not necessarily local. However, there are not any additional assumptions on the underlying density. What has been proposed here also has the flavor of mixture models. Inspired by the desire to parametrically model data that appears to be generated from several subpopula- tions, mixture models have the surprising ability to model distributions whose components are not necessarily in the parametric family of the components of the mixture (see Sain, et al., 1998 for an example in practice, among others). There is other work that is also exploring the connection between kernels and mixtures, for example Priebe (1994) and Marchette, et al. (1996). Finally, much of the work done here required some sort of numerical optimization. Most of this optimization was done in S-Plus using the function nlminb (Statistical Sciences, 1995) which is based on subroutines from the PORT Mathematical Subroutine Library (A.T.&T. Bell Laboratories, 1984). In some cases the gradient was also computed and used in the optimization. As expected, optimizing these criteria is time and cpu intensive, to the point of making these procedures unattractive in some cases for real-time estimation. --R "On Bandwidth Variation in Kernel Estimates - A Square Root Law," "Arbitrariness of the Pilot Estimator in Adaptive Kernel Methods," "An Alternative Method of Cross-Validation for the Smoothing of Density Estimates," "Variable Kernel Estimates of Multivariate Densities," "SiZer for Exploration of Structures in Curves," "Variable Kernel Estimates: On the Impossibility of Tuning the Parameters," "Projection Pursuit Regression," "The Influence of Rounding Errors on Some Nonparametric Estimators of a Density and its Derivatives," "On Near Neighbor Estimates of a Multivariate Density," "On Global Properties of Variable Bandwidth Density Estimators," "On the Accuracy of Binned Kernel Density Estimators," "Improved Variable Window Kernel Estimates of Probability Densities," "Smoothing by Weighted Averaging of Rounded Points," "Bandwidth Selection for Local Density Estimation," "Variable Kernel Density Estimates and Variable Kernel Density Estimates," "A Nonparametric Estimate of a Multivariate Density Function," "A Note on the Bias Reduction in Variable Kernel Density Estimates," "Multivariate K-Nearest Neighbor Density Esti- mates," "Filtered Kernel Density Estimation," "Exact Mean Integrated Squared "The mode tree: A Tool for Visualization of Nonparametric Density Features," "Adaptive Mixtures," "Empirical Choice of Histogram and Kernel Density Estimators," "Outlier Detection from a Mixture Distribution when Training Data are Unlabeled," "On Locally Adaptive Density Estimation," "Zero-Bias Locally Adaptive Density Estimators," Multivariate Density Estimation: Theory "Plasma Lipids as Collateral Risk Factors in Coronary Heart Disease - A Study of 371 Males with Chest Pain," "Feasibility of Multivariate Density Estimates," "A Reliable Data-Based Bandwidth Selection Method for Kernel Density Estimation," "Kernel Density Estimation using the Fast Fourier Transform," Density Estimation for Statistics and Data Analysis "S-PLUS Guide to Statistics and Mathematical Analysis," "Variable Kernel Density Estimation," "Fast Computation of Multivariate Kernel Estimators," "Comparison of Smoothing Parameterizations in Bivariate Kernel Density Estimation," Kernel Smoothing "Optimal Smoothing Parameters For Multivariate Fixed and Adaptive Kernel Methods," --TR On the accuracy of binned kernel density estimators --CTR Anders Adamson , Marc Alexa, Anisotropic point set surfaces, Proceedings of the 4th international conference on Computer graphics, virtual reality, visualisation and interaction in Africa, January 25-27, 2006, Cape Town, South Africa Yaser Sheikh , Mubarak Shah, Bayesian Modeling of Dynamic Scenes for Object Detection, IEEE Transactions on Pattern Analysis and Machine Intelligence, v.27 n.11, p.1778-1792, November 2005
binning;smoothing matrix;mean integrated squared error;cross-validation;variable band-width kernel
603893
Bayesian and likelihood methods for fitting multilevel models with complex level-1 variation.
In multilevel modelling it is common practice to assume constant variance at level 1 across individuals. In this paper we consider situations where the level-1 variance depends on predictor variables. We examine two cases using a dataset from educational research; in the first case the variance at level 1 of a test score depends on a continuous "intake score" predictor, and in the second case the variance is assumed to differ according to gender. We contrast two maximum-likelihood methods based on iterative generalised least squares with two Markov chain Monte Carlo (MCMC) methods based on adaptive hybrid versions of the Metropolis-Hastings (MH) algorithm, and we use two simulation experiments to compare these four methods. We find that all four approaches have good repeated-sampling behaviour in the classes of models we simulate. We conclude by contrasting raw- and log-scale formulations of the level-1 variance function, and we find that adaptive MH sampling is considerably more efficient than adaptive rejection sampling when the heteroscedasticity is modelled polynomially on the log scale.
Introduction Over the past 15 years or so, tting multilevel models to data with a hierarchical or nested structure has become increasingly common for statisticians in many application areas (e.g., Goldstein 1986, 1995; Bryk and Raudenbush 1992; Draper 2000). The main purpose of tting such models is to partition the variation in a response variable as a function of levels in the hierarchy and relate this variability to descriptions of the data structure. In education, for example, multilevel modelling can be used to calculate the proportion of variation in an observation that is explained by the variability between students, classes, and schools in a 3{level nested structure. Random-eects modelling of this kind is generally combined with xed-eects modelling, in which predictors are additionally related to the response variable as covariates. Generally these models assume a constant level{1 variance for the error or residual term for all observations (in our notation students are at level 1 in the 3-level structure above), but there is no reason why this should be true in all applications. An alternative is to allow heteroscedasticity|in other words, to t models that relate the amount of level{1 variability to predictor variables. We will refer to this here as complex level{1 variation. Heteroscedasticity is a common modelling concern in the standard tting of Institute of Education, University of London, 20 Bedford Way, London WC1H 0AL, UK (email [email protected] [WJB], [email protected] [HG], and [email protected] [JR]). y Department of Mathematical Sciences, University of Bath, Claverton Down, Bath BA2 7AY, UK (email [email protected], web http://www.bath.ac.uk/masdd). W. J. Browne, D. Draper, H. Goldstein, and J. Rasbash Table 1: A comparison of means and variances of normalised exam scores for various partitions of the GCSE dataset. Partition Size Mean Variance Whole dataset 4,059 0.000 1.000 Boys 1,623 0:140 1.052 Girls 2,436 0.093 0.940 Standardised LRT < 1 612 0:887 0.731 0:5 < Standardised LRT < 0:1 619 0:191 0.650 0:1 < Standardised LRT < 0:3 710 0.044 0.658 0:3 < Standardised LRT < 0:7 547 0.279 0.659 0:7 < Standardised LRT < 1:1 428 0.571 0.678 1:1 < Standardised LRT 549 0.963 0.703 linear models to data lacking a hierarchical or multilevel structure (e.g., Weisberg 1985), but far less attention has been paid to this topic with multilevel data. As our main motivating example we consider a dataset studied in Rasbash et al. (2000), which was originally analysed in Goldstein et al. (1993). This dataset contains exam results for 4,059 pupils from schools sampled from six inner London Education Author- ities. The response variable of interest is the total score achieved in GCSE examinations (a standardised test taken at age 16 by these pupils). This variable has already been normalised (transformed by replacing each value by its standard normal score) in the dataset we consider. Table contains mean and variance estimates for the response variable for various partitions of the dataset. One of the main predictors of interest is a score on a reading test (LRT) that all pupils took at age 11. For purposes of partitioning we have divided the pupils into 7 groups of roughly equal sample size based on a standardised version of the LRT score. From the mean column of the table it is clear that girls generally do a bit better than boys and that the LRT score is positively correlated with the exam score. It can also be seen that boys' exam scores are slightly more variable than girls' scores and that the variance of the exam score bears a roughly quadratic relationship to LRT score. Both of these conclusions mean that in tting a multilevel model to this dataset it will be worth considering the need for complex variation at level 1. The plan of the paper is as follows. In Section 2 we describe two variations on a maximum-likelihood approach to the tting of multilevel models with complex level{1 variation and examine several examples of complex variance structures. Sections 3 and 4 present a Markov chain Monte Carlo (MCMC) method for Bayesian tting of such models based on adaptive Metropolis-Hastings sampling, using two dierent proposal distribu- tions. In Section 5 we give results from two simulation studies investigating the bias and interval coverage properties, in repeated sampling, of the four tting methods described in the previous three sections. Section 6 examines alternatives (a) to our MCMC methods and (b) to our formulation of complex variance structures, and Section 7 discusses our conclusions and suggests extensions of the work presented here. Fitting multilevel models with complex level{1 variation 3 Maximum-likelihood-based methods and complex variance structures We begin by describing a general 2{level model with complex variation (later sections will examine methods to t alternatives to this general model with additional constraints added). The basic structure for a general Gaussian multilevel model is y N n (X; V Here y is an (n 1) vector of responses, not necessarily independently distributed, with a (p f 1) vector of xed-eect coe-cients of the predictors in the (n n is the total number of level{1 observations in the data set (4,059 students, in the example in Section 1), and p f is the number of xed eects in the model. The (n n) covariance matrix V for the responses contains all the random structure in the model; for the two-level case we can write the variance term V level{2 unit j. In this expression the variance has been partitioned into separate terms for the two levels, with e and u denoting random eects at levels 1 and 2, respectively. The covariances between the responses have the form V ij;i if the two observations are in the same level{2 unit, and V ij;i This means that if the y vector is ordered so that all the observations in each level{2 unit are grouped together, V has a block diagonal form. In this general formulation the level{1 and level{2 variances and covariances are potentially dierent for each pair of observations, but important special cases exist with simpler structure, e.g., variance-components models where both the level{1 and level{ 2 variances are constant across observations. The covariates X may make an appearance in the random structure of the model, leading to a further partition of u;ij . An example is a random-slopes regression model with a single predictor X 1;ij , in which u;ij u;11 . Here u consists of the variance and co-variance terms at level 2 expressed as a matrix (with structural zeroes where neces- sary). Using this notation the (general) within-block covariance term can be written a vector of predictors. In the language of this section, what was referred to earlier as complex variation at level 1 simply means partitioning the level{1 variance so that it depends in a natural way on predictor variables. Figure 1 presents several potential variance structures that can be tted to the GCSE dataset described earlier. The corresponding models are e;ij u;ij e;ij u;ij e;ij 4 W. J. Browne, D. Draper, H. Goldstein, and J. Rasbash Standardised LRT score Levelvariance Model 2 Standardised LRT score Variance Level 1 variance Level 2 variance Standardised LRT score Variance Level 1 variance Level 2 variance Standardised LRT score Variance Model 5 Level 1 variance Boys Level 1 variance Girls Level 2 variance Figure 1: Four dierent variance structures tted to the GCSE dataset. u;ij e;ij In all these models X 1 refers to the standardised LRT score and X 2 refers to gender (coded 0 for boys and 1 for girls). In equation (2) we have a simple one-level regression model with a quadratic variance relationship with LRT; the other models involve tting increasingly complex variance structures to the data in a two-level framework. One approach to tting models such as (2{5) via maximum likelihood (ML) is based on iterative generalised least squares (IGLS), and its restricted variant (RIGLS, also known as REML) which corrects for bias. The basic idea is similar to that of the EM algorithm in that (a) an estimate ^ of in (1) is obtained using a current estimate of V and (b) an estimate of V is then obtained using the ^ from (a), but in IGLS/RIGLS the estimation Fitting multilevel models with complex level{1 variation 5 Table 2: IGLS estimates for models (2{5) tted to the GCSE dataset (standard errors (SEs) in parentheses). Model Parameter (2) (3) (4) (5) u;00 | 0.094 (0.018) 0.091 (0.018) 0.086 (0.017) u;01 | | 0.019 (0.007) 0.020 (0.007) u;11 | | 0.014 (0.004) 0.015 (0.004) e;12 | | | 0.032 (0.013) e;22 | | | 0:058 (0.026) of the covariance matrix V is recast as a regression problem and weighted least squares is used in both steps (see Goldstein 1986, 1989 for details). Table estimates obtained for models (2{5) applied to the GCSE data. Both gender and LRT score are evidently useful in predicting GCSE score. Model (2), which naively ignores the hierarchical nature of the data, hints at heteroscedasticity (the ML estimate of e;11 is about as big as its standard error (SE)), but (from the estimates of u;00 in equations (3{5)) there is a clear need for two-level modelling, and the full complexity of what is required to describe the data only comes into focus with model (5) (in which every estimate is at least 2.2 times as large as its SE). 3 An MCMC method for a general 2{level Gaussian model with complex level{1 variation Browne and Draper (2000a and 2000b) gave Gibbs-sampling algorithms for Bayesian tting of 2{level variance-components and random-slopes-regression models, respectively. In this section we consider a general 2{level model with complex variation at level 1; this can easily be generalised to an N{level model via an approach similar to the method detailed in Browne (1998). For MCMC tting of model (1) it is useful to rewrite it as follows, with y ij denoting the (scalar) outcome for (level{1) observation i in level{2 unit (0; (0; e are (p f 1); (p 2 1), and (p 1 1) vectors of xed-eects parameters and level{2 and level{1 residuals, are vectors of predictor values; and p 1 and p 2 are the numbers of parameters specifying the random eects at levels 1 and 2, respectively. The IGLS/RIGLS methods do not directly estimate the but they can be estimated after tting the model using a method given in 6 W. J. Browne, D. Draper, H. Goldstein, and J. Rasbash Goldstein (1995). In equation (6), e and u are the variance terms at level 1 and level Gibbs sampling procedures for tting multilevel models such as (6) proceed most smoothly by treating the level{2 residuals as latent variables when forming the full conditional posterior distributions. In a multilevel model with simple (homoscedastic) variation at level 1, the level{1 residuals may be calculated at each iteration by subtraction. In the above model we cannot explicitly compute the individual level{1 residuals; instead we deal with the \composite" residuals X C these can be calculated by subtraction. The important part of the algorithm that follows is to store the composite level{1 variance function for each individual, All the other parameters then depend on the level{1 covariance matrix e through these individual variances. This means that the algorithm that follows, apart from the updating step for e , is almost identical to the algorithm for the same model without complex variation (Browne 1998). 3.1 Inverse-Wishart proposals for the level{1 covariance matrix In the rst MCMC method examined in this paper, we collect together the terms in the variance equation at level 1, e;ij , into the covariance matrix e . Updating e using a Metropolis-Hastings (MH) algorithm therefore requires a proposal distribution that generates positive-denite matrices (later we will relax this restriction). We use an inverse-Wishart proposal distribution with expectation the current estimate e at iteration t to generate e . In the parameterisation used, for example, by Gelman, Carlin, et al. (1995), the inverse-Wishart distribution W 1 expectation e , where w is a positive integer degrees of freedom parameter, this will produce a distribution with expectation e . The parameter w is a tuning constant which may be set to an (integer) value that gives the desired MH acceptance rate. For prior distributions on the parameters in model (6) we make the following choices in this algorithm: a generic prior e ) (to be specied in Section 4.2) for the level{1 covariance matrix, an inverse-Wishart prior for the level{2 covariance matrix, and a multivariate normal prior N p f for the xed eects parameter vector. The algorithm, which is detailed in the Appendix, is a hybrid of Gibbs and MH steps; it divides the parameters and latent variables in (6) into four blocks and uses multivariate normal Gibbs updates for and the u j , inverse-Wishart Gibbs updates for u , and inverse-Wishart MH proposals for e . 3.2 An adaptive method for choosing the tuning constant w Browne and Draper (2000b) describe an adaptive hybrid Metropolis-Gibbs sampler for tting random-eects logistic regression models. Gibbs sampling may be used in such models for variance parameters, but Metropolis updates are needed for xed eects and latent residuals. Browne and Draper employ a series of univariate normal proposal distributions (PDs) for these quantities, and give a procedure for adaptive choice of appropriate Fitting multilevel models with complex level{1 variation 7 Table 3: An illustration of the adaptive MH procedure with model (4) applied to the GCSE data. Acceptance Within Iterations Rate w Tolerance? 100 20% 138 0 200 19% 195 0 300 30% 208 1 500 30% 229 3 values for the variances of these PDs to achieve e-cient MH acceptance rates. Here we provide a modication of this procedure for the case of inverse-Wishart proposals. We set the tuning parameter w described above to an arbitrary starting value (in the example that follows 100) and run the algorithm in batches of 100 iterations. The goal is to achieve an acceptance rate for the level{1 covariance matrix that lies within a specied tolerance interval (r We compare the empirical acceptance rate r for the current batch of 100 iterations with the tolerance interval, and modify the proposal distribution appropriately before proceeding with the next batch of 100. The modication performed at the end of each batch is as follows: If r r where only the integer part of w is used in (8). The amount by which w is altered in each iteration of this procedure is an increasing function of the distance between r and r . The adaptive procedure ends when three successive r values lie within the tolerance interval; the value of w is then xed and we proceed with the usual burn-in and monitoring periods. 3.3 An example We consider the model in Section 2 which has a quadratic relationship between the variance and the LRT predictor (model (4)). The adaptive procedure was run for this model with a target acceptance rate of (based on a recommendation in Gelman, Roberts and Gilks 1995) and a tolerance of summarises the progress of the adaptive method in this example; here only 500 iterations are required to adjust the proposal distribution to give the desired acceptance rate (500{2000 iterations are typically needed in the applications we have examined). Table 4 compares the estimates produced by this MCMC method for model (4) to those (a) from the IGLS and RIGLS procedures and (b) from another MCMC method to be described in the next section (here and throughout the paper, MCMC point estimates are posterior means). We used a slightly informative inverse-Wishart prior for the level{2 covariance matrix for the MCMC methods based on the RIGLS estimate, and a uniform prior for the level{1 covariance matrix. In this case the results for all the methods are fairly similar, with one exception: the parameter e;11 is noticeably larger using MCMC 8 W. J. Browne, D. Draper, H. Goldstein, and J. Rasbash Table 4: Parameter estimates for four methods of tting model (4) to the London schools dataset (SEs/posterior standard deviations in parentheses). The MCMC methods were monitored for 50,000 iterations after the adaptive procedure and a burn-in of 500 iterations MCMC Method Parameter IGLS RIGLS 1 2 method 1. This dierence highlights the fact that the rst MCMC approach actually ts a model with an extra positive-denite constraint: we are forcing e;11 to be positive, which in ates the point estimate. The second MCMC method, which we consider below, is based on dierent constraints; when we examined the chain of values it produced for e;11 we found that nearly 40% of the values were negative. There is no inconsistency in this result: in the model to be examined in the next section, e;11 is not a variance. 4 Truncated normal proposals for the level{1 variance func- tion The inverse-Wishart updating method assumes that the variance function at level 1 arises from a positive-denite covariance matrix. We now consider an alternative method that, in a manner similar to IGLS and RIGLS, only requires the variance at level 1 to be a linear function of the parameters. This MCMC solution will still have more constraints than the IGLS solution, because we are still considering the level{1 and level{2 variances separately and both of these quantities must be positive. The constraint used in MCMC method 1 that the covariance matrix at level 1 is positive-denite is actually stronger than necessary. Positive-denite matrices will guarantee that any vector X C ij will produce a positive variance in equation (6); a milder but still scientically reasonable constraint is to allow all values of e such that for all i and j. This restriction appears complicated to work with, but if we consider each of the parameters in e separately and assume the other variables are xed the constraint becomes manageable. It is once again useful to rewrite model (1), this time as follows: e (0; where e e;ij is given by equation (7). Here the composite level{1 residuals e are normally distributed with variances that depend on the predictors; consequently Fitting multilevel models with complex level{1 variation 9 the constraint that the level{1 variance is always positive is still satised but e need not be positive-denite. 4.1 MH updating: method 2 Our second method is identical to the rst for , the u j , and in the Appendix) but involves a Hastings update with a dierent proposal distribution for e . We update each parameter in the level{1 variance equation in turn, always requiring for all i and j at every iteration t in the Markov chain that 0: (10) Considering rst the diagonal terms, e;kk , for each can be d C here X C is the kth element of the vector X C ij . This is equivalent to requiring that d C We use a normal proposal distribution with variance s 2 kk but reject generated values that fail to satisfy (12). This amounts to using a truncated normal proposal, as shown in Figure 2(i). The Hastings ratio R can then be calculated as the ratio of the two truncated normal distributions shown in Figure 2(i) and (ii). Letting the value for e;kk at time t be A and the proposed value for time s kk s kk The update step is then as follows: e;kk with probability min4 e;kk otherwise and the corresponding density in the denominator of (14) are given by (28). The diagonal terms are a special case as they are always multiplied by a positive quantity in the variance equation, so that the proposal distribution needs only one truncation point. More generally for the non-diagonal terms e;kl we get the following. As before, at time t for all i and j constraint (10) must be satised; for each 1 k < l p 1 this can be rewritten e;kl d C d C e;kl W. J. Browne, D. Draper, H. Goldstein, and J. Rasbash (iv) Figure 2: Plots of truncated univariate normal proposal distributions for a parameter . A is the current value c and B is the proposed new value . M is max and m is min , the truncation points. The distributions in (i) and (iii) have mean c , while the distributions in (ii) and (iv) have mean . This is equivalent to the two constraints over all (i; j) such that X C e;kl < min e;kl min ij over all (i; j) such that X C We again use a normal proposal distribution, this time with variance s 2 kl , and again values failing to satisfy (16) are rejected. This leads to the truncated normal proposal shown in Figure 2(iii). The Hastings ratio R is then simply the ratio of the two truncated normal distributions shown in Figure 2(iii) and (iv). Letting the value for e;kl at time t be A Fitting multilevel models with complex level{1 variation 11 and the proposed value for time s kl s kl min e;kl A s kl s kl The update step is then similar to (14) with subscripts kl in place of kk in the e terms. 4.2 Proposal distribution variances and prior distributions In the method outlined above we consider each parameter in e separately. This means that we use a separate truncated univariate normal proposal distribution for each parameter subject to the constraints that the value generated will produce a positive level{1 variance e;ij for all i and j. We therefore need to choose a proposal distribution variance for each parameter. Two possible solutions are to use the variance of the parameter estimate from the RIGLS procedure multiplied by a suitable positive scale factor, or to use an adaptive approach before the burn-in and monitoring run of the simulation. See Browne and Draper (2000a) for a description of both of these methods in the case of random eects logistic regression models. Prior distributions using this method must take account of the constraints imposed on the parameters. In all the analyses we perform in this paper with this method, we use a series of marginal uniform priors for the level{1 variance terms subject to the constraints; in other words, all valid combinations of parameter estimates for e are a priori equally likely. Other prior distributions may be problematic. 4.3 Examples Model (4) was tted to the GCSE data in Section 3.3, and the estimates produced by both MCMC methods are shown in Table 4. For the truncated normal method we used the adaptive MH procedure, in this case with a desired acceptance rate of 50% as the parameters are updated separately. The advantage of the truncated normal method is that it can handle variance functions that would not necessarily have a positive-denite matrix form. For illustration we consider a simple case which the inverse-Wishart method cannot t. Our model is as follows: This model includes a variance for boys and a term that represents the dierence in variance between boys and girls. The results from tting this model are given in Table 5; all methods give roughly the same estimates for the level{1 variance terms. The total variances produced by the model for are similar to the values given in the part of Table 1 where the variance in the response is calculated for boys and girls separately. 12 W. J. Browne, D. Draper, H. Goldstein, and J. Rasbash Table 5: Parameter estimates for three methods tted to model (18) for the GCSE dataset. method 2, using truncated normal proposals, was monitored for 50,000 iterations following the adapting period and a burn-in of 500 iterations. MCMC Parameter IGLS RIGLS Method 2 5 Simulation studies In this section we examine the bias and interval-coverage properties, in repeated sampling, of the four methods described above, in two sets of simulated models with complex level{ variation based on the GCSE example. We rst consider model (4), which features a quadratic variance relationship with the input reading test (LRT) predictor. As true (population) parameters for our simulation we used values close to the estimates obtained in the actual data, with one exception: we increased e;11 so that the correlation of the random eects at level 1 was reduced. This is because sample datasets drawn from multilevel models with high correlation cause convergence problems with the IGLS and RIGLS methods (Browne and Draper 2000b). One thousand datasets were generated randomly according to model (4)|with the same numbers of level{1 and level{2 units (4,069 and 65, respectively) as in the original GCSE data set, and the same distribution of level{1 observations within level{2 units|and tted using the four methods, with the results presented in Table 6. For the MCMC methods (in both of the simulation studies) the posterior distribution with each dataset was monitored for 10,000 iterations after the adapting period and a burn-in of 500 from IGLS starting values. Uniform priors were used for the level{1 variances and xed eects. A (slightly) informative inverse-Wishart prior was used for the level{2 co-variance matrix in line with the results in Browne and Draper (2000b). Interval estimates at nominal level 100(1 )% with the IGLS and RIGLS approaches were of the form based on the large-sample normal approximation; this is what users of most multilevel packages such as MLwiN (Rasbash et al. 2000) and HLM (Bryk et al. 1988) would report, if they report interval estimates at all (since such packages routinely only report estimates and standard errors with maximum-likelihood methods). With the Bayesian MCMC methods we give results based on posterior means as point estimates and 90%/95% central posterior intervals. Our second simulation study (Table 7) was based on model (18) from Section 4.3, in which the male and female subsamples had dierent level{1 variances (MCMC method 1 is not available for this model). We again created 1,000 simulation datasets with population values similar to the estimates obtained with the GCSE dataset. With the Bayesian approach to tting, uniform priors were used for the level{1 variances and xed eects, Fitting multilevel models with complex level{1 variation 13 Table Summary of results for the rst simulation study, with LRT score random at levels 1 and 2. Bias results in (a) are relative except those in brackets, which are absolute (the true value in those cases is zero). Monte Carlo standard errors (SEs) in (a) are given in parentheses. The Monte Carlo SEs for the estimated interval coverages in (b) range from 0.7% to 1.0%. (a) Relative bias of point estimates (%) Parameter MCMC MCMC fTrue Valueg IGLS RIGLS Method 1 Method 2 u;00 f0:1g 1:81 (0.59) 0:08 (0.60) 2.79 (0.62) 2.79 (0.62) (b) Interval coverage probabilities at nominal levels 90%/95% MCMC MCMC Parameter IGLS RIGLS Method 1 Method 2 u;00 89.4/93.1 90.7/93.6 91.1/96.0 91.1/96.0 u;01 90.0/94.4 90.3/94.6 88.7/94.1 88.8/94.1 e;00 90.7/94.1 90.7/94.1 90.2/94.1 90.9/94.8 e;11 90.6/95.1 90.7/95.1 90.0/95.0 90.9/95.4 (c) Mean interval widths at nominal levels 90%/95% MCMC MCMC Parameter IGLS RIGLS Method 1 Method 2 14 W. J. Browne, D. Draper, H. Goldstein, and J. Rasbash Table 7: Summary of results for the second simulation study, with separate variances at level 1 for boys and girls. Monte Carlo standard errors (SEs) in (a) are given in parentheses. The Monte Carlo SEs for the estimated interval coverages in (b) range from 0.7% to 1.0%. (a) Relative bias of point estimates (%) Parameter MCMC fTrue Valueg IGLS RIGLS Method 2 (b) Interval coverage probabilities at nominal levels 90%/95% MCMC Parameter IGLS RIGLS Method 2 u00 88.3/92.5 89.2/93.4 90.0/95.3 (c) Mean interval widths at nominal levels 90%/95% MCMC Parameter IGLS RIGLS Method 2 Fitting multilevel models with complex level{1 variation 15 and a 1 (; ) prior (with used for the level{2 variance parameter in line with the results in Browne and Draper (2000a). It is evident from Tables 6 and 7 that all four methods performed reasonably well in both models. RIGLS succeeded in reducing the (already small) biases arising from IGLS estimation in most cases, and the relative biases of the MCMC methods are also small (ranging from 0% to 4.8%, with a median absolute value of 1.5%). Interval coverages for all four methods were all close to nominal, with actual coverages ranging from 86{ 91% and 91{96% at nominal 90% and 95%, respectively; all four methods achieved this level of coverage with intervals of comparable length; and the ratios of 95% and 90% interval lengths for each method were all close to the value ( 1 (0:975) to be expected under normality. The ML methods have the clear advantage of speed (on the original GCSE data set IGLS/RIGLS and MCMC methods 1 and 2 took 2, 168, and 248 seconds on a 500{MHz Pentium PC, respectively, with the MCMC methods based on 10,000 monitoring iterations), but the ML approach has two potential disadvantages: on data sets with small numbers of level{1 and level{2 units, it requires more sophisticated methods for constructing interval estimates for variance parameters (to achieve good coverage properties) than the large-sample normal approximation used here (Browne and Draper 2000ab), and it may fail to converge when the e and/or matrices exhibit a high degree of correlation between the parameters quantifying the random eects. The Bayesian methods are considerably slower but have the additional advantage that inferences about arbitrary functions of the model parameters are automatic once the model parameters themselves have been monitored. 6 Other MCMC methods 6.1 Gibbs Sampling There are special cases of the problem of complex level{1 variation that can be tted using a standard Gibbs sampler. The model (equation 18) used in the second simulation, where we use a dierent level{1 variance term for each gender, is one such example. Here we could reparameterise the model with two variances, one for boys ( 2 b ) and one for girls rather than a boys' variance plus a dierence. Scaled-inverse- 2 priors (see, e.g., Gelman et al. 1995) can be used for these two variances, with parameters respectively. If we divide the children into boys' and girls' subgroups B and G, of size n b and n g , then step 3 of the algorithm given in the Appendix can be rewritten as two Gibbs sampling steps as follows: the full conditional for 2 b is a and the full conditional for 2 g is exactly analogous. Now the level{1 variance is and the other steps of the algorithm are as before. 6.2 Modelling the variance on the log scale The developers of the software package BUGS (Spiegelhalter et al. 1997) use a dierent approach to tting complex level{1 variation in one of their examples, the Schools data W. J. Browne, D. Draper, H. Goldstein, and J. Rasbash set (example 9 in Volume 2 of Spiegelhalter et al. 1996). They model the logarithm of the level{1 precision as a function of predictors and other parameters: (0; This results in a multiplicative, rather than an additive, variance function: exp The advantages of this approach are that the parameters are now unconstrained, the level{ variance will never be negative, and it is easier to specify a prior with this method. The disadvantages are that the interpretation of the individual coe-cients is not as easy and computation for these models is slower. The interpretation di-culty will be apparent mainly when the X variables are categorical. Model (20) can be tted in BUGS using adaptive rejection (AR) sampling (Gilks and Wild 1992). Alternatively the adaptive MH method used in the truncated normal algorithm in Section 4.1 can be used, this time with no parameter constraints and hence no truncation in the normal proposal distributions. Goldstein (1995, Appendix 5.1) shows how to obtain ML estimates for this model; see Yang et al. (2000) for a set of MLwiN macros to do this. To explore the dierences between log-variance modelling and our earlier approach, we tted four dierent level{1 variance functions to the GCSE dataset to model the eect of LRT score (X 1 ) on the level{1 variance. We considered the quadratic relationship examined earlier (model (4)), and the simpler linear relationship e;ij we also considered two exponential relationships: In each of the four models the level{2 variance structure and xed eects were as in equation (4). Figure 3 plots the resulting level{1 estimated variances as a function of LRT score. In this case for the majority of the data the variance estimates produced by all four models are fairly similar, with any discrepancies between the models occurring at the extremes of the LRT range where there are relatively few observations. Table presents estimates of the four models (using MH method 2), together with Raftery-Lewis (1992) default diagnostics (for both MH and AR sampling in the exponential models (23)) and comparative timings. From part (b) of the table it is evident that the parameter with the worst MCMC mixing is the intercept 0 . This means that, although the MH method requires longer monitoring runs than the AR approach for the Fitting multilevel models with complex level{1 variation 17 Standardised LRT score LevelVariance Quadratic Exp. Linear Exp. Quadratic Figure 3: Four ways to model the eect of standardised LRT score on the level{1 variance in the GCSE dataset. level{1 variance parameters, the run lengths required to ensure that all parameter estimates have a specied accuracy (with respect to 95% interval estimation) will be roughly equal. From part (c) of the table it can be seen that the MH approach is 4{9 times faster in real-time execution speed in this example. Results in Table 8 are based on a single data set but are typical of ndings we have obtained with other similar models. 7 Conclusions and extensions In this paper we have presented several methods for modelling non-constant level{1 variance functions with multilevel data. We have introduced two new adaptive Metropolis-Hastings sampling methods for tting such functions subject to dierent constraints. The two methods give similar estimates for models where the true parameter values are not aected by the constraints, but if the true values do not satisfy the additional positive- denite matrix constraint of the inverse-Wishart proposal method then the estimates from the two methods will dier. The main advantage of the inverse-Wishart method is that it models the level{1 variance function as a matrix in a manner analogous to the usual treatment of the level{2 variance function, meaning (among other things) that informative inverse-Wishart priors at level 1 can be used with this approach. The main advantage of the truncated normal proposal method is that it is more general and can deal with any variance function at level W. J. Browne, D. Draper, H. Goldstein, and J. Rasbash Table 8: Parameter estimates for four dierent level{1 variance functions applied to the GCSE dataset and t by MCMC. All methods used a monitoring period of 50,000 iterations after a burn-in of 500 iterations. Methods with an adaptive MH step at level were run using a development version of MLwiN; those with an adaptive rejection (AR) step at level 1 were run in WinBUGS. Posterior standard deviations are given in parentheses in (a). (a) Parameter estimates Exponential Exponential Parameter Linear Quadratic Linear Quadratic e;11 | 0.003 (0.009) | 0:0005 (0.016) (b) Raftery-Lewis values (in thousands of iterations); main entries apply to MH method 2, with the corresponding values for AR in parentheses Exponential Exponential N Linear Quadratic Linear Quadratic u;00 4.3 4.3 4.4 (4.3) 4.3 (4.1) e;11 | 16.9 | 15.6 (4.6) (c) Timings (in minutes at 500 Pentium MHz) Exponential Exponential Method Linear Quadratic Linear Quadratic Metropolis-Hastings 19 20 23 25 Adaptive Rejection | | 95 227 Fitting multilevel models with complex level{1 variation 19 1. Both methods have bias and interval coverage properties that are similar to those from the maximum-likelihood (IGLS and RIGLS) approaches, and all four methods perform satisfactorily in repeated sampling in this regard. In Section 6.2 we considered an alternative formulation of the level{1 variance function in terms of the log of the precision at level 1. This method has two advantages: there is no need to impose constraints on the terms in the resulting variance function, and it is therefore easier to contemplate a variety of prior distributions for the resulting variance parameters. The main disadvantage of this approach is that the individual terms in the variance function may not be as easily interpreted, making it potentially di-cult to construct sensible informative priors. Table 8 shows clearly, however, that adaptive- rejection sampling is much less e-cient than adaptive Metropolis-Hastings sampling to achieve default MCMC accuracy standards with variance (or precision) functions that are exponential in the parameters. There are two obvious extensions of this work, to arbitrary variance structures at higher levels and to multivariate normal responses. Two approaches to tting random eects at level 2 and above appear common in current applied work: modelling all random eects independently, or tting fully dependent random eects with a complete covariance matrix at each level (see the Birats example in Spiegelhalter et al. (1996) for an illustration of both formulations). It is fairly easy to t any block-diagonal covariance structure at a higher level using Gibbs sampling, in a straightforward extension of the approach given in Section 6.1. The adaptive MH sampler with a truncated normal proposal (method 2, Section 4.1) can be used to t any dependence structure among the random eects at the higher levels, including non block-diagonal covariance matrices. With multivariate normal response models the variance function at the lowest level includes variances for each response plus covariances between responses. This variance function could also be extended to include predictors that may in uence the variance of individual responses in an analogous way to the univariate model. We intend to report on MCMC sampling algorithms for general multivariate-response multilevel models elsewhere. Acknowledgements We are grateful to the EPSRC, ESRC, and European Commission for nancial support, and to David Spiegelhalter, Nicky Best, and other participants in the BUGS project for references and comments on the set of multilevel modelling papers based on the rst author's PhD dissertation. Membership on this list does not imply agreement with the ideas expressed here, nor are any of these people responsible for any errors that may be present. Appendix : Details of MCMC method 1 In step 1 of the algorithm described in Section 3.1, the full conditional distribution in the Gibbs update for the xed eects parameter vector is multivariate normal: with p f the W. J. Browne, D. Draper, H. Goldstein, and J. Rasbash number of xed eects, e;ij and e;ij involves a Gibbs update of the level{2 residuals, u j , also with a multivariate normal full conditional distribution: with p 2 the number of parameters describing the random eects at level{2 and n j the number of level{1 units in level{2 unit j, Pn e;ij and Pn e;ij Step 3 employs a Hastings update using an inverse-Wishart proposal distribution for the level{1 covariance matrix e . Specically, the Markov chain moves from e at time to e as follows: e with probability min e e e otherwise Here (a) e W 1 e , where w is chosen as in Section 3.2 and p 1 is the number of rows or columns in (b) the Hastings ratio R in (26) is exp tr e e tr e (c) the full conditional distribution for e in (26) is Y 1e;ij exp where we have expressed the right-hand side of (28) for convenience in terms of e;ij as in equation (7). Finally, step 4 involves a Gibbs update of the level{2 covariance matrix expressed as a ofu the full conditional is e is the number of rows or columns in u and J is the number of level{2 units in the data set. An improper uniform prior on u corresponds to the choice Fitting multilevel models with complex level{1 variation 21 --R Applying MCMC Methods to Multilevel Models. Bryk AS Bryk AS Bayesian Hierarchical Modeling. Bayesian Data Analysis. Adaptive rejection sampling for Gibbs sampling. Multilevel mixed linear model analysis using iterative generalised least squares. Restricted unbiased iterative generalised least squares estimation. Multilevel Statistical Models (second edition). A multilevel analysis of school examination results. How many iterations in the Gibbs sampler? A User's Guide to MLwiN (Version 2.1). BUGS 0.5 Examples (Version ii). Cambridge: Medical Research Council Biostatistics Unit. BUGS: Bayesian Inference Using Gibbs Sampling (Version 0.60). Applied Linear Regression MLwiN Macros for Advanced Multilevel Modelling (Version 2.0). --TR
maximum-likelihood methods;adaptive Metropolis-Hastings sampling;hierarchical modelling;educational data;IGLS;MCMC efficiency;Markov chain Monte Carlo MCMC;multilevel modelling;heteroscedasticity;RIGLS
604042
State-dependent M/G/1 type queueing analysis for congestion control in data networks.
We study a linear-increase multiplicative-decrease flow control mechanism. We consider congestion signals that arrive in batches according to a Poisson process. We focus on the case when the transmission rate cannot exceed a certain maximum value. The distribution of the transmission rate in steady state as well as its moments are determined. Our model is particularly useful to study the behavior of TCP (Transmission Control Protocol) the congestion control mechanism in the Internet. Burstiness of packet losses is captured by allowing congestion signals to arrive in batches. By a simple transformation, the problem can be reformulated in terms of an equivalent M/G/1 queue, where the transmission rate in the original model corresponds to the workload in the 'dual' queue. The service times in the queueing model are not i.i.d., and they depend on the workload in the system.
INTRODUCTION I N today's high speed telecommunication networks, a large part of the traffic is able to adapt its rate to the congestion conditions of the network. Congestion control is typically designed so as to allow the transmission rate to increase linearly in time in the absence of congestion signals, whereas when congestion is detected, the rate decreases by a multiplicative factor. This is both the case of the Available Bit Rate (ABR) service category in ATM [1] (see definition and use of RDF and RIF) as well as the Transmission Control Protocol (TCP) in the Internet environment [10], [22]. Congestion is detected by the source through signals. In case of ABR, the congestion signals are RM (Resource Management) cells that have been marked due to congestion information in some switch along the path of the connection. In case of the Internet, the congestion signals are packet losses that are detected by the source either through the expiration of a retransmission timer, or through some negative acknowledgement mechanism (three duplicate ACKs [22]). There is also a proposal to add some explicit congestion signaling to the Internet (the ECN proposal [7]). The performance evaluation of congestion control mechanisms is an important issue for network and protocol design. This evaluation requires a description of times between the arrivals of consecutive congestion signals. Experimentations over the Internet [4], [15] have shown that on long distance connec- tions, the Poisson assumption about the times between congestion signals is quite reasonable. This happens when the through-put of the studied connection is small compared to the exogenous traffic, and when the number of hops on the path is large so that the superposition of the packet drops in routers leads to exponential times between congestion signals. For local area networks, we noticed that the congestion signals may arrive in Altman, K. Avrachenkov, and C. Barakat are with INRIA, Sophia- Antopolis, France. Email: {altman,kavratch,cbarakat}@sophia.inria.fr. R. N-ez-Queija is with CWI, Amsterdam, The Netherlands. Email: [email protected]. y Corresponding author. bursts [4]. However, the times between bursts correspond well to the Poisson assumption. For this reason, we consider the case when congestion signals arrive in batches according to a Poisson process. Batches contain a random number of congestion signals and each such signal causes the division of the transmission rate by some constant fl. In the sequel, we also refer to a batch of congestion signals as a loss event. We focus on the case when a certain limitation on the transmission rate exists. We determine the exact expression of the throughput under such a limitation. In the literature, only simplistic approximations have been proposed [3], [19] so far. We study two possible scenarios that lead to such a limitation: (i) Peak Rate limitation: the limitation is not due to congestion in the network but rather to some external agreement. In that case, when the transmission rate reaches a certain level M , it remains constant until a loss event appears. For example in case of TCP, the window cannot exceed the buffer space available at the receiver [22]. This is known as the end-to-end flow control of TCP. In the ABR service of ATM, the transmission rate cannot exceed the Peak Cell Rate imposed by the contract between the user and the network. (ii) Congestion limitation: the limitation on the transmission rate is due to congestion in the network that occurs whenever the input rate reaches a level M . In that case we shall have an extra batch of congestion signals when the level M is attained which also causes a reduction of the transmission rate by a random factor. A typical example of such limitation is the available capacity in the network. There is a maximum limit on the number of packets a source can keep in the network and once this limits is exceeded packets are dropped. Another example is the reserved bandwidth in a Differentiated Services network [9] in cases when packets exceeding the reserved band-width are dropped rather than injected into the network as low priority packets [21]. In the particular case in which the batches contain a single congestion signal, the peak rate limitation model reduces to the one studied in [15], who already attempted at computing the first two moments of the transmission rate. A remarkable observation is done in that reference showing that the flow control can be reformulated in terms of an equivalent M/G/1 queue, where the transmission rate is translated into the workload of the queue. The congestion signals correspond to customers arriving at the queue according to a Poisson process. The service times in the 'dual' queueing model are not i.i.d., and they depend on the workload in the system. This transformation is also valid in our more general setting except that in our model with congestion limitation, there is an additional arrival in the equivalent queueing model (in addition to the Poisson arrival stream) that occurs whenever the queue empties. Another difference is that in our case congestion signals arrive in batches. Without loss of gen- erality, we consider that the occurrence of a batch of congestion signals corresponds to the arrival of a client into the dual queueing model. Hence, the service time of a client is also a function of the number of congestion signals in the corresponding batch. We solve in this paper the Kolmogorov equations and obtain the exact probability distribution as well as the moments of the transmission rate (of the window in case of TCP) for both prob- lems. In doing so, we correct an error 1 in [15]. We briefly mention some related results. Queueing analysis with service times that depend on the workload or on the queue length have been also considered in [2], [12], [17], [20]. Our model is a special case of the one studied in [20], where an implicit characterization of the steady state distribution is obtained (closed-form expressions were obtained for special cases that do not cover our model). In [12] an asymptotic approximation is used for solving state-dependent GI/G/1 queues in which both inter-arrival times, service requirements and the service rate may depend on the workload. The peak rate limitation model is a special case of the model with a general stationary and ergodic arrival process studied in [4]. For that model only bounds on the throughput were obtained. Exact expressions for the throughput were obtained there for the case in which no limitation on the transmission rate exists (see also [3], [14], [16], [19]). The structure of the paper is as follows. In Section II we describe a general model of flow control with limitation on the transmission rate and we provide a preliminary analysis. The two cases of peak rate limitation and congestion limitation are described separately in Sections II-A and II-B. It is shown that a special case of the model with congestion limitation reduces to that of the model with peak rate limitation. Hence, it suffices to analyze the latter case. We then derive the moments and the distribution of the transmission rate in Sections III and IV in terms of one unknown constant: the probability of attaining the maximum rate. This constant is computed in Section V. In Section VI we specify our model to an important particular case, that of one congestion signal per batch and a reduction factor equal to one half. Based on this particular case, we present in Section VII some numerical and experimental results to validate the model. We conclude the paper with a section on future re-search II. FLOW CONTROL WITH RATE LIMITATION: MODELS AND PRELIMINARY ANALYSIS We present in this section our model for the rate evolution of the flow control mechanism. In the sequel we adopt the usual terminology for TCP, the well known window-based congestion control protocol of the Internet: we shall work with the window size rather than the transmission rate. The transmission rate of a window-based flow control mechanism is at any moment equal to the window size divided by the round-trip time (RTT) of the connection. Let M denote the maximum window size. The limitation on the window size is either due to a peak rate limitation or to a congestion limitation. In the following we explain the similarities and the differences between the models in the two cases. While 1 In a private communication, the authors of [15] announced to replace the draft with a new one. no congestion signal is received and the window is smaller than M , the window of the protocol increases linearly at rate ff ? 0. In case of TCP, is the number of data packets covered by an ACK (usually 2, see e.g.[19], [22]) and where RTT is the average round-trip time of the connection assumed to be independent of the window size [4], [19]. We assume that batches containing a random number of congestion signals arrive according to an independent Poisson process. We denote the sizes (i.e., the numbers of congestion signals) of consecutive batches by and we assume that these constitute an i.i.d. sequence. The size of an arbitrary batch is generically denoted by N d . The Poisson process and the sequence N k , are independent of each other and independent of the past evolution of the window. For each congestion signal received, the window is divided by a which is a fixed parameter. That is, if an arriving batch contains signals, the window is multiplicatively decreased by a factor fl \Gamman . Immediately after the multiplicative decrease, the window restarts its linear increase. In case of peak rate limitation, the window stays constant at M when this maximum level is reached until the next congestion signal is received. In case of congestion limitation, immediately upon reaching M , a congestion signal is received and the window is decreased. We present the two cases separately in Sections II-A and II-B. Before doing so, we introduce some further common nota- tion. We denote the p.g.f. (probability generating function) of the distribution of N by \Theta z N z Note that the peak rate limitation model with reduces to the model studied in [15], where congestion signals appear according to a Poisson process and where the window is divided by two upon every congestion signal occurrence. By considering a general model, we aim to account for a wide range of flow control mechanisms other than TCP and for future enhancements to TCP congestion control. Let us denote the window size at time t - 0 by W (t) 2 (0; M ]. We have the following stability result which follows from Theorem 1 in [4]: Theorem II.1: There exists a stationary process W (t) such that W (t) converges to W (t) in distribution for any initial state. Moreover, we have P-a.s. lim sup 0: (2) Note that (2) implies that the stationary distribution of W (t) is unique. For x 2 (0; M ], denote the (time-average) distribution function by It follows from Theorem II.1 that this limit is independent of W (0) and coincides with the stationary distribution of W (t). We first assume that F (x) is continuous in x 2 (0; M) (in the case of peak rate limitation it is clear from physical considerations that F (x) has an atom at assumption we find a function F (x) which is an equilibrium distribution for the window size and, hence, from its uniqueness it follows that it is the desired distribution. Instead of F (x) it will be convenient to work with the complementary distribution function To differentiate between the cases of peak rate limitation and congestion limitation, in the latter case we attach a superscript cl to the symbols introduced above, e.g., the distribution function is denoted by F cl (x). Next we treat the two cases separately. In particular we show how the analysis of the model with congestion limitation reduces to that of the model with peak rate limitation. Therefore, we concentrate on the peak rate limitation model in the subsequent sections. A. Flow control with peak rate limitation With peak rate limitation, when the window reaches the maximum level M , it stays there until the next congestion signal is received. In Section II-C below we show that the window size process W (t) can be related to the workload of an M/G/1 queue (see also [15]). The workload of this state-dependent M/G/1 queue can be seen to be a Markov process (e.g. see [11]), and hence the window size evolution W (t) is a Markov process as well. With this in mind, we derive a steady-state Kolmogorov equation for F which will be the basis to our analysis. We use the following up and down crossing argument: Assume that the process is in equilibrium and consider a level M). Whenever the window size increases from less than or equal to x to more than x we say that an up crossing of the level x has occurred. Similarly, if the window size decreases from more than x to less than or equal to x we say that a down crossing of the level x has occurred. Let [t; t + \Delta] be a small time interval, where t is a deterministic time moment. When the process is in equilibrium, the probability of up-crossing is equal to the probability of down-crossing After equating these, we pass \Delta # 0. Since we assumed that is continuous for x ! M (see Remark 1 for a justification of this assumption), we conclude that the derivative of F (x) exists and is continuous for all x except at \Gamman , when q n ? 0. For x 2 (0; M)nfM fl \Gamman gn=1;2;::: we obtain the following steady-state Kolmogorov equation ff d dx or, equivalently, \Gammaff d dx From this differential equation we shall determine F (x), x 2 (0; M), in terms of the probability In Section III we first use (4) to determine the moments of the window size distribution in terms of PM . Then we find the distribution function itself in Section IV. The unknown PM is then determined using the fact that F (x) is a complementary probability distribution function 1). However, the expression obtained for PM in this way, does not lend itself for computational purposes. Therefore we show an elegant alternative to determine PM in Section V, which leads to an efficient and numerically stable algorithm for computations. B. Flow control with congestion limitation When the maximum window size M is due to congestion lim- itation, immediately upon reaching the level M a batch of congestion signals is generated. Here we study the case when the size of such a batch has the same distribution as the random variable N . In [5] we treat a more general case when the number of congestion signals that result from reaching M has a different distribution than N . Similarly as in Section II-A, we can derive the following differential equation for F cl \Gammaff d dx F cl F cl cl ae oe with, d dy F cl The additional term, compared to (4), comes from the fact that a down crossing of the level x may be due to the fact that the level M is reached and that the rate is decreased by a factor fl \Gamman with \Gamman M - x. Note that if F (x) is the unique complementary distribution function satisfying (4) then F cl is the unique complementary distribution function satisfying (5). This follows immediately by substituting (6) into (5). This relation has a simple geometric interpretation. Using the fact that the Poisson process is memoryless, if we consider the model with peak rate limitation only at moments when the window is less than M (i.e., we cut out all periods where the window equals what we get is identical to the model with congestion lim- itation. Thus, we can concentrate on finding the distribution function F (x) for the peak rate limitation model and then use (6) or the equivalent: F cl In particular, the moments of the window size in the two models are related by: cl In Section III below we derive a recursive relation for E \theta Combined with (7), this gives a recursion on E cl which we report at this point for completeness: cl kffE cl Remark 1: We emphasize that in the congestion limitation model, the quantity PM has no clear interpretation. In Section V we use the interpretation of this quantity in the peak rate limitation model to compute it. If we were to analyze the congestion limitation model without using (6), then from (5) we could express F cl using the same techniques as in Section IV - in terms of g instead of PM . Note that these two constants are related: The constant g can be determined using that F cl (x) is a complementary probability distribution, see (24) below. Since from the analysis of Section V we obtain a more tractable expression for PM (see Remark 2 for a related discussion), we will not further dwell on this approach. C. The dual M/G/1 queueing model Before proceeding with determining the moments and the distribution of the window size, we briefly show how the flow control problem can be related to an M/G/1 queueing problem with service depending on the system workload, see also [15]. First we concentrate on peak rate limitation, then we comment on congestion limitation. Define ff Namely, U(t) is obtained by 'flipping' W (t) around a horizontal line. In particular, the area between W (t) and the maximum window size M (Figure 1) corresponds to the area below U(t). Note that U(t) resembles the evolution in time of the workload (or the virtual waiting time) in a queueing system. A window equal to M corresponds to an empty queueing system. The linear increase in workload between arrivals of congestion signals corresponds to the decrease in workload due to service in the M/G/1 model. The arrival of a batch of congestion signals in our model corresponds to an arrival in the M/G/1 model. The reduction of the window upon a loss event corresponds to the increase in workload upon arrival in the equivalent M/G/1 model. Given that the amount by which the window is reduced depends on the current value of the window (and of course on the number of congestion signals in the batch), the service time in the dual queueing model is dependent on the current workload there. We conclude that the dual model behaves indeed as an M/G/1 queue (infinite buffer capacity, one server and Poisson arrivals with intensity -) with state-dependent service requirements. If Un is the workload seen by arrival n in the M/G/1 queue, then its service time xn is equal to where Nn is the number of congestion signals in the nth batch of congestion signals in the original model. Instead of working with the window as we are doing in this paper, one could solve the queueing problem and switch back to the flow control problem by using Equation (10). In particular, E \theta and PM is equal to the fraction of time the server in the dual queueing model is idle. In the case of congestion limitation, the only difference in the dual queueing model is that we have an additional arrival once the system becomes empty. This makes of the arrival process the sum of a Poisson process of intensity - and another process that depends on the workload of the system. The definition of the service time and the transformation back to the flow control problem remain the same. III. MOMENTS OF THE WINDOW SIZE DISTRIBUTION We further focus on the model with peak rate limitation. In this section we study the moments of the window size. The k-th moment of the transmission rate can be simply obtained by dividing the k-th moment of the window size by (RTT ) k . Of particular interest is the expectation of the transmission rate which coincides with the throughput of the transfer or the time average of the transmission rate. Let X denote the throughput. We have RTT The second moment is also important since it tells us how much the transmission rate varies. Some applications (e.g., real time multimedia flows) are sensitive to variations in transmission rate. One could envisage to tune the flow control so that to reduce these variations. Define for Re(!) - 0 the LST (Laplace-Stieltjes Transform) of the window size distribution by Z M+ e \Gamma!x dF (x): Taking LTs (Laplace Transforms) in (4) leads to: ff \Gamma- Xn=1 \Gamman q n \Gamman !) Note that (12) holds in particular for limitation on the window size, in which case \theta \theta \Gamman !) (\Gammafl \Gamman !) k Substituting this in (12), using the absolute convergence of the doubly-infinite series to interchange the order of summation and Fig. 1. Area associated with a single loss equating the coefficients of equal powers of ! we get, for \theta kff \theta from which the moments of the window size distribution can be obtained recursively. In particular we find for 2: \theta These first two moments can be also obtained using direct argu- ments, see Remarks 1 and 2 below. Such arguments were also used by Misra et al. [15] for the case ever, in their analysis an error appears which results in an additional equation besides (14) and (15) from which they determine an erroneous expression for the probability PM (see Remark 2). Remark 1: The mean window size can be obtained by considering the mean drift. The upward drift of the window size is given by ffP fW ! Mg and the downward drift equals \theta . Equating these gives (14). We can further derive E applying an argument similar to Little's law as was done by Misra et al. [15] for the case 1. For details we refer to [5]. The main idea is sketched in the following. For the dual queueing model described in Section II-C, we can equate the mean workload with - times the mean area below U(t) 'induced by a single ar- rival' (use that Poisson Arrivals See Time Averages). Back in the original model, the 'mean surface' of the area above W (t) in Figure The expected surface of the area 'induced' by a single loss event (the surface of the larger triangle minus that of the smaller one) is equal \theta Multiplying this by -, equating the result with using indeed gives (15). Remark 2: For a special case of our model, yet another way is pursuit in [15] to derive (14) and (15). However, there, the final result is incorrect due to a small error in an intermediate step. \theta d dt d \theta \theta In steady state we have E [W \theta W (t) 2 \theta and PM (t) j PM . Substitution into the above gives together with \theta Together with (14) this leads to (15). For the case and N j 1, the formula given in [15] for E \theta (below Formula (4) in that reference) differs from (16) by a factor This resulted in a third (incorrect) equation which is linearly independent of (14) and (15) from which PM was determined simultaneously with . In Section V we show how PM can be determined correctly and computed efficiently. IV. WINDOW SIZE DISTRIBUTION FUNCTION We find in this section the explicit expression of the cumulative distribution of the window size. The distribution of the transmission rate can be simply obtained by rescaling the window axis by 1/RTT. We start first by the case of finite M . We provide the expression of the distribution in every interval for the case we give an expression of the distribution for any x ? 0 as an infinite sum of exponentials. A. Window distribution for finite M For Equation (4) reduces to: \Gammaff d dx hence, To find the entire distribution we introduce, for Equation (4) can now be written as: d dx ff Since F (x) is continuous for F k is recursively given by ff u=x ff u We conclude from the above recursion that a solution to (19) and (20) has the following form To determine the coefficients c (k) i , we substitute (21) into (19). Then, equating terms with the same exponents, we get the following recursive formula Once the coefficients c (k) are computed, the coefficient 1 can be determined from (20): ff c (k\Gamma1) ff ff Note that to compute the coefficients c (k) , we do not need PM . Hence, using that F (x) is a complementary distribution func- tion, PM is then determined by: ff M=fl k\Gammai However, this relation is not suitable to compute PM , see Re-mark Remark 1: With (18) and (21) we have found an equilibrium distribution function F (x) satisfying (4). By Theorem II.1 it is the unique solution and, hence, the assumption that F (x) is continuous for x ! M is justified. Remark 2: Recursion (22) is suitable to determine the distribution function on an interval M=fl k - x - M when k is not too large. For large k the recursion may become instable, since it involves subtraction of numbers of the same order. Therefore (24) is not suitable to compute PM . In Section V below we derive an alternative expression for PM , which leads to a numerically stable and efficient algorithm to compute PM . B. Window distribution for infinite M In this case, the results derived in the previous subsection cannot be applied immediately by letting M go to infinity. How- ever, we can derive the LST of the window size distribution by similar arguments. When ff \Gamman !) or, equivalently, ff \Gamman !): (25) Substituting the above equation repeatedly into itself l times, applying partial fraction expansion at each step, and then taking l !1, we conclude that - f(!) can be expressed as follows: for certain coefficients c i (this is formally justified later). To determine the constants c we substitute (26) into (25) and equate coefficients multiplying the terms 1=(! This leads to the recursive formula c i\Gammak which determines the ratios c i =c 0 (it is for this reason that both sides contain a factor 1=c 0 ). The coefficient c 0 follows from It can be shown that the infinite series in the expression of c 0 converges and hence all the coefficients c i exist. The proof of convergence is given in Appendix A. The inversion of (26) back into the time domain gives: with Given that the coefficients c i exist, the above series is absolutely convergent for any value of 1). Thus, it is the unique solution to For the case of no window size limitation and N j F (x) was already obtained in [18]. V. THE PROBABILITY OF MAXIMUM WINDOW SIZE In Sections III and IV we determined the window size distribution and its moments in terms of PM . In this section we derive an expression for PM from which it can be computed ef- ficiently. For this we introduce the random variable T (x) which is the time until the window size returns to the value x, starting just after a loss event occurs with the window size being equal to x 2 (0; M ]. We denote its expectation by E(x) := E [T (x)], Then, from elementary renewal theory, 1=- 1=- +E(M) We now proceed to find the function E(x). A typical evolution of the window size is depicted in Figure 2. For simplicity in the figure only loss events having are depicted. The times to recover from losses are partly cut out of the picture (denoted by the shaded areas). Suppose for the moment that the initial loss (at the level x) was such that (in the figure be the time to get back at level x conditional on and we further E(x) =X x Fig. 2. TCP window If no losses occur during the time \Gamman )x=ff, i.e., the window size x is reached in a straight line from the starting point at fl \Gamman x (in the figure fl \Gamma1 x). Each time a loss occurs at a level y 2 (fl \Gamman x; x) it takes T (y) time units to get back at the level y. Because of the memoryless property of the Poisson process, if we take out the shaded areas in Figure 2 and concatenate the non-shaded areas then the cut points (where the shaded areas used to be) form a Poisson process on the straight line from fl \Gamman x to x. Thus if the cut points are given by (in the figure \Gamman )x Since the loss process is a Poisson process, the mean number of cut points is \Gamman )x=ff and the position of each of the points y j is uniformly distributed over the interval (fl \Gamman x; x), see for instance [23, Thm. 1.2.5]. Hence, \Gamman )x ff \Gamman x E(y) \Gamman )x dy \Gamman )x ff \Gamman x E(y)dy: (32) Using (1) and (31) we now arrive at \Gamman x E(y)dy: (33) Although in the finite-window case (M ! 1) the above integral equation has only meaning for it is well defined for all x ? 0, and the solution to (33) is unique, see [5]. Define the LT of E(x): e \Gamma!x E(x)dx: In [5] it is shown that - using that the q n and E(x) are non-negative we may interchange the order of integration and summation (twice), finally arriving at: Repeated substitution of this equation into itself and applying partial fraction expansion leads us to the following candidate solution: where the e i are constants to be determined. This representation will be justified by showing that it leads us to the unique solutions to (34) and (33). Substituting (35) into (34) and equating the coefficients multiplying the terms 1=(fl \Gamman q n e i\Gamman \Gamman q nX We note that the ratios e i =e 0 are non negative and can be computed recursively from (36). Then the normalizing constant can be computed from (37). From (36) it can be shown (by induction on i) that that is, the e i decay exponentially fast in i as i !1. Therefore the right hand side of (35) certainly converges for ! ? -=ff and, from its construction, (35) is the solution to (34). By partial fraction (35) can be rewritten as: ff Inverting this LT gives: e Using this in (30) we have e Note that because of (38) and e PM can be computed efficiently from (41). VI. SPECIAL CASE: ONLY ONE CONGESTION SIGNAL PER LOSS EVENT AND A In this section we specify our results for the important particular case of TCP flow control with only one division of the window by a factor 2 at loss events. Namely, we take and in the model with peak rate limitation, see [15] for a similar model. In Section VII-B we compare the results from this particular case of our model to measurements from the Internet. We worked with long distance connections where congestion signals rarely appear in batches and where the process of loss events is close to Poisson [4]. From (14) and (15) we obtain the expressions for the first two moments of the window size distribution. The throughput of TCP can be obtained from Equation (11). The distribution function itself or the complementary distribution function F (x) is computed successively on the intervals using (21) with 2. Recursion (22) reduces to c (k\Gamma1) and c (k) 1 is given by (23). When 1, the distribution function is given by (29) with and c 0 is given by (28). Finally, where the coefficients e i are given by e VII. MODEL VALIDATION In this section we compare measurements from long distance and long life TCP connections with the results of Section VI limitation). Comparison of real measurements with the model with clustered (batch) arrivals of congestion signals is a topic of current research, see also Section VIII. Due to the large number of hops and the multiplexing of exogenous traffic in network routers, the Poisson loss process assumption is expected to hold on long distance connections [15]. Our TCP receivers implement the delay ACK mechanism [22] and our TCP senders increase their windows in the congestion avoidance mode by approximately one packet every window's worth of ACKs. Thus, we take ff equal to 1=(2RTT ) [19]. First, we show theoretically how the window size is distributed in the stationary regime. Second, we compare our results to measurements from the Internet. A. Numerical results Consider the case of a long TCP connection with packets of size 1460 bytes and a constant RTT of one second. Using the results of Section VI, we computed the cumulative distribution function F (x) of the window size and its probability density Probability Density Function Window size (kbytes)515253545Average inter-loss time (s)0.050.150.250.350.45Fig. 3. Limited receiver window: Probability Density Function Window size (kbytes) Fig. 4. Unlimited receiver window: function f(x) for increasing values of the intensity of losses. We consider the both cases limited receiver window). In Figures 3 and 4 we plot our results for the density function f(x). For the case Kbytes, we computed the distribution function successively for the intervals so on. In the case of an unlimited receiver window, we used the expression of the density function as an infinite sum of exponentials (Equation (29)). Note that when solving numerically the model for the distribution, several infinite series, e.g. (29) and (42), need to be computed. As we discussed in previous sections, these infinite series converge quite fast; so one needs to use only a small number of terms. When Kbytes, the discontinuity of f(x) at is clearly seen in Figure 3 (especially for large inter-loss times). The pulse PM at is depicted by an area equal to PM . When 1, the density function exhibits neither pulses nor discontinuities (Figure 4). B. Experimental results Our experimental testbed consists of a long life and long distance TCP connection between INRIA Sophia Antipolis and Michigan State University (US). The TCP connection is fed at INRIA by an infinite amount of data. The New Reno version of TCP [8] is used for data transfer. We changed the socket buffer at the receiver in order to account for different values of M . We considered three values of M : 32, 48 and Kbytes. For every value of M , we ran the TCP connection window (bytes) Cumulative Distribution Function Model Measurements Fig. 5. Receiver window window (bytes) Cumulative Distribution Function Model Measurements Fig. 6. Receiver window for approximately one hour and we registered the trace of the connection using the tcpdump tool developed at LBNL [13]. We also developed a tool that analyzes the trace of the connection and that detects the times at which the window is reduced. Moreover, our tool gives the average RTT of the connection and the statistics of the window per RTT. We compared for the three values of M , the distribution of the window size from measurements to that given by our model. The results are plotted in Figures 5, 6 and 7. When M is small, we observe a good match between the measured distribution and the one resulting from our model. How- ever, for larger values of M , the difference between the two in- creases. In particular, as M increases, the measured probability density concentrates around the average window size. This deviation can be explained from the measured distribution of times between loss events. First, we plot in Figure 8 the distribution of inter-loss times for Kbytes. This distribution is in agreement with an exponential law, resulting in a good match between the model and the measurements. Figures 9 and 10 show the measured distributions for the other two values of M . We observe that the loss process is no longer Poisson, but closer to a deterministic process. Small inter-loss times are less frequent as M increases, and the medium inter-loss times domi- nate. This results in a degradation of the correspondence between our model and the measurements. One explanation of the deviation of the loss process from a Poisson process for larger values of M is the following. A true Poisson loss process implies that the time until the next loss event is independent of the past. This is the case when the congestion of the network is dominated by the exogenous traffic and0.20.610 10000 20000 30000 40000 50000 60000 70000 window (bytes) Cumulative Distribution Function Model Measurements Fig. 7. Receiver window Probability density function Exponential distribution Measurements Fig. 8. Case of not dependent on the measured connection. Namely, when the measured connection's share of the available bandwidth on the path is small compared to that of the exogenous traffic. A small M limits the bandwidth share of our connection and limits its impact on the network, resulting in a loss process close to Pois- son. However for large M , the measured connection realizes a larger share of the bandwidth and thus contributes more to the congestion of network routers. When it reduces its window, the state of the network changes and becomes under-loaded. Some time is needed for the network to be loaded again. This is the reason for which small inter-loss times start to get small proba- bilities. In such a case when the loss process is close to a deterministic process, a simple fixed-point method as that proposed in [3], [19] can be used to approximate the achieved throughput. VIII. CONCLUSIONS AND FUTURE RESEARCH We studied additive-increase multiplicative-decrease flow control mechanisms under the assumption that congestion signals arrive in batches according to a Poisson process. As high-lighted in [15], the model can be reformulated as an M/G/1 queuing problem with service time dependent on system work- load. We tried to keep the model as general as possible in order to account for a wide range of congestion control strategies. We calculated explicit expressions for the moments as well as the distribution of the transmission rate (of the window size in case of TCP). For the case of single congestion signals, we compared our results to measurements from TCP connections over the In- ternet. From our experiments, we concluded that our model leads to accurate results when the times between losses are close to being exponentially distributed. Probability density function Exponential distribution Measurements Fig. 9. Case of Probability density function Exponential distribution Measurements Fig. 10. Case of Currently, we are working on the validation of our model with clustered congestion signals. Our measurements over the Internet have shown that on some paths especially short distance ones, the loss process presents a high degree of burstiness. We are currently also studying the extension of the analysis to more general inter-loss time processes, in particular to MMPPs (Markov Modulated Poisson Processes). ACKNOWLEDGEMENT We would like to thank V. M. Abramov for comments that improved the presentation of the paper. Also, we thank the department of Mathematics of Michigan State University and in particular L.B. Freidovich for providing us with a computer account for our Internet experiments. A. We shall prove here that the infinite series in Equation (28) converges. Denote a i := c i =c 0 . Using (27), a i satisfies the folowing recurrent relation a To prove that series a i is absolutely convergent, it is enough to prove that the majorant series defined below, is convergent. Consider b i+1 Thus, b i+1 therefore, the series (and hence absolutely convergent for fl ? 1. --R The ATM Forum Technical Committee "Investigation of a queueing system with service depending on queue length" "TCP in presence of bursty losses" "A stochastic model of TCP/IP with stationary random losses" "State- dependent M/G/1 type queueing analysis for congestion control" "A queueing system with queue length dependent service times, with applications to cell discarding in ATM networks" "TCP and Explicit Congestion Notification" "The NewReno Modification to TCP's Fast Recovery Algorithm" "Assured Forwarding PHB Group" "Congestion avoidance and control" "Asymptotic Analysis of a state-dependent M/G/1 queueing system" "A state-dependent GI/G/1 queue" "The Macroscopic Behavior of the TCP Congestion Avoidance Algorithm" " Stochastic differential equation modeling and analysis of TCP-windowsize behavior" "The Window Distribution of Multiple TCPs with Random Queues" "On queues with dependent interarrival and service times" "The stationary behavior of ideal TCP congestion avoidance" "Modeling TCP Through- put: a Simple Model and its Empirical Validation" " Single-server queues with service time dependent on waiting time" "A Quantitative Study of Differentiated Services for the Internet" Slow Start, Congestion Avoidance, Fast Retransmit, and Fast Recovery Algorithms" " Stochastic Models - An Algorithmic Approach" --TR Asymptotic analysis of a state-dependent <italic>M</>/<italic>G</>/1 queueing system Congestion avoidance and control TCP and explicit congestion notification The macroscopic behavior of the TCP congestion avoidance algorithm Modeling TCP throughput TCP in presence of bursty losses --CTR Brbara Gonzlez-Arvalo, Performance of a Leaky Bucket System with Long-Range Dependent Input Traffic, Queueing Systems: Theory and Applications, v.46 n.3-4, p.439-459, March-April 2004 Carsten Burmeister , Ulrich Killat , Jens Bachmann, TCP over Rate-Adaptive WLAN - An Analytical Model and its Simulative Verification, Proceedings of the 2006 International Symposium on on World of Wireless, Mobile and Multimedia Networks, p.339-348, June 26-29, 2006 Deb , R. Srikant, Rate-based versus queue-based models of congestion control, ACM SIGMETRICS Performance Evaluation Review, v.32 n.1, June 2004 Gang Wu , Edwin K. P. Chong , Robert Givan, Predictive buffer control in delivering remotely stored video using proxy servers, Computer Networks: The International Journal of Computer and Telecommunications Networking, v.50 n.18, p.3721-3742, 21 December 2006
state-dependent queue;control protocol;linear increase and multiplicative decrease;congestion control in data networks;transmission
604062
Lessons learned in modeling schizophrenic and depressed responsive virtual humans for training.
This paper describes lessons learned in developing the linguistic, cognitive, emotional, and gestural models underlying virtual human behavior in a training application designed to train civilian police officers how to recognize gestures and verbal cues indicating different forms of mental illness and how to verbally interact with the mentally ill. Schizophrenia, paranoia, and depression were all modeled for the application. For linguistics, the application has quite complex language grammars that captured a range of syntactic structures and semantic categories. For cognition, there is a great deal of augmentation to a plan-based transition network needed to model the virtual humans knowledge. For emotions and gestures, virtual human behavior is based on expert-validated mapping tables specific to each mental illness. The paper presents five areas demanding continued research to improve virtual human behavior for use in training applications
Figure 1: Avatalk Architecture Language Processor The Language Processor maps spoken input to underlying semantics and produces responsive output. It has six components [17]: Parsing. Our system uses a minimum distance translator parser that tries to match the spoken words to the closest grammatical sentence as defined by the currently active language grammar [16]. Grammars. A grammar specifies the acceptable spoken statements. The representation language is quite free; literally any sentence can be encoded in the grammar. In Figure 2, the sentence ?help me find the spaceship? will return the semantic statement ?ask(location(ship))?. We use semantic categories to categorize syntactic components, an efficient parsing strategy that greatly assists in handling ambiguity with the main disadvantage of being domain specific. The Behavior Engine dynamically selects which grammars should be active based on the current context. ? Language Interpretation. The considerable ambiguity inherent in language, and reliance on linguistic context, makes natural language processing difficult. For instance, taken alone ?it is? has very little meaning, but following a command ?put the knife down? it makes sense as ?the knife is on the ground?. In an environment where there are multiple knives ?the knife? is also ambiguous. We resolve these ambiguities via dynamic context switching and use of utterance expectations sorted by likelihood [41]. ASK -> PLEASE WHEREIS . ASK -> WHEREIS . PLEASE -> damn it @-0.4 . PLEASE -> please @ 0.2 . PLEASE -> would you please @ 0.3 . WHEREIS -> help me FIND . WHEREIS -> where is . FIND -> find . FIND -> locate . LOC -> the SPACE ship : ship . LOC -> the rest room : wc . SPACE -> mother . SPACE -> space . Figure 2: Sample Language Grammar? Reliability Scores. We compute the likelihood of having correctly understood a particular utterance, factoring in the speech recognizer score (a ?goodness of fit? between the audio signal and the acoustic model it has of spoken language), parser score (a minimum distance parser returns a score based on the number of insertions and deletions needed to parse the string of words using the language grammar), expectation score (based on context), goal weight (certain critical goals may require exacting verification), and past recognition rate. Depending on a dynamic threshold, the system will ask the user to repeat himself/herself, paraphrase what it believes was said and ask for confirmation, or accept its interpretation and continue. ? Emotional and Social Tagging. We extended the semantic grammars by applying tags that carry information related to emotional and social Behavior Engine state variables. In Figure 2, the symbol '@' is used to indicate the relative POLITENESS of different phrases. (We have also mapped CONFUSION, SATISFACTION, HUMOR, time constraint, and other tags in our applications.) Values range from -1.0 (very impolite) to 1.0 (very polite); if not specified, the word or phrase has a neutral value related to that attribute. During parsing, these values are combined to produce a final score. Behavior Engine The Behavior Engine uses semantic interpretation generated by the Language Processor to assist in determining virtual human behavior. The current underlying architecture of the Behavior Engine is an augmented transition network (ATN). Typical of ATN, there are often multiple conditional transitions leading between network nodes; at least one transition condition defaults to true. If multiple transition conditions are satisfied at a particular node, then one is selected at random. One important set of variables that we maintain in the ATN are cognitive, generally domain-specific, variables. These variables are used while tracking conversational topics and in the interface with the Language Processor to expect or generate relevant statements. Another set tracks physical or physiological characteristics; in certain applications we use physiological models that provide continuous, real-time cardiovascular, respiratory, and pharmacological simulation [23]. The virtual human can exhibit real-time medical signs and symptoms, which can in turn affect other behaviors. Another set is emotion variables. We keep track of a base set of emotions and personality traits for each virtual human in the simulation. Combinations of values from this base set are used to define all emotional state descriptions. For instance, a base set that we use is ANGER, CONFUSION, DISGUST, FEAR, HAPPINESS, HUMOR, POLITENESS, SADNESS, SURPRISE, TIME_CRUNCH, and VOLATILITY. We then define other emotions based on these (as well as constants such as SMALL, MEDIUM, and LARGE; Figure 3a), and emotional states iteratively based on emotions and other emotional states, using Boolean expressions (Figure 3b); these emotional state descriptions are used in node condition statements. In node action state- ments, we allow modification of emotional state (Figure 3c). For instance, if a node is visited only when the user commits an error, or when the virtual human is distracted by an action in the virtual environment, the value of emotion values may change. Thus, the emotional state of each virtual human is dynamic and depends on current state, environmental constraints, and user performance. The choice of base set is somewhat arbitrary, though we used as its core a commonly accepted set [11,34,40]. The equations used to define emotional states derived where possible from the research [10,39], otherwise from expert advice, common intuition, application demands, and ad-hoc experimentation. a) DISTRUST -> (SIZEABLE*(ANGER+FEAR))-(MEDIUM*SURPRISE) . SATISFACTION -> (VERY_LARGE*HAPPINESS)-(MEDIUM*ANGER) . b) CERTAIN -> DISTRUST <= EXTREMELY_LOW . COMPLACENT -> SATISFIED or not(CONFUSED) . HOSTILE -> (ANGRY and DISGUSTED) or not(FRIENDLY) . c) IRK -> ANGER += VOLATILITY*TRIVIAL . PRESSURE -> TIME_CRUNCH += VOLATILITY*LARGE . Figure 3: Emotional State Computations Visualization Engine The Visualization Engine produces our 3D virtual humans. Target images created for the extremes of emotional expressions, gestures, phonemic facial movements, and other body movements feed into our own morphing algorithms; we create real-time movements by morphing from the original image to these morph targets. For instance, if we create a HAPPY morph target, we can generate a face that is completely happy or at any level between the original image and the target (Figure 4a). Further, we can blend any morph targets together, so we can combine a 50% SARCASTIC face with a 75% DISTRUSTFUL face with a 90% HAND_WAVE (Figure 4b). a) Normal 100% Happy 50% Happy 25% Happy b)50% Sarcastic 75% Distrustful 90% Hand Wave All 3 Combined Figure 4: Happy and Combined Facial Expressions The Behavior Engine produces emotional and gesture expressions based on the state of the simulation. For instance, the virtual human may be at a distance salutation node, where it is instructed to wave [8]. These commands are sent directly to the Visualization Engine. An additional mechanism within the Visualization Engine automatically generates appropriate facial expressions and gestures based on the virtual human's emotional state, and an analysis of textual structure of the virtual human's utterances. Thus an ANGRY virtual human may produce an angry expression even if the Behavior Engine does not explicitly specify this action. Similarly, positive and negative responses will invoke head nods and shakes or other emblems [18], predefined terms will invoke propositional gestures to complement the utterance [5], beat gestures are inserted [5], and eye movements that reflect gazing are modeled after prototypical human behavior [8]. Finally, both the Behavior and Visualization Engines insert some small random head and body movements to add realism. Our architecture allows us to support both synthesized and recorded speech. We employ off-the-shelf text-to-speech synthesiz- ers, using to the extent possible the virtual human's emotional state to change synthesis parameters such as rate of speech and volume. A speech synthesizer has great advantages in flexibility of design; unfortunately, available speech synthesizers lack the fidelity of real human speech. Initial impressions of users tend to be negative and distracting. Only with continued use do users tend to adapt to the stilted speech (until there is a blatant mispronunciation). There- fore, with applications where the user has only short interactions with the system, we use recorded voice instead of synthesized voice. Rather than try to piece together fragments of recorded sentences, we generally record entire utterances. With recordedspeech, the grammars used for speech generation have pointers to the associated sound files, as well as gestural commands. While this method is much less flexible than synthesized speech, the resulting simulation fidelity is greatly increased. Application JUST-TALK teaches students basic techniques for managing encounters with the mentally ill by having them work through a series of one-on-one scenarios with a simulated subject [12]. It also teaches them to look for indications of particular forms of mental illness so that they can adapt their responses appropriately. Through observations of the virtual environment and a dialog with the virtual subject, the student must stabilize the situation and decide whether to release or detain the subject. The JUST-TALK virtual environment is the sidewalk in front of a hardware store, where there is a bench. A patrol car is parked on the side street next to the hardware store. The subject is a white male adult. JUST-TALK has been implemented with five scenarios: ? A schizophrenic who is hearing voices; ? A paranoid who fears the police are conspiring with federal agents; ? A normal individual who is agitated from nearly being run depressed individual who has become suicidal because of marital and child custody problems; ? A normal individual who is depressed in trying to deal with marital and child custody problems. A session with JUST-TALK starts with the dispatch ?You are responding to a report of a young, adult male who is reported to be behaving erratically, entering the street, and almost getting hit by a car. The virtual environment for the scene is displayed in the scenario window. First, the user is expected to introduce himself or herself to the subject, although a novice may skip this step and start asking questions or demanding responses. After the introduction, the user can then interview the subject. The interactions with the subject in JUST-TALK are all verbal; it does not teach apprehending or even officer safety techniques. Either the subject or the user may initiate the dialog. Sometimes the subject may be very withdrawn, so the user will have to open the con- versation. Other times the subject may be very agitated and will start talking at the user from the start. The user uses the conversation to stabilize the situation, assess if the subject is anchored in reality, and determine what action is needed (e.g., leave, transport the subject to a mental health facility, or subdue the subject). The user can stabilize the situation by talking with the subject to determine the problem and getting the subject to agree to a solution (i.e., asking the subject if he or she is taking prescription drugs, asking if he or she hasn't taken a dose recently, then persuading the subject to reinitiate his or her medication, or else visit a mental health facility), or talking with the subject and acknowledging that the subject's delusions are real to the subject and offering to help (but not agreeing with the delusions). The user can destabilize the situation by using inflammatory language or by challenging delusional or hallucinatory statements. Authoritative, commanding language can actually escalate the intensity of the interaction, particularly with subjects who are paranoid, distrustful, or afraid. language that is more conciliatory, such as expressions of understanding, or requests rather than commands, can result in reduced tension. The user can assess if a subject is delusional by asking the subject about his or her mental illness history, listening for delusional or hallucinatory statements, seeing if the subject can respond rationally to questions about the problem and the subject's physical status. Users should also make note of physical gestures such as head movements, eye movements, and other body language. Often, a subject who is hearing voices and other sounds (or taking some anti-psychotic medications with visible side effects) will display distinct physical signals. INITIAL BEHAVIORAL MODELS For the JUST-TALK application, we set out to create a virtual human that acts as if he is schizophrenic, paranoid, depressed, sad, or stressed. Though we have used them in the past, this virtual human was not intended to be a pedagogical agent [22,28]. Instead, the encounter was to take place, in a virtual environment, under the premise of interacting in a public space with a law officer. To achieve such a virtual human required that we first understand how normal (calm, aware, attentive) individuals would behave in a similar situation, then modify normal behaviors as appropriate for the scenario. Basis in Agent Research Some three-quarters of all verbal utterances are accompanied by gestures [6]. In addition, eye gazing and body posture play crucial roles during interactions. Our Behavior Engine attempts to mimic these activities to make the virtual human appear realistic. Of the gestures, the majority are representational (iconic, deictic, emblematic, or metaphoric) and the rest are beats and idle motions [6]. Iconic movements are meant to convey information about spatial relationships or concepts [5]. Deictic movements, like pointing, are used mainly when discussing a shared task [5]. Emblematic gestures are culturally specific (such as a nod meaning ?yes? or thumbs-up for ?good?) [18]. Metaphoric gestures commonly accompany new segments in communicative acts, and thus, like most representational gestures, rely on semantic knowledge [5,6]. In fact, representational gestures are often begun before the utterance even begins, as soon as the speaker knows what s/he is going to say [6]. Beat gestures, on the contrary, rely on syntax and prosody, occurring with heavily emphasized words or on occasions of turning over the floor to another speaker, though they may also convey information about novelty in discourse [5]. Idle motions (habitual actions such as winding or checking one's watch, lighting a cigarette, putting hands in the pockets, or manipulators such as stretching, wetting the lips, and scratching the head) are randomly executed throughout the interaction [18]. Eye gazing helps regulate the flow of the conversation. Looking straight at the conversational partner after an utterance implies seeking feedback [5], while staring is meant to intimidate [6]. Averted gaze can indicate sadness, depression, embarrassment, or confusion [6]. Blink rates change based on emotion, so that the normal blink per four seconds increases to one per two seconds when the individual is nervous, but decreases to one per six seconds when angry [31]. Together with facial expression, eye gazing can provide meaning to initiation and termination of a conversation, turn taking, and feedback [5]. For instance, inviting contact involves a sustained glance and a smile, while breaking away involves glancing around [8]. Similarly, an introduction often includes tilting the head, giving a turn includes looking at the partner and raising the eyebrows, wanting a turn includes raising the hands into view and looking at the partner, and planning a response involves looking away and lowering the eyebrows [8,9]. Positive feedback often involves nodding, while negative feedback may involve gazing away and increased blinking rate [9]. The degree of eye opening, position of eyelids relative to the irises, position and shape of eyebrows (arched, raised, drawn together), and other facial movements can be used to indicate emotion [26]. For instance, surprise is shown with wide open eyes, the lower eyelids drawn down, raised eyebrows, and the mouth open wide [9,31]. Similarly, fear is shown as wide open eyes andmouth, the upper eyelids raised, the lower lids tensed, and perhaps a step back or skin paling or sweating [9]. Happiness is shown as wrinkles below the lower eyelids, the lids raised but not tensed, smiling, the head lifted, and open body orientation [6,18], whereas contempt is shown as a sneer, a wrinkled nose or wrinkles under the eyes, the upper eyelids partially closed, and the body turned to the side [9]. The precise position of the body or one of its parts (i.e., posture), compared to a determined system of references, holds great meaning. For instance, the bodily attitude of prostration with head bent and shoulders falling is typical of unease [18]. Postural positions that have been well described include attentive, relaxed, insecure, confused, angry, joyful, mocking, insulting, rejecting, and welcoming [18]. Visualization based on Games We quickly came to the realization that our rendering engine was not powerful nor flexible enough to satisfy all requirements for a normal virtual human, much less a mentally ill virtual human. Realistic gestures, it turns out, are at least if not more important during a conversation than simply emotional expressions [7,9]. For instance, in a virtual asthma patient application [21], whenever the virtual human delineated a list of items (e.g., ?Colds or flu, exercise, perfumes, hair spray, pollens from grass and weeds, and house dust all bother me.?) we wanted her to tap her hands or count with fingers, but the modeling effort required to allow her to delineate with gesture was prohibitive. Similarly, in a bank teller training application [demonstrated at 15], we wanted to customer to hand over identification and a check, but settled for a magical appearance of these items when requested. Our Visualization Engine lacked these capabilities because it was designed primarily for facial expression. When we began developing Avatalk, we envisioned basically a talking head with which the user interacted, and there were no products capable of portraying the range of emotion we felt was desirable. We invested in our own rendering engine. The demand from users, though, was for a much more complete environment; we could not achieve the level of engagement we needed from only a talking head. So, for instance, we were told by JUST-TALK subject matter experts that the schizophrenic person should pace and point and move constantly, while the depressed person should sit and rock when he becomes agitated. REVISED BEHAVIORAL MODELS Though we discuss the linguistic, cognitive, emotional, and gestural models separately, in fact they all interact. This knowledge is not new; other researchers have found that emotions interact with social, perceptual, motivational, and motor systems [10,25]. To spell out the interactions, we developed, with some expert help, a series of tables that guide virtual human behavior. Table 1a shows a sample table for emotional state changes based on user input. Table 1b shows a sample table for determination of reply type based on current emotional state. Table 1c shows a sample table for gestures, also based on current emotional state. We implemented the tables in the ATN as condition/action statements. Our action definitions and definitions of emotional state changes in the ATN, and determination of next behavior(s), are very similar to the implementation described in [38]. Linguistic Models We extended our linguistic analyses considerably in the JUST- TALK application. For user input, we built quite complex language grammars that captured a range of syntactic structures and semantic categories. For virtual human output, we devised an extensible method of labeling phrases that increased productivity, complexity, and capability for reuse. Table 1: Mapping Tables a) Emotional state transitions, Depressed individual, based on user input Current State of DEPRESSION Next State for DEPRESSION Drivers Personal Request, Inform Help, Statement of Concern DEPRESSED DISCOURAGED DISCOURAGED Threat, Insult, Profanity Personal Request or Query, Inform Help, Statement of Concern, Threat, Insult, Profanity DEPRESSED DISCOURAGED Command, Impersonal Query Personal Request, Inform Help, Statement of Concern DISCOURAGED DEPRESSED DISCOURAGED Command, Impersonal Query, Threat Command, Impersonal Query, Threat Reply mode map, Schizophrenic, for Anger & Fear APPEASED TICKED ANGRY ENRAGED TERRIFIED AFRAID SCARED Deny Deny Deny Deny Question Question Challenge Challenge Respond Respond Challenge Challenge Respond Respond Challenge Challenge c) Gesture map, Paranoid, Question replies, for Anger & Fear APPEASED TICKED ANGRY ENRAGED TERRIFIED AFRAID SCARED n/a Run away Run away Run away Lean forward Look down Brace arms Stand behind bench Lean forward Look forward Brace arms Stand behind bench Torso upright Tilt head Arms at sides Pace Get ready to fight Torso upright Look down hands Stand before bench, ready to comply Torso rocks Tilt head hands Stand before bench Torso upright Tilt head Cross arms Pace Get ready to fight Torso upright Tilt head hands Sit, ready to comply Torso upright Tilt head Cross arms Stand before bench, ready to comply Torso upright Tilt head Hands on hips Pace n/a As we (and others [32]) have for other applications, we decomposed the interaction into an introduction, interview, and resolution. We have found that, for a given domain, the introduction is rather formalized. For instance, in a clinical setting [21,23], the practitioner will usually begin with the standard ?Hello, how are you??, whereas in a formal field interview setting [14], the interviewer is taught to begin with a scripted phrase (?Hello, my name is?, I represent RTI, a non-profit research institute located in North Carolina, I am in your neighborhood conducting a survey sponsored by?, you should have received a letter about it. In JUST-TALK, the officer is expected to introduce himself/herself as he/she would to the man on the street. During the interview, the officer is expected to de-escalate the potentially explosive situation, by using calming, polite, responsive language. Given appropriate user input, the virtual human will become more calm and composed and responsive, perhaps demonstrating this by stopping pacing or sitting down. Topics that the officer and subject will generally discuss include the event leading to the dispatch, the subject's name, family, illness (if any), and medications. In other applications, the resolution is normally a simple ?goodbye? or ?thank you?. In consultation with our subject-matterexperts, we settled on five possible resolutions: no action is taken (the officer says ?goodbye?), the subject runs away, the subject verbally attacks the officer, the subject descends into a catatonic state, or the subject is persuaded to get in the patrol car to be taken to a mental health facility for diagnosis, observation, or treatment. Avatalk applications use spoken natural language interaction [30], not text-based interaction [29]. We observed a considerable number of preliminary users and collected their actual phraseology. Grammar definition became an iterative process, with each redefinition subjected to expert input to assess accuracy, relevance, and comprehensiveness. Still, we have work before us to increase recognition of user input, and to take further advantage of requests for repetition or confirmation. User Input We created a grammar framework whereby the JUST-TALK language Processor could, mainly by examining syntactic structures, infer what type of input the user uttered. Different types included commands, requests for information, statements of understanding or appreciation, and informative declarations. From this syntactic analysis, we calculated a user politeness score and an input complexity value. Note that these scores are somewhat domain specific. For instance, our experts informed us that law officers are taught to always use ?sir? or ?ma'am? when conversing with all adults, hence any input lacking these terms detracts from the politeness count. In a field interviewing domain, on the other hand, any input including these terms would increase the politeness score. Similarly, how complex an utterance is depends on other phrases in the domain [see 35]. In the Behavior Engine, we then used contextual knowledge to evaluate the semantics returned by the language Processor. From this semantic analysis, we derived a relevance metric and a personalization score. The relevance metric tells how appropriate was the user input based on the current topic (determined from previous input and from the most recent virtual human output). The personalization score provides an estimate of how well the user tailored his/her response to the virtual human; this measure, too, is domain-specific. In general, we've found that a reply or response can be described by numerous adjectives, some of which are listed in Table 2. The descriptors listed in the left column are those that we are able to derive from syntactic and semantic analyses. (The descriptors listed in the right column represent ongoing research, requiring technology beyond what is readily available or implemented.) Table 2: User Input Descriptors Accurate Complete Childlike Emotional Deceptive Expected Humorous Feminine/masculine Hesitating Linguistically complex Instantaneous Misunderstood Loud Non-native Personal Polite Positive Nonverbal Out of breath Relevant Sarcastic Ungrammatical Sick Verbose Tired Untruthful Virtual Human Output We structured the dialog so that the virtual human replies in one of six ways: response, question, denial, challenge, show of confusion, or zone out (see Figure 5). We used fuzzy logic in the Behavior Engine to decide on reply format, and used information on semantic content of the input from the language Processor to select a specific appropriate verbal reply. In JUST-TALK, we tagged the following emotions to the grammars: ANGER, ANXIETY, ATTENTION, DEPRESSION, FEAR, and HOSTILITY. This base set, derived through some discussions with experts, seemed to capture the range of emotional states and personalities we needed to portray. Work remaining to do, though, includes making some virtual human replies less coherent and more abusive, as appropriate for its personality, and integrating recorded speech as opposed to text-to-speech generation, to increase realism and user engagement. Cognitive Models We keep track of domain knowledge in the ATN via state variable settings, and also by its very structure, since some level of planning is inherent in the ATN (as opposed to using a modeling language [13]). Our virtual humans reason about social roles and conventions [36] through the ATN structure (what can be stated or asked at any point in the dialog) and grammar definitions (how it gets stated or asked). Figure 5 shows how we map language input to different sections of the ATN. The architecture was designed to allow the application creators flexibility in assigning general and domain-specific knowledge. For instance, our virtual humans may not understand what ?SATISFACTION? or ?EXTREMELY_LARGE? mean, but they behave as if they do. Similarly, our virtual asthma patient [21] discusses relevant symptoms based on a specific setup variable indicating severity level, while the JUST-TALK subject portrays paranoia about the federal government or distrust of law enforcement only in relevant scenarios, even though the ATN structure is identical for all scenarios. User Initiative Commands ?Queries ?Requests Appreciates Introduction ?Greting Commands ?Queries ?Requests Attack Panic Go Catatonic Emotion Computation Confusion Response Denial Challenge Question Get In the Car Respond Informs Threats Understands Commands Figure 5: Grammar to ATN Mapping Emotional Models Our emotion models were built using several emotion and personality theories, including the Five Factor Model [2,42], Circumplex theory [34], and cognitive theory of emotions [33]. The latter model underscores most of our work, providing a scheme for labeling common emotions based on how our virtual humans react to inputs, events, and objects [1]. We also include an ?emotion reasoning architecture? to describe how personalities can change over the course of an interaction [10], though we refrain from rapid large fluctuations in emotional states since users usually believe in virtual humans who have a consistent behavior [38]. Our emotions determine behavior much in the same way as the emergence conditions described elsewhere [3]. After user input, we update emotional state based on three input characteristics, the format of the input (e.g., command, request, query, inform, threat), lexical analysis of the input (for politeness, personalization, level or statement of concern, threat or insult,profanity), and semantic content of the input (i.e., the interview topic). We also rely on the very little research on emotion expression in schizophrenia and depression [4,27]. What we do understand is that schizophrenic facial expressions are least expressive but more responsive than depressed to positive stimuli, schizophrenics show more negative emotions than normals, schizophrenics are less likely than normals to demonstrate ?felt? HAPPINESS, and that, when appropriate, normal individuals show HAPPINESS more than CONTEMPT, DISGUST, or ANGER, while schizophrenics are more likely to show CONTEMPT, but still are unlikely to show DISGUST or ANGER. Gestural Models For a system to train how to perceive behaviors indicative of mental illness, the behaviors must be realistic and responsive. Virtual human behavior takes many forms, including verbal output, gesture, body movement, and change of internal emotional and cognitive states. We worked with experts to devise algorithms and data structures that determine how the virtual human is to behave given inputs such as current emotional state and interpretation of user verbal input (see Table 1). For instance, using these Behavior Engine resources, the schizophrenic knows to begin pacing when his emotional state reaches a certain threshold of anger or fear, as it might when the user issues an unexpected command or when the topic of conversation is particularly upsetting. Other gesture research also has influenced how we model virtual human behavior. For instance, children's gestures are larger than adults [6]. So are the gestures, as a rule, in some cultures compared to others [6]. Social roles and status (identity, age, familial relationship), emotion (e.g., sad look down), and truthfulness of an utterance all affect eye contact [38]. Unfamiliarity leads to placing oneself at bigger interactional distance than does familiarity, and avoiding aggressive gestures [18]. Finally, schizophrenics attempt to maintain greater distance, less involvement than healthy subjects from interaction partner, both on a mental and behavioral level [27]. CONCLUSION Figure 6 shows some screen shots from JUST-TALK. We tested the next iteration of the application in the same course at NCJA in May 2002 and again in October. Figure We have at least five technical development goals we feel we need to achieve to improve our virtual human architecture. First, we need to continue extensive testing and recording of inputs to improve recognition of student utterances. This is a key effort in making the virtual humans more realistic. The natural language processing methods provide many opportunities for tuning the system to provide better responses. This tuning is an iterative testing approach where the recognition accuracy can be measured and continually improved. Second, we need to look to increasing visceral or intrinsic engagement, rather than just linguistic or conversational engagement. This will take two thrusts, adding realism to the background and replacing the generated speech with pre-recorded speech. ? The existing technology, upon which JUST-TALK is based, uses a modeled (i.e., not photo-realistic) VR background. To increase user engagement, a photo-realistic background created using RTI's Video Reality technology will be integrated into the interaction environment. Integrating Video Reality will require interfacing to its rendering code from the Visualization Engine, and building a module to convey the camera geometry information associated with the video environment. When appropriate, the audio stream must be decoded and played synchronously with the image stream, while environmental sound must be provided separately. Branching and idle behaviors must be provided in the video stream, requiring careful filming and editing. We need to improve the realism of virtual subject's verbal replies. JUST-TALK used a computer-synthesized voice, but students and instructors indicated that using a recorded voice is highly desirable. Many nuances of determining psychological state can be picked up only through vocal inflections. Third, we need to provide more gesture cues. In the newer, more immersive, visualization environment, the virtual human is allowed greater movement and gesture. We created hundreds of animations to portray as necessary, from pacing to sitting to fleeing, and from looking around to looking at the user to looking for nonexistent voices. We are using the gesture processing software in a variety of projects ranging from training emergency room staff to recognize potential bio-terrorism attacks to training Special Operations soldiers in first aid. JUST-TALK will import and leverage the gesture databases and software upgrades being developed by these parallel efforts. Still, work remaining to do includes providing more range of movement, in facial gestures and lip synching. Fourth, we need to improve the emotional model. Working with experts, we need to reconsider the base emotional states and devised new methods for updating emotional state. Current emotional state now relies heavily on past emotional state, but also syntactic and semantic content of the user's input, personality, environmental cues, and time course. Still, we have ongoing work with psychiatrists, law officers, and other experts to develop more sophisticated emotional models, based on clinical experience and training of police crisis intervention teams. Fifth, most students made some assessment about the subject in the training, noting that he was dressed relatively nicely, spoke as if he were well-educated and appeared to only recently have been having mental difficulties. But they noted that few other visual cues were available to them as students, including facial movements. And, although the subject reacted negatively to the police in several scenarios, students said he did not represent the extreme fear or dislike of police that students said they commonly encounter. The preset viewpoint (users could manipulate the view but rarely did) made it difficult to see the details of the subject's particularly when the subject stood behind the bench. We are now adjusting viewpoints appropriately to help provide more cues. We are continuously refining our models. However, what we have already learned from fielding schizophrenic, depressed, and normal virtual humans we expect will lead to much more realistic, and engaging and effective, learning environments for interaction skills. ACKNOWLEDGEMENTS This material is based on work supported by RTI under SCDA R9898.001, the National Institute of Justice under Cooperative Agreement 2000-RD-CX-K002, and the National Science Foundation under Grant No. EIA-0121211. We thank Randy Dupont at the University of Tennessee at Memphis, Deborah Weisel at the North Carolina State University, and Martie Stanford and Pam Pope at the North Carolina Justice Academy for theirassistance and efforts. --R Emotional Experience and Expression in Schizophrenia and Depression. Animated Conversation: Rule-based Generation of Facial Display Using the Affective Reasoner to Support Social Simulations. Concept of Emotion Viewed From a Prototype Perspective. Cognitive Modeling: Knowledge Nonresponse in Household Interview Surveys. Virtual Reality Training-Is It For You? Talk presented at the American Society for Training and Development International Conference Mechanisms for Mixed-Initiative Human-Computer Collaborative Discourse Natural language Processing in Virtual Reality. Interactive Training Applications using Responsive Virtual Human Technology. Virtual Humans for Training with Computer Generated Forces. The Virtual Standardized Patient-Simulated Patient-Practitioner Dialogue for Patient Interview Training Animated Pedagogical Agents: Face-to-Face Interaction in Interactive Learning Environments Virtual Medical Trainer: Patient Assessment and Trauma Care Simulator. Sources of Power. The Art and Science of Synthetic Character Design. Nonverbal Communication in Human Interaction (3rd Lifelike Pedagogical Agents for Mixed-Initiative Problem Solving in Constructivist Learning Environments Developing a 3D-Agent for the August Dialogue System Talking Heads: Facial Animation in The Getaway. The Simulation of a Human for Interpersonal Skill Training. The Cognitive Structure of Emotions. The Circumplex as a General Model of the Structure of Emotions and Personality. A Measure of Semantic Complexity for Natural language Systems. Social Role Awareness in Animated Agents. Preparing for the Instructional Technology Gap-A Constructivist Approach Improvisational Synthetic Actors with Flexible Personalities. How Shall an Emotion Be Called? The emotions and the dimensions of discrimination among them in daily life. Effects of Variable Initiative on Linguistic Behavior in Human-Computer Spoken Natural language Dialog The Five Factor Model of Personality: Theoretical Perspectives. --TR Animated conversation Personality-rich believable agents that use language Cognitive modeling More than just a pretty face Social role awareness in animated agents Lifelike Pedagogical Agents for Mixed-initiative Problem Solving in Constructivist Learning Environments Fully Embodied Conversational Avatars --CTR Curry Guinn , Rob Hubal, An evaluation of virtual human technology in informational kiosks, Proceedings of the 6th international conference on Multimodal interfaces, October 13-15, 2004, State College, PA, USA Lucio Ieronutti , Luca Chittaro, Employing virtual humans for education and training in X3D/VRML worlds, Computers & Education, v.49 n.1, p.93-109, August, 2007
agents;behavior modeling;interaction skills training;managing encounters with the mentally ill;responsive virtual humans
604075
A reliable natural language interface to household appliances.
As household appliances grow in complexity and sophistication, they become harder and harder to use, particularly because of their tiny display screens and limited keyboards. This paper describes a strategy for building natural language interfaces to appliances that circumvents these problems. Our approach leverages decades of research on planning and natural language interfaces to databases by reducing the appliance problem to the database problem; the reduction provably maintains desirable properties of the database interface. The paper goes on to describe the implementation and evaluation of the EXACT interface to appliances, which is based on this reduction. EXACT maps each English user request to an SQL query, which is transformed to create a PDDL goal, and uses the Blackbox planner [13] to map the planning problem to a sequence of appliance commands that satisfy the original request. Both theoretical arguments and experimental evaluation show that EXACT is highly reliable
Table 1: The ?message_list? table is one of five relations comprising the database that EXACT uses to represent the state of the Panasonic KXTC1040W. message_number message Old Old Note that while we have fully implemented the EXACT NLIA, we have tested it on a simulation of the Panasonic device, rather than the actual appliance hardware; we have not done the wiring and tinkering that would be required to actually drive the appliance. Nevertheless, our command set was taken directly from the manual for the appliance [1], so we are confident that our simulation is realistic. Our expertise is not in speech; hence the focus of this paper is on developing an expressive NLIA as a step towards the ultimate goal of linking it to a speech recognizer. In contrast with the work of Moore, Allen, and Walker [30, 3, 26], we have not built a full-blown dialog system. Instead, we focus on the core capability of understanding single-sentence appliance commands such as ?Cook my corn for 5 minutes? as well as goals such as ?Delete my old messages,? which requires a multi-step plan to find each old message and erase it in turn. Thus, our NLIA implements a function from a single English sentence encoding a person's request to a command sequence that satisfies the request when executed on the appliance. Due to its reliability, we believe that our NLIA would be an attractive module for researchers investigating dialog systems. While our model is readily extensible to multiple devices in a networked home, we have not yet addressed the issue of identifying which device the user is addressing based on context or content. However, the straightforward approach of explicitly naming a device when addressing it seems reasonable. For example, a person could say ?VCR: record Seinfeld.? Finally, we assume that the NLIA has an accurate behavioral model of the appliances with which it integrates. If exogenous events can affect the device (e.g., an external caller leaving a message), we assume that the device will notify the NLIA of this fact. This assumption is reasonable because all existing devices we surveyed notify the user of exogenous events (e.g., the phone rings, the answering machine displays a count of new messages, and the thermostat display indicates whether the furnace is on or off). While our implemented system depends on this assumption, our overall approach does not. By using a more complex, information-gathering planner such as PUCCINI or XII [9, 10, 11], our NLIA would operate correctly even without notification of these events. Interpreting a user's commands is more complex if there are multiple plans being executed at the same time. In this case a user's command can affect not just the appliance, but also the agent's execution stack of previously planned actions. Thus, we assume that the NLIA will process new requests only after previously planned actions have been fully executed. 4. NLIA BY REDUCTION In this section we show how to build an NLIA using an NLIDB and a planner. The reduction is based on the observation that user commands to an appliance are made relative to the device's state, either by querying the state (e.g., ?When is the sprinkler system set to water??) or modifying it (e.g., ?Set the thermostat to 68?. Since a relational database is a convenient and natural way to conceptualize a device's state, a user's command can be modeled with SQL statements, and can be computed using an NLIDB. In order to create a full NLIA, however, we need to show a method for satisfying the SQL query and update statements, using the device's primitive command set ? for this task, we use a planning algorithm. As we argue below, one of the advantages of this approach is the construction of a reliable (i.e., sound and complete) NLIA by exploiting the formal properties of existing NLIDB and planning systems. Formally, we model an appliance as a pair, <A, DB>, where A is a set of action descriptions in the PDDL planning language [15] and DB is a database representation of the appliance's initial state. For example, table 1 shows a fragment of a sample relation from the database model of its internal state, and figure 1 shows some sample actions for the Panasonic phone. (:action delete-message :parameters (?x - integer) :precondition (and (leq 1 x) (leq x 64) (playing ?x)) :effect (and (not (playing ?x)) (when (leq ?x 63) (playing (+1 ?x))) (forall (?y) (and (not (message-list ?x ?y ?z)) (message-list ?x Blank Old))))) (:action play :parameters :precondition (not (playmode)) :effect (and (playmode) (playing (not (message-list 1 New)) (message-list 1 Old))) (:action play-next :parameters :precondition (playmode) :effect (forall (?x) (when (and (playing ?x) (leq ?x 63)) (and (not (playing ?x)) (playing (+1 ?x)) (not (message-list ?x New)) (message-list ?x Old))))) Figure 1: PDDL encoding of some Panasonic KXTC1040W actions. Our NLIA is composed of four parts: the appliance model <A, DB>, an NLIDB, a translation module, and a planner. At run- time, the system takes as input a natural language sentence and feeds it to the NLIDB (figure 2). The NLIDB converts the input to an SQL statement consistent with the schema of database DB. If the SQL denotes a query, it is executed on DB and the result is returned to the user. For example, the English question, ?what is the answering machine volume?? is mapped to the following SQL query: SELECT volume FROM answer_machine EnglishInput Devices Plan NLIA SQL statements Translator Goal A Planner Figure 2: Building an NLIA out of an NLIDB and a Planner. The gray box depicts the NLIA. If the SQL is an update, the translator converts it into a goal in the planning language, which is then sent to the planner to generate a sequence of actions from A. When these actions are executed on the appropriate devices (and also when exogenous events occur), DB is updated to ensure correspondence with the device's actual state. We are able to skip the translation and planning stages in the case of a SELECT query because of our assumption that the database contains the complete state of the appliance. If this assumption were not met, it might be the case that several actions would have to be taken before the action that answers the query, and such a case would require planning. The translation step, converting from an SQL update statement to a goal, requires some explanation. As Reiter has shown [22], database updates can be modeled using the situation calculus; for our purposes PDDL suffices also. Without loss of generality, suppose that DB has relational schema X each relation Xj has attributes aj1, ?, ajk, where k varies from table to table. DB contains a set of tuples satisfying each Xj and because of our earlier assumption regarding notification of exogenous events, we can make the closed world assumption [23]. An SQL update statement has the form: SET a =c , ?, a =c WHERE a =c , ?, a =c where the ai are attributes of Xj, and the ci are constants. We can convert this SQL statement into a PDDL goal with a process similar to that used for generating a propositional form for a universally quantified goal in classical planning [27]. The first step is running the following SQL query on DB, the agent's model of the device. SELECT DISTINCT a , ?, a WHERE a =c , ?, a =c Execution of this query will retrieve a set of tuples, {ti}, whose values need to be modified. Let {ti'} denote the corresponding set of tuples obtained by changing the value of the jth attribute of each tuple to cj, for all m denote the set of all tuples in DB, and let CWA denote the function which computes the closure of a set of relational atoms.3 The planner is given the following ground problem: The reason for grounding the goal during the translation step is somewhat subtle. The SQL UPDATE command's SET clause refers to the goal state, i.e. the desired state of the device after the plan has been executed. In contrast, the WHERE clause refers to the state of the device before any changes are made; that is, it refers to the device state at the commencement of planning. Unfortunately, PDDL has no notation for making this distinction4, so if the translation step left any universally quantified variables in the resulting goal, they would all refer to the goal state, or the state after the plan. 4.1 Safety Revisited We include ? as part of the goal to ensure that the planner doesn't generate a plan that has the nasty side effect of falsifying something that is currently true. For example, the simplest plan to delete all old messages is to delete all messages, new and old (the phone has a single command to do this). By explicitly stating in the goal that new messages should not be deleted, we force the planner to come up with a safe plan. Similarly, we would not want the planner to respond to ?call Sue? by first randomly recording a new answering machine greeting, and only then placing the call. Thus, we prevent the planner from unwanted positive side effects by computing the CWA. In domains where resource usage or other side effects are necessary, one can exclude predicates describing these resources from the goal. As an example of this reduction in action, consider the operation of our Panasonic phone NLIA on the sentence, ?Delete all my old messages.? Assume that this NLIA is given the actions from Figure 1 and the database fragment from Table 1 as part of its inputs. The NLIDB translates the input sentence into the SQL statement: message_list Our translator takes this SQL statement and performs the syntactic manipulation required to rewrite it as a grounded goal in PDDL. Let <old-msg-num-1> through <old-msg-num-n> represent the numbers of all the old messages in the message_number column of table message_list, and let <new-msg-num-1> through <new- msg-num-m> represent the numbers of all the new messages. In PDDL the grounded goal looks like: (and (not (message-list <old-msg-num-1> Old)) (message-list <old-msg-num-1> Blank) (not (message-list <old-msg-num-n> Old)) (message-list <old-msg-num-n> Blank) (message-list <new-msg-num-1> Old) (message-list <new-msg-num-m> Old)) For brevity's sake, we omit the other relations in the database from the above goal. The planner takes this goal, together with the initial 3 Closing a set of positive literals means explicitly adding the negation of any atom, which is absent from the set. If the set of relations and constants is finite and there are no function symbols (which is our case), this operation takes polynomial time. 4 See, for instance, SADL [8] for an action description language that does provide notation to distinguish between the initial and goal states. state in the database DB, and returns a plan starting with the play action. Next, the plan will contain a delete-message action if message number one is one of <old-msg-num-1> through <old- msg-num-n>, and a play-next action otherwise. This repeats until all 64 messages have been checked and deleted if they are old. 4.2 Formal Properties We are now in a position to state the benefits of our NLIA reduction precisely. Abstractly, one can consider an NLIDB, N, as a function from English sentences to SQL statements. Similarly our translator, (described above), is a function from SQL to planning problem specifications.5 Finally, a planner is a function from these problem specifications to action sequences. Since an NLIA takes an English sentence, ?, and generates action sequences for the appliance, one can summarize our reduction as follows: et al. [20] define the conditions under which an SQL statement is a valid interpretation of an English sentence ?, but the definition is too complex to include in this paper. We borrow from [20] the far simpler definitions of soundness and completeness below. An NLIDB is sound if any SQL it outputs is a valid interpretation of its input sentence ?. An NLIDB is complete if it returns all valid interpretations of ?. Note that if an NLIDB is both sound and complete and it returns a single SQL statement in response to a user's utterance, then it has unambiguously determined the user's intent ? subject to our assumptions, of course. Definition. Let S be an SQL statement over a relational database DB. An appliance reaction R is consistent with S if S is a query and R answers the query, or if S is an update and R is a sequence of legal device commands that changes DB accordingly. An NLIA is sound if in response to input ?, its reaction is consistent with some valid interpretation of ?. An NLIA is complete if it makes a consistent reaction to a valid interpretation of ?, when one exists. There are a variety of formulations of automated planning [19], but we briefly summarize with the following. A planner is sound if any plan it outputs will transform the initial situation into a world state where the goal holds. A planner is complete if it returns a plan when one exists. We can now formally state the two central benefits of our reduction: Proposition 1 [Soundness]. Let N be a sound NLIDB, let P be a sound planner, and let T be the translation scheme described above. is a sound NLIA. Proposition 2 [Completeness]. Let N be a complete NLIDB, let P be a complete planner, and let T be the translation scheme described above. Then P The proofs are omitted due to lack of space. 4.3 Significance of the Theory Of course, theoretical guarantees only apply in practice if their assumptions are satisfied (e.g., all the words in the sentence are known ? see [20] for the complete enumeration). Our experimental results (section some evidence that these assumptions are realistic. 5 Given a fixed set of actions, a planning problem is an initial state / goal thus T maps from SQL to the cross product of tuple specifications with itself. Another potential objection to our theory is that it does not guarantee the reliability of a full-blown conversational speech speech recognition, in particular, is likely to result in errors. While this is clearly true, we see great value in having an NLIA that is guaranteed to reliable ? this enables the interface designer to localize errors to other modules and to institute the appropriate recovery strategy. Consider, by way of analogy, a sophisticated chess-playing program that combines mini-max search with alpha-beta pruning, a complex and tunable evaluation function, specialized hardware, etc. Suppose we prove that alpha-beta pruning is ?reliable? in that it only prunes moves that the search procedure would eventually discard. Well, the reliability of alpha-beta pruning does not guarantee that the chess program always makes the best move. However, when the program makes a mistake, we know that it is definitely not due to alpha-beta pruning. Again, the guaranteed reliability of one module, enables the program's designer to focus his attention on other modules. 5. THE ?EXACT? IMPLEMENTATION In order to test the theory developed in section 4, we built the EXACT natural language interface to a telephone using the Precise NLIDB [20] and Blackbox planner [13] as foundations. We handcrafted a database model for the Panasonic KXTC1040W from its user manual [1]. This model is used both as an input to the Precise NLIDB and as the source of state information for the planner. Finally, we created a set of actions that model the phone's commands, as described in the user manual. This action set is also input to the planner. The system takes an input sentence, converts it into a set of possible SQL statements using Precise, translates those into a set of goals, and looks for a plan to satisfy each goal. If there is more than one goal and at least one goal has a plan, then we have an ambiguous sentence, and EXACT needs to ask the user for help in disambiguating. If no goal has a plan, then the phone cannot support the function being asked for, so EXACT can tell the user as much. If there is exactly one goal and it has a plan, EXACT can simply carry out that plan. In our experiments, the last case was by far the most common. The dataset on which we evaluated our system includes examples of impossible requests, but EXACT is well equipped to handle this problem: if a sentence does not map to an appropriate SQL statement, either because of unknown words or because there is no attribute-value pairing for the sentence, then we can say that the NLIDB cannot understand the sentence. On the other hand, if the sentence maps to an SQL statement, but the planner fails to find a plan for that goal, then since our planner is complete we can say that the appliance does not support this function. Our interface inherits desirable qualities, like reliability and portability across many appliances, from the planner and the NLIDB, but we had to make extensions to both components as explained below. 5.1 The NLIDB Component Precise is a highly portable NLIDB that guarantees soundness of its SQL interpretations for certain kinds of English sentences, called semantically tractable questions [20]. Precise automatically generates a lexicon based on the names of relations, attributes, and values in its input database. At its core, it reduces the problem of mapping a sentence to an SQL query to a graph-matching problem, which can be solved using the maxflow algorithm. Precise relies on the Charniak parser to extract attachment information from the sentence to help constrain the matching problem. Finally, Precise generates the complete set of possible SQL interpretations of the sentence that are consistent with its lexicon and its parser. Precise was originally built to support only questions, which translate to SELECT queries in SQL. Since an NLIA has to respond to requests for changing the state of the appliance, which translate naturally to SQL UPDATE statements, we had to extend Precise appropriately. There is no room to explain the technical details of Precise, but the essence is an extension of Precise's graph matching algorithm to keep track of two attributes, a ?pre-attribute? and a ?post-attribute.? The pre-attributes contain values in the database state before an UPDATE, and the post-attributes contain the new, updated values. Any values that are set by an UPDATE statement are matched with post-attributes, and all other values are matched with pre-attributes. In order to understand an input sentence, the system needs to classify it as an UPDATE or a SELECT, and proceed appropriately. Precise's other modules, including its tokenizer, lexicon, and parser, remain unchanged. 5.2 The Planning Component We have already explained how we prevent unwarranted side effects and how we finesse the problem of information gathering. But the domain of household appliances also has a surprising amount of temporal complexity. First, user commands may involve events occurring at specific future times (e.g., ?record Star Trek?). While one could use a temporal planner to handle these goals, we instead rely on the temporal capabilities of the device itself. Since it is possible now to set a VCR to program later, EXACT can handle this goal with a classical planner. If the VCR did not support this type of operation, EXACT would explain that the goal was unachievable. Second, numerous actions are durative; execution occurs over an interval of time (e.g., ?play all messages?). Although it might seem natural to model the temporal aspects of these actions explicitly (e.g., in PDDL 2.1 level 36), we tried this and discovered problems (see below). Finally, different commands naturally translate into goals with different temporal annotations, but the nature of the temporal mapping is complex and subtle. For example, consider the command ?Play all messages.? Note that the user (presumably) doesn't want the answering machine to play the messages forever; once is enough. Thus if one models 'play' as a durative action (which transiently plays a message), one cannot model the goal as one of achievement. In a durative model, the goal has an implicit temporal annotation that it must be true at some point during execution, even if it is not true at the end of all execution. There are two problems with such a model. First, few planners support such indeed PDDL 2.1 level 3 does not even allow one to express the goal. But the deeper problem is related to disambiguating natural language. Consider the commands ?Play all messages? (which does not require playing to be true at the end of the plan) and ?Turn on answering machine? (which does). We could think of no principled way to distinguish between these goals; clearly the user would be very upset if EXACT responded to the last command by turning answering on and then off again! Our solution is to use a classical atomic model of time, implicitly recognizing that exogenous events may subsequently change the device state. Philosophically, this is consistent with PDDL 2.1 level 5 in which all actions are instantaneous, but some may initiate 6 http://www.dur.ac.uk/d.p.long/competition.html physical processes (in this case the process of a message being played) that evolve over time. We do not need to model the processes explicitly, since (by assumption) the networked device notifies the agent of events such as incoming messages. Thus execution of the play command does not terminate with the device playing; it simply stops later of its own accord. By modeling the device in this fashion, we are able to use the Blackbox planner [13], which operates by compiling PDDL planning problems into a set of propositional clauses that is satisfiable exactly when an n-step plan exists. A fast satisfiability algorithm is used; if an assignment is found, a reverse compilation phase generates the plan; otherwise, the plan length is incremented. 6. EXPERIMENTAL EVALUATION To test our system, we gathered a total of 72 sentences from seven graduate students and faculty at the University of Washington. The people who provided us with data were given a concise list of the features available on the Panasonic phone and were asked to write down sentences in English that they might use to invoke those features. Of the 72 sentences gathered, we used 61 in our experiments. The eleven sentences we excluded did not describe a goal or an action, but rather they implied it. For example, we excluded the sentence, ?It's too loud.? This sentence does not describe a goal state or an action to achieve a goal. Instead, it describes the current state and implies the goal. Such sentences clearly demonstrate the importance of processing speech acts, but are beyond the current capabilities of EXACT. 100% 100% 100% 100% 80% 40% 20% 0% 82.0% 86.9% 88.5% Recall Precision Figure 3: EXACT's performance in our experiment. Figure 3 shows EXACT's performance on our dataset. Recall is the fraction of the sentences in the dataset where EXACT put forth an interpretation.7 We refer to these sentences as tractable sentences. On intractable sentences, EXACT indicates it cannot understand the request and asks for a paraphrase. Precision is the fraction of the tractable sentences in the dataset that EXACT interpreted correctly (including the interpretation that the sentence was an impossible request, where appropriate). To measure precision and recall on our data, we labeled each sentence with one or more valid interpretations.8 As the black bars in the figure show, we achieve 100% precision on our dataset, 7 Remember that to maximize reliability, EXACT does not try to ?guess? the correct interpretation when it is not sure. 8 EXACT's interpretation is correct if it is a member of the set of valid interpretations. reflecting our commitment to reliability and the utility of our underlying theory. EXACT's recall is 82.0% because on eleven sentences it is unable to choose a definitive interpretation. If we allow EXACT to ask the user to choose between two possible interpretations (EXACT- 2) the recall goes up to 86.9%, and if the user may choose between up to four interpretations the recall goes up slightly to 88.5% (EXACT-4). In the remaining cases, EXACT is unable to interpret the sentence because it contains words outside of EXACT's lexicon. Unlike some natural language interfaces, EXACT does not attempt to ignore unfamiliar words. To ensure reliability, EXACT declines to interpret a sentence that contains any unknown words. The increasing recall from EXACT to EXACT-2 and then to EXACT-4 quantifies the amount of ambiguity in our data. Two sentences have exactly two interpretations; both cases reflect the fact that the phone has two different volume settings (one for the answering machine and one for the ringer). For a sentence like, ?Turn up the volume,? there are two interpretations, and both are potentially correct. Only one other input sentence has multiple interpretations in our data, and that is the somewhat idiosyncratic single-word command ?Aloud.? The four interpretations of this sentence are actions to turn on the speakerphone (the intended goal), turn on the handset ringer, turn on the intercom, and playback messages, all of which play sounds aloud. With further tuning of the system, such ambiguities could be resolved. 7. FUTURE WORK There are a number of important directions for future work. First, we need to test EXACT on a much wider range of users and appliances. Second, we need to link EXACT to actual device hardware, and to a speech recognizer. Third, we need to address the user interface issues that arise due to speech recognition errors and hardware problems. For example, it is appropriate for EXACT to confirm its plans with the user before taking some actions, but excessive confirmation can be a nuisance to the user. Finally, it will be essential to enable EXACT to participate in full-blown dialogs with users. Such dialogs would enable EXACT to choose between multiple competing interpretations and to learn new words, phrases, or idioms, thereby improving its recall. 8. RELATED WORK We build on the large body of work in natural language interfaces to databases. See Androutsopoulos et al. [4] for a survey. Only a small number of NLIDBs handle updates, and none have considered the NLIA problem. Our emphasis on provable soundness as a foundation for a reliable natural language interface is shared with Popescu et al. [20], but our work on EXACT goes beyond Precise in several important ways. First, we introduce and analyze the idea of reducing the NLIA problem to the NLIDB problem while maintaining the soundness and completeness of the interface. Second, EXACT composes Precise with a planner to automatically generate an NLIA. Third, we extended Precise to handle updates. Finally, we show experimentally that linking EXACT to a 'typical' household appliance, the Panasonic KXTC1040W phone, yields a highly reliable interface that can handle goals, impossible requests, and safety concerns. Young and Moore [30] have described DPOCL, a sound discourse planner that satisfies a limited form of completeness. They argue that the formal properties of previous discourse planners have been largely ignored, and that this lack of understanding leads to inconsistencies in the representation of discourse. Their focus, however, is on representing speaker intentions in texts. EXACT focuses on simpler natural language utterances, and seeks to use them to control household appliances. Quesada et al. [21] describe a spoken dialogue agent in the D'Homme project that is specifically designed for interacting with household appliances. The agent uses a semantic grammar for a restricted and tractable subset of natural language that they call a Natural Command Language. The D'Homme agent is capable of understanding complex natural language dialogs, but it does not guarantee reliability. The agent also has no built-in planning capability, so it cannot handle all goals that require multi-step plans. A number of commercial systems are being built to handle dialog with household appliances. Some examples include the Linguamatics Automated House9, the SmartKom Home/Office10, the Fluency House11, and Voxi Smart Homes12. As these are commercial systems, they do not report vital information about their mechanisms. TRIPS (Allen, et al. [3]) is an agent architecture for handling natural conversation in the travel-planning domain. In contrast to this kind of system, EXACT is designed to be easily portable to a number of different domains, and the domains of interest generally have a much simpler structure to the natural language interaction. The Universal Speech Interface (USI) [25] project at CMU has design goals very similar to ours. USI/Gadget is a template system that is portable to many different appliances. The natural language capabilities of the system, however, are constrained by the speech recognition technology, so the interaction is keyword-based. Various ubiquitous computing projects (e.g., MIT's intelligent room [6]) have considered multi-modal interfaces that include language. However, they have not considered the reliability of the language module, nor have they considered embedding a planner into the system to satisfy high-level goals, decline impossible requests, and abide by safety constraints. A number of other researchers have modeled appliances and developed specification languages (e.g., in XML) for appliance interfaces [2, 8, 12, 18]. Systems designed around these specifications have tried to create a single interface to all appliances on another, remote appliance like a PDA. The Personal Universal Controller (PUC) [16] generates an interface to appliances, using XML specifications. Unlike EXACT, the PUC executes simple commands, not plans, and does not use natural language. The menu2dialog system [14] creates a dialog planning system from a menu-based natural language system. It is not fully automated, however, and it does not consider the problems of reliability and safety. Like EXACT, Softbots [7] use planners to develop complex plans on behalf of users. However, one drawback of softbot-based interfaces has been their lack of natural language capabilities, which can make them difficult to use, especially for novice users. 9http://www.linguamatics.com/technology/dialogue/home.html 11http://visualhouse.fluencyvoice.com/housecgi/fluencyHouse.html The Unix Consultant (UC) [29] is a natural language tutoring system for Unix. Although UC was designed as an interface to a device, UC has a very different focus from EXACT. UC is not portable across many devices; instead, its focus is on a complete model of a single, highly complicated ?device? (the Unix shell). Furthermore, its response to user input is to advise the user on how to accomplish his or her goal, rather than performing actions itself. Finally, due to its complexity, UC makes no reliability guarantees. 9. CONCLUSION This paper sketches a novel answer to the fundamental question: how do we build a reliable natural language interface to household appliances? Our answer, encapsulated in Figure 2, is to leverage more than thirty years of research on natural language interfaces in databases and reduce the appliance problem to the database problem. We show how, when coupled with a planner, this approach has a number of advantages, including formal guarantees of soundness, the ability to enforce safety, and the ability to appropriately handle high-level goals and impossible requests. Our preliminary experiment complements our theoretical arguments by showing that our interface in fact displays these advantages in practice. 10. ACKNOWLEDGEMENTS We thank Ana-Marie Popescu for her help with using and extending the Precise system. We thank Krzysztof Gajos, Keith Golden, Tessa Lau, Mike Perkowitz, and the anonymous reviews for their insightful comments on previous drafts. This research was supported in part by NASA grant NAG 2-1538, NSF grants IIS-9872128 and IIS-9874759, and ONR grants N00014-02-1- 0932 and N00014-02-1-0324. 11. --R Panasonic Cordless Answering Sys. UIML: An Appliance-Independent XML User Interface Language An architecture for more realistic conversational systems. Natural Language Interfaces to Databases A Context Sensitive Natural Language Modality for the Intelligent Room. A Softbot-based Interface to the Internet A Universal Information Appliance. Leap Before You Look: Information Gathering in the PUCCINI Planner. Omnipotence without Omniscience: Sensor Management in Planning. Representing Sensing Actions: The Middle Ground Revisited. BLACKBOX: A New Approach to the Application of Theorem Proving to Problem Solving. IJCAI Workshop on Knowledge And Reasoning In Practical Dialogue Systems Generating Remote Control Interfaces for Complex Appliances. How Might People Interact with Agents? UCPOP: A Sound Towards a Theory of Natural Language Interfaces. Dialogue Managements in a Home Machine Environment: Linguistic Components over an Agent Architecture. Knowledge in Action: Logical Foundations for Specifying and Implementing Dynamical Systems. On closed world databases. Interface Agents A Unified Design for Human-Machine Voice Interaction Learning Optimal Dialogue Strategies: A Case Study of a Spoken Dialogue Agent for Email. An Introduction to Least-Commitment Planning The First Law of Robotics (a call to arms). The Berkeley Unix Consultant Project. DPOCL: A Principled Approach to Discourse Planning. --TR A softbot-based interface to the Internet The first law of robotics (a call to arms) Omnipotence without omniscience Direct manipulation vs. interface agents How might people interact with agents UTML A universal information appliance Cross-modal interaction using XWeb An architecture for more realistic conversational systems Generating remote control interfaces for complex appliances Towards a theory of natural language interfaces to databases --CTR Ana-Maria Popescu , Oren Etzioni , Henry Kautz, Towards a theory of natural language interfaces to databases, Proceedings of the 8th international conference on Intelligent user interfaces, January 12-15, 2003, Miami, Florida, USA Lina Zhou , Mohammedammar Shaikh , Dongsong Zhang, Natural language interface to mobile devices, Intelligent information processing II, Springer-Verlag, London, 2004 Jim Blythe, Task learning by instruction in tailor, Proceedings of the 10th international conference on Intelligent user interfaces, January 10-13, 2005, San Diego, California, USA Koskela , Kaisa Vnnen-Vainio-Mattila, Evolution towards smart home environments: empirical evaluation of three user interfaces, Personal and Ubiquitous Computing, v.8 n.3-4, p.234-240, July 2004 Kevin Livingston , Christopher K. Riesbeck, Knowledge acquisition from simplified text, Proceedings of the 12th international conference on Intelligent user interfaces, January 28-31, 2007, Honolulu, Hawaii, USA Henry Lieberman , Jos Espinosa, A goal-oriented interface to consumer electronics using planning and commonsense reasoning, Proceedings of the 11th international conference on Intelligent user interfaces, January 29-February 01, 2006, Sydney, Australia Silyan Arsov, An approach for response generation of restricted Bulgarian natural language queries, Proceedings of the 5th international conference on Computer systems and technologies, June 17-18, 2004, Rousse, Bulgaria Ana-Maria Popescu , Oren Etzioni , Henry Kautz, Towards a theory of natural language interfaces to databases, Proceedings of the 8th international conference on Intelligent user interfaces, January 12-15, 2003, Miami, Florida, USA Emerson Cabrera Paraiso , Jean-Paul A. Barths, An intelligent speech interface for personal assistants applied to knowledge management, Web Intelligence and Agent System, v.3 n.4, p.217-230, January 2005 Emerson Cabrera Paraiso , Jean-Paul A. Barths, An intelligent speech interface for personal assistants applied to knowledge management, Web Intelligence and Agent System, v.3 n.4, p.217-230, October 2005
planner;appliance;database;natural language interface
604133
Selective memoization.
We present a framework for applying memoization selectively. The framework provides programmer control over equality, space usage, and identification of precise dependences so that memoization can be applied according to the needs of an application. Two key properties of the framework are that it is efficient and yields programs whose performance can be analyzed using standard techniques.We describe the framework in the context of a functional language and an implementation as an SML library. The language is based on a modal type system and allows the programmer to express programs that reveal their true data dependences when executed. The SML implementation cannot support this modal type system statically, but instead employs run-time checks to ensure correct usage of primitives.
We describe the framework in the context of a functional language and an implementation as an SML library. The language is based on a modal type system and allows the programmer to express programs that reveal their true data dependences when executed. The SML implementation cannot support this modal type system stati- cally, but instead employs run-time checks to ensure correct usage of primitives. Categories and Subject Descriptors [Programming Languages]: General; F.2.0 [Analysis of Algorithms and Problem Complexity]: [General]; D.3.1 [Programming Languages]: Formal De?nitions and Theory; D.3.3 [Programming Languages]: Language Constructs and Fea- tures?Control Structures General Terms Languages, Performance, Algorithms Keywords Memoization, selective, programmer controlled, performance This research was supported in part by NSF grants CCR-9706572, CCR-0085982, and CCR-0122581. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for pro?t or commercial advantage and that copies bear this notice and the full citation on the ?rst page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior speci?c permission and/or a fee. POPL'03, January 15?17, 2003, New Orleans, Louisiana, USA. ACM 1-58113-628-5/03/0001 .$5.00 Memoization is a fundamental and powerful technique for result re-use. It dates back a half century [7, 21, 22] and has been used extensively in many areas such as dynamic programming [4, 9, 10, 19], incremental computation [11, 34, 12, 36, 16, 1, 37, 20, 14, 2], and many others [8, 23, 17, 25, 26, 20]. In fact, lazy evaluation provides a limited form of memoization [18]. Although memoization can dramatically improve performance and can require only small changes to the code, no language or library support for memoization has gained broad acceptance. Instead, many successful uses of memoization rely on application-speci?c support code. The underlying reason for this is one of control: since memoization is all about performance, the user must be able to control the performance of memoization. Many subtleties of memoiza- tion, including the cost of equality checking and the cache replacement policy for memo tables, can make the difference between exponential and linear running time. To be general and widely applicable a memoization framework must provide control over these three areas: (1) the kind and cost of equality tests; (2) the identi?cation of precise dependences between the input and the output of memoized code; and (3) space management. Control over equality tests is critical, because this is how re-usable results are identi?ed. Control over identi?cation of precise dependences is important to maximize result reuse. Being able to control when memo tables or individual their entries are purged is critical, because otherwise the user will not know whether or when results are re-used. In this paper, we propose a framework for memoization that provides control over equality and identi?cation of dependences, and some control over space management. We study the framework in the context of a small language called MFL and provide an implementation for it in the Standard ML language. We also prove the type safety and correctness of MFL?i.e., that the semantics are preserved with respect to a non-memoized version. As an example, we show how to analyze the performance of a memoized version of Quicksort within our framework. In the next section we describe background and related work. In Section 3 we introduce our framework via some examples. In Section 4 we formalize the MFL language and discuss its safety, cor- rectness, and performance properties. In Section 5 we present a simple implementation of the framework as a Standard ML library. In Section 6 we discuss how the framework might be extended to allow for better control of space usage, and discuss the relationship of this work to our previous work on adaptive computation [2]. Background and Related Work A typical memoization scheme maintains a memo table mapping argument values to previously computed results. This table is consulted before each function call to determine if the particular argument is in the table. If so, the call is skipped and the result is returned; otherwise the call is performed and its result is added to the table. The semantics and implementation of the memo lookup are critical to performance. Here we review some key issues in implementing memoization ef?ciently. Equality. Any memoization scheme needs to search a memo table for a match to the current arguments. Such a search will, at minimum, require a test for equality. Typically it will also require some form of hashing. In standard language implementations testing for equality on structures, for example, can require traversing the whole structure. The cost of such an equality test can negate the advantage of memoizing and may even change the asymptotic behavior of the function. A few approaches have been proposed to alleviate this problem. The ?rst is based on the fact that for memoization equality need not be exact?it can return unequal when two arguments are actually equal. The implementation could therefore decide to skip the test if the equality is too expensive, or could use a conservative equality test, such as ?location? equality. The problem with such approaches is that whether a match is found could depend on particulars of the implementation and will surely not be evident to the programmer. Another approach for reducing the cost of equality tests is to ensure that there is only one copy of every value, via a technique known as ?hash consing? [13, 5, 35]. If there is only one copy, then equality can be implemented by comparing locations. In fact, the location can also be used as a key to a hash table. In theory, the overhead of hash-consing is constant in the expected case (expecta- tion is over internal randomization of hash functions). The reality, however, is rather different because of large memory demands of hash-consing and its interaction with garbage collection. In fact, several researchers have argued that hash-consing is too expensive for practical purposes [32, 33, 6, 24]. As an alternative to hash con- sing, Pugh proposed lazy structure sharing [32]. In lazy structure sharing whenever two equal values are compared, they are made to point to the same copy to speed up subsequent comparisons. As Pugh points out, the disadvantage of this approach is that the performance depends on the order comparisons and thus it is dif?cult to analyze. We note that even with hash-consing, or any other method, it remains critical to de?ne equality on all types including reals and functions. Claiming that functions are never equivalent, for exam- ple, is not satisfactory because the result of a call involving some function as a parameter will never be re-used. Dependences. To maximize result re-use, the result of a function call must be stored with respect to its true dependences. This issue arises when the function examines only parts or an approximation of its parameter. To enable ?partial? equality checks, the unexamined parts of the parameter should be disregarded. To increase the likelihood of result re-use, one should be able to match on the approximation, rather than the parameter itself. As an exam- ple, consider the code The result of f depends on either (x,y) or (x,z). Also, it depends on an approximation of x?whether or not it is positive?rather than its exact value. Thus, the memo entry (7,11,20) should match or (4,11,50) since, when x is positive, the result depends only on y. Several researchers have remarked that partial matching can be very important in some applications [28, 27, 1, 14]. Abadi, Lampson, Le?vy [1], and Heydon, Levin, Yu [14] have suggested program analysis methods for tracking dependences for this purpose. Although their technique is likely effective in catching potential matches, it does not provide a programmer controlled mechanism for specifying what dependences should be tracked. Also, their program analysis technique can change the asymptotic performance of a pro- gram, making it dif?cult to asses the effects of memoization. Space management. Another problem with memoization is its space requirement. As a program executes, its memo tables can become large limiting the utility of memoization. To alleviate this problem, memo tables or individual entries should be disposed of under programmer control. In some application, such as in dynamic programming, most result re-use occurs among the recursive calls of some function. Thus, the memo table of such a function can be disposed of whenever it ter- minates. In other applications, where result re-use is less structured, individual memo table entries should be purged according to a replacement policy [15, 33]. The problem is to determine what exact replacement policy should be used and to analyze the performance effects of the chosen policy. One widely used approach is to replace the least recently used entry. Other, more sophisticated, policies have also been suggested [33]. In general the replacement policy must be application-speci?c, because, for any ?xed policy, there are programs whose performance is made worse by that choice [33]. 3 A Framework for Selective Memoization We present an overview of our framework via some examples. The framework extends a purely functional language with several constructs to support selective memoization. In this section, we use an extension to an ML-like language for the discussion. We formalize the core of this language and study its safety, soundness, and performance properties in Section 4. The framework enables the programmer to determine precisely the dependences between the input and the result of a function. The main idea is to deem the parameters of a function as resources and provide primitives to explore incrementally any value, including the underlying value of a resource. This incremental exploration process reveals the dependences between the parameter of the function and its result. The incremental exploration process is guided by types. If a value has the modal type !t, then the underlying value of type t can be bound to an ordinary, unrestricted variable by the let! construct; this will create a dependence between the underlying value and the result. If a value has a product type, then its two parts can be bound to two resources using the let* construct; this creates no dependences. If the value is a sum type, then it can be case analyzed using the mcase construct, which branches according to the outermost form of the value and assigns the inner value to a resource; mcase creates a dependence on the outer form of the value of the resource. The key aspect of the let* and mcase is that they bind resources rather than ordinary variables. Non-memoized Memoized fun fib (n:int)= mfun mfib (n':!int)= if (n < 2) then n if (n < 2) then n else y:int, y':!int, fy y return (fy y) else else fz z return (fz z) Figure 1. Fibonacci and expressing partial dependences. Exploring the input to a function via let!, mcase, and let* builds a branch recording the dependences between the input and the result of the function. The let! adds to the branch the full value, the mcase adds the kind of the sum, and let* adds nothing. Con- sequently, a branch contains both data dependences (from let!'s) and control dependences (from mcase's). When a return is en- countered, the branch recording the revealed dependences is used to key the memo table. If the result is found in the memo table, then the stored value is returned, otherwise the body of the return is evaluated and the memo table is updated to map the branch to the result. The type system ensures that all dependences are made explicit by precluding the use of resources within return's body. As an example consider the Fibonacci function fib and its memoized counterpart mfib shown in Figure 1. The memoized version, mfib, exposes the underlying value of its parameter, a resource, before performing the two recursive calls as usual. Since the result depends on the full value of the parameter, it has a bang type. The memoized Fibonacci function runs in linear time as opposed to exponential time when not memoized. Partial dependences between the input and the result of a function can be captured by using the incremental exploration technique. As an example consider the function f shown in Figure 1. The function checks whether x is positive or not and returns fy(y) or fz(z). Thus the result of the function depends on an approximation of x (its sign) and on either y or z. The memoized version mf captures this by ?rst checking if x' is positive or not and then exposing the underlying value of y' or z' accordingly. Consequently, the result will depend on the sign of x' and on either y' or z'. Thus if mf is called with parameters (1;5;7) ?rst and then (2;5;3), the result will be found in the memo the second time, because when x' is positive the result depends only on y'. Note that mif construct used in this example is just a special case of the more general mcase construct. A critical issue for ef?cient memoization is the implementation of memo tables along with lookup and update operations on them. In our framework we support expected constant time memo table lookup and update operations by representing memo tables using hashing. To do this, we require that the underlying type t of a modal type !t be an indexable type. An indexable type is associated with an injective function, called an index function, that maps each value of that type to a unique integer; this integer is called the index of the value. The uniqueness property of the indices for a given type ensures that two values are equal if and only if their indices are equal. In our framework, equality is only de?ned for Non-memoized type irl=(int*real) list ks case l of if (c < w) then ks (c,t) else let in if (v1>v2) then v1 else v2 Figure 2. Memo tables for carded at completion. Memoized type irl=(int*real) blist mfun mks (c':!int,l':!irl) case (unbox l) of | CONS((w,v),t) => if (c < w) then else let in if (v1>v2) then v1 else v2 end) memoized Knapsack can be dis- indexable types. This enables us to implement memo tables as hash tables keyed by branches consisting of indices. We assume that each primitive type comes with an index function. For examples, for integers, the identity function can be chosen as the index function. Composite types such as lists or functions must be boxed to obtain an indexable type. A boxed value of type t has type tbox. When a box is created, it is assigned a unique locations (or tag), and this location is used as the unique index of that boxed value. For example, we can de?ne boxed lists as follows. datatype a | CONS of a * ((a blist') box) type a blist = (a blist') box Based on boxes we implement hash-consing as a form of memoiza- tion. For example, hash-consing for boxed lists can be implemented as follows. mfun hCons (h':!a), t':!(a return (box (CONS(h,t))) The function takes an item and a boxed list and returns the boxed list formed by consing them. Since the function is memoized, if it is ever called with two values that are already hash-consed, then the same result will be returned. The advantage of being able to de- ?ne hash-consing as a memoized function is that it can be applied selectively. To control space usage of memo tables, our framework gives the programmer a way to dispose of memo tables by conventional scop- ing. In our framework, each memoized function is allocated its own memo table. Thus, when the function goes out of scope, its memo table can be garbage collected. For example, in many dynamic-programming algorithms result re-use occurs between recursive calls of the same function. In this case, the programmer can scope the memoized function inside an auxiliary function so that its memo table is discarded as soon as the auxiliary function returns. As an example, consider the standard algorithm for the Knapsack Problem ks and its memoized version mks Figure 2. Since result sharing mostly occurs among the recursive calls of mks, it can be scoped in some other function that calls mks; once mks returns its memo table will go out of scope and can be discarded. We note that this technique gives only partial control over space usage. In particular it does not give control over when individual Non-memoized Memoized 15 20 fun fil (g:int->bool, fun mfil (g:int->bool, l:int case l of case (unbox l) of nil => nil NIL => empty | h::t => | CONS(h,t) => let let in in case (g h) of case (g h) of true => h::tt true => hCons(h,tt) |false => tt |false => tt let in return ( case l of case (unbox l) of nil => nil NIL => nil | cons(h,t) => | CONS(h,t) => let let in in (qs s)@(h::(qs g)) (mqs s)@(h::(mqs g)) Figure 3. The Quicksort algorithm. memo table entries are purged. In Section 6, we discuss how the framework might be extended so that each memo table is managed according to a programmer speci?ed caching scheme. The basic idea is to require the programmer to supply a caching scheme as a parameter to the mfun and maintain the memo table according to the chosen caching scheme. Memoized Quicksort. As a more sophisticated example, we consider Quicksort. Figure 3 show an implementation of the Quicksort algorithm and its memoized counterpart. The algorithm ?rst divides its input into two lists containing the keys less than the pivot, and greater than the pivot by using the ?lter function fil. It then sorts the two sublists, and returns the concatenation of the results. The memoized ?lter function mfil uses hash-consing to ensure that there is only one copy of each result list. The memoized Quicksort algorithm mqs exposes the underlying value of its parameter and is otherwise similar to qs. Note that mqs does not build its result via hash-consing?it can output two copies of the same result. Since in this example the output of mqs is not consumed by any other func- tion, there is no need to do so. Even if the result were consumed by some other function, one can choose not to use hash-consing because operations such as insertions to and deletions from the input list will surely change the result of Quicksort. When the memoized Quicksort algorithm is called on ?similar? in- puts, one would expect that some of the results would be re-used. Indeed, we show that the memoized Quicksort algorithm computes its result in expected linear time when its input is obtained from a previous input by inserting a new key at the beginning. Here the expectation is over all permutations of the input list and also the internal randomization of the hash functions used to implement the memo tables. For the analysis, we assume, without loss of general- ity, that all keys in the list are unique. Theorem 1 Let L be a list and let running memoized Quicksort on L and then on L0. The running time of Quicksort on the modi?ed list L0 is expected O(n) where n is the length of L0. 3 26 9 Figure 4. The recursion tree for Quicksort with inputs Proof: Consider the recursion tree of Quicksort with input L, denoted Q(L), and label each node with the pivot of the corresponding recursive call (see Figure 4 for an example). Consider any pivot (key) p from L and let Lp denote the keys that precede p in L. It is easy to see that a key k is in the subtree rooted at p if and only if the following two properties are satis?ed for any key k0 2 Lp. 1. If k0 < p then k > k0, and 2. if k0 > p then k < k0. Of the keys that are in the subtree of p, those that are less than p are in its left subtree and those greater than p are in its right subtree. Now consider the recursion tree Q(L0) for any pivot in Q(L0). Suppose p < a and let k be any key in the left subtree of p in Q(L). Since k < p, by the two properties k is in the left subtree of p in Q(L0). Similarly if p > a then any k in the right subtree of p in Q(L) is also in the right subtree of p in Q(L0). Since ?ltering preserves the respective order of keys in the input list, for any p, p < a, the input to the recursive call corresponding to its left child will be the same. Similarly, for p > a, the input to the recursive call corresponding to its right child will be the same. Thus, when sorting L0 these recursive calls will ?nd their results in the memo. Therefore only recursive calls corresponding to the root, to the children of the nodes in the rightmost spine of the left subtree of the root, and the children of the nodes in the leftmost spine of the right subtree of the root may be executed (the two spines are shown with thick lines in Figure 4). Furthermore, the results for the calls adjacent to the spines will be found in the memo. Consider the calls whose results are not found in the memo. In the worst case, these will be all the calls along the two spines. Consider the sizes of inputs for the nodes on a spine and de?ne the random variables X1 :::Xk such that Xi is the least number of recursive calls (nodes) performed for the input size to become n or less after3 (i1) it ?rst becomes 4 n or less. Since k dlog4=3 ne, the total and the expected number of operations along a spine are dlog4=3 ne 3i1 dlog4=3 ne 3i1 Since the probability that the pivot lies in the middle half of the list is 12 , E[Xi] 2 for i 1, and we have dlog4=3 ne i1E[C(n)] ? 2 n:i=1 Thus, This bound holds for both spines; therefore the number of operations due to calls whose results are not found in the memo is O(n). Since each operation, including hash-consing, takes expected constant time, the total time of the calls whose results are not in the memo is O(n). Now, consider the calls whose results are found in the memo, each such call will be on a spine or adjacent to it, thus there are an expected O(logn) such calls. Since, the memo table lookup overhead is expected constant time the total cost for these is O(logn). We conclude that Quicksort will take expected O(n) time for sorting the modi?ed list L0. It is easy to extend the theorem to show that the O(n) bound holds for an insertion anywhere in the list. Although, this bound is better than a complete rerun, which would take O(nlogn), we would like to achieve O(logn). In Section 6 we discuss how a combination of memoization and adaptivity [2] may be used to reduce the expected cost of a random insertion to O(logn). In this section we study a small functional language, called MFL, that supports selective memoization. MFL distinguishes memoized from non-memoized code, and is equipped with a modality for tracking dependences on data structures within memoized code. This modality is central to our approach to selective memoization, and is the focus of our attention here. The main result is a soundness theorem stating that memoization does not affect the outcome of a computation compared to a standard, non-memoizing semantics. We also show that the memoization mechanism of MFL causes a constant factor slowdown compared to a standard, non-memoizing semantics. 4.1 Abstract The abstract syntax of MFL is given in Figure 5. The meta-variables x and y range over a countable set of variables. The meta-variables a and b range overf a countable set of resources. (The distinction will be made clear below.) The meta-variable l ranges over a countable set of locations. We assume that variables, resources, and locations are mutually disjoint. The binding and scope conventions for variables and resources are as would be expected from the syntactic forms. As usual we identify pieces of syntax that differ only in their choice of bound variable or resource names. A term or expression is resource-free if and only if it contains no free resources, and is variable-free if and only if it contains no free variables. A closed term or expression is both resource-free and variable-free; otherwise it is open. The types of MFL include 1 (unit), int, products and sums, recursive data types ?u:t, memoized function types, and bang types !h. MFL distinguishes indexable types, denoted h, as those that accept an injective function, called an index function, whose co-domain is integers. The underlying type of a bang type !h is restricted to be an indexable type. For int type, identity serves as an index constant function can be chosen as the index function. For non-primitive types an index can be supplied by boxing values of these types. Boxed values would be allocated Ix. Types Types mcase mfun f (a:t1):t2 iseend j Figure 5. The abstract syntax of MFL. in a store and the unique location of a box would serve as an index for the underlying value. With this extension the indexable types would be de?ned as Although supporting boxed types is critical for practical purposes, we do not formalize this here to focus on the main ideas. The syntax is structured into terms and expressions, in the terminology of Pfenning and Davies [30]. Roughly speaking, terms evaluate independently of their context, as in ordinary functional program- ming, whereas expressions are evaluated relative to a memo table. Thus, the body of a memoized function is an expression, whereas the function itself is a term. Note, however, that the application of a function is a term, not an expression; this corresponds to the encapsulation of memoization with the function, so that updating the memo table is benign. In a more complete language we would include case analysis and projection forms among the terms, but for the sake of simplicity we include these only as expressions. We would also include a plain function for which the body is a term. Note that every term is trivially an expression; the return expression is the inclusion. 4.2 Static Semantics The type structure of MFL extends the framework of Pfenning and Davies [30] with a ?necessitation? modality, !h, which is used to track data dependences for selective memoization. This modality does not correspond to a monadic interpretation of memoization effects (t in the notation of Pfenning and Davies), though one could imagine adding such a modality to the language. The introductory and eliminatory forms for necessity are standard, namely !t for introduction, and let!x:hbet ineend for elimination. Our modality demands that we distinguish variables from re- sources. Variables in MFL correspond to the ?validity?, or ?unre- stricted?, context in modal logic, whereas resources in MFL correspond to the ?truth?, or ?restricted? context. An analogy may also be made to the judgmental presentation of linear logic [29, 31]: variables correspond to the intuitionistic context, resources to the linear context.1 1Note, however, that we impose no linearity constraints in our type system! Res Pairs G; Fun G; FunVal Apply Bang Inl, Inr (Un)Roll Figure 6. Typing judgments for terms. The inclusion, return(t), of terms into expressions has no analogue in pure modal logic, but is speci?c to our interpretation of memoization as a computational effect. The typing rule for return(t) requires that t be resource-free to ensure that any dependence on the argument to a memoized function is made explicit in the code before computing the return value of the function. In the ?rst instance, resources arise as parameters to memoized functions, with further resources introduced by their incremental decomposition using let and mcase. These additional resources track the usage of as-yet-unexplored parts of a data structure. Ultimately, the complete value of a resource may be accessed using the let! construct, which binds its value to a variable, which may be used without restriction. In practice this means that those parts of an argument to a memoized function on whose value the function depends will be given modal type. However, it is not essential that all resources have modal type, nor that the computation depend upon every resource that does have modal type. The static semantics of MFL consists of a set of rules for deriving typing judgments of the form G;D for expressions. In these judgments G is a variable type assignment, a ?nite function assigning types to variables, and D is a resource type assignment, a ?nite function assigning types to resources. The rules for deriving these judgments are given in Figures 6 and 7. Return Let Case Figure 7. Typing judgments for expressions. 4.3 Dynamic Semantics The dynamic semantics of MFL formalizes selective memoization. Evaluation is parameterized by a store containing memo tables that track the behavior of functions in the program. Evaluation of a function expression causes an empty memo table to be allocated and associated with that function. Application of a memoized function is affected by, and may affect, its associated memo table. Should the function value become inaccessible, so also is its associated memo table, and hence the storage required for both can be reclaimed. Unlike conventional memoization, however, the memo table is keyed by control ?ow information rather than by the values of arguments to memoized functions. This is the key to supporting selective memoization. Expression evaluation is essentially an exploration of the available resources culminating in a resource-free term that determines its value. Since the exploration is data-sensitive, only certain aspects of the resources may be relevant to a particular outcome. For example, a memoized function may take a pair of integers as argument, with the outcome determined independently of the second component in the case that the ?rst is positive. By recording control-?ow information during evaluation, we may use it to provide selective memoization. For example, in the situation just described, all pairs of the form should map to the same result value, irrespective of the value v. In conventional memoization the memo table would be keyed by the pair, with the result that redundant computation is performed in the case that the function has not previously been called with v, even though the value of v is irrelevant to the result! In our framework we instead key the memo table by a ?branch? that records suf?cient control ?ow information to capture the general case. Whenever we encounter a return statement, we query the memo table with the current branch to determine whether this result has been computed before. If so, we return the stored value; if not, we evaluate the return statement, and associate that value with that branch in the memo table for future use. It is crucial that the returned term not contain any resources so that we are assured that its value does not change across calls to the function. The dynamic semantics of MFL is given by a set of rules for deriving judgments of the form s;t +t v;s0 (for terms) and s;l:b;e +e v;s0 (for expressions). The rules for deriving these judgments are given in Figures 8 and 9. These rules make use of branches, memo tables, and stores, whose precise de?nitions are as follows. A simple branch is a list of simple events corresponding to ?choice points? in the evaluation of an expression. Simple Event Simple Branch eb We write bbe to stand for the extension of b with the event e at the end. A memo table, q, is a ?nite function mapping simple branches to values. We write q[b ! v], where b 2= dom(q), to stand for the 7 extension of q with the given binding for b. We write q(b) " to mean that b 2= dom(q). A store, s, is a ?nite function mapping locations, l, to memo tables. We write s[l ! q], where l 2= dom(s), to stand for the extension of 7 s with the given binding for l. When l 2 dom(s), we write s[l q] for the store s that maps l to q and l to s(l0).Term evaluation is largely standard, except for the evaluation of (memoizing) functions and applications of these to arguments. Evaluation of a memoizing function term allocates a fresh memo ta- ble, which is then associated with the function's value. Expression evaluation is initiated by an application of a memoizing function to an argument. The function value determines the memo table to be used for that call. Evaluation of the body is performed relative to that table, initiating with the null branch. Expression evaluation is performed relative to a ?current? memo table and branch. When a return statement is encountered, the current memo table is consulted to determine whether or not that branch has previously been taken. If so, the stored value is re- turned; otherwise, the argument term is evaluated, stored in the current memo table at that branch, and the value is returned. The let! and mcase expressions extend the current branch to re?ect control ?ow. Since let! signals dependence on a complete value, that value is added to the branch. Case analysis, however, merely extends the branch with an indication of which case was taken. The let construct does not extend the branch, because no additional information is gleaned by splitting a pair. 4.4 Soundness of MFL We will prove the soundness of MFL relative to a non-memoizing semantics for the language. It is straightforward to give a purely functional semantics to the pure fragment of MFL by an inductive de?nition of the relations t +t v and e +e v. Here t, e, and v are ?pure? in the sense that they may not involve subscripted function values. The underlying term, t, of an MFL term, t, is obtained by erasing all location subscripts on function values occurring within t. The soundness of MFL consists of showing that evaluation with memoization yields the same outcome as evaluation without memoization Theorem 2 (Soundness) If 0/;t +t v;s, where 0/;0/ The full proof is given in [3]. The statement of the theorem must be strengthened considerably to account for both terms and expres- sions, and to take account of non-empty memoization contexts. The proof then proceeds by induction on evaluation. It is easy to show that the non-memoizing semantics of MFL is type safe, using completely conventional techniques. It follows that the Unit s;? +t ?;s Number s;n +t n;s . . . sn1;tn +t vn;sn Pair (l 2 dom(s); s;e +t v;s0 FunVal Apply Bang s;!t +t !v;s0 Inject s;inlt1+t2t +t inlt1+t2 v;s0 s;inrt1+t2t +t inrt1+t2 v;s0 (Un)Roll Figure 8. Evaluation of terms. memoizing semantics is also type-safe, for if not, there would be a closed value of a type t that is not canonical for that type. How- ever, erasure preserves and re?ects canonical forms, hence, by the Soundness Theorem, MFL must also be type safe. 4.5 Performance We show that memoization slows down an MFL program by a constant factor (expected) with respect to a standard, non-memoizing semantics even when no results are re-used. The result relies on representing a branch as a sequence of integers and using this sequence to key memo tables, which are implemented as hash tables. To represent branches as integer sequences we use the property of MFL that the underlying type h of a bang type, !h, is an indexable Ret (Not Found) s0;l:b;[v1=a1;v2=a2]e +e v;s00 Let s;l:b;leta1a2 bet ineend +t v;s00 Case Figure 9. Evaluation of expressions. type. Since any value of an indexable type has an integer index, we can represent a branch of dependencies as sequence of integers corresponding to the indices of let!'ed values, and zero or one for inl and inr. Consider a non-memoizing semantics, where the return rule always evaluates its body and neither looks up nor updates memo tables (stores). Consider an MFL program and let T denote the time it takes (the number of evaluation steps) to evaluate the program with respect to this non-memoizing semantics. Let T0 denote the time it takes to evaluate the same program with respect to the mem- oizing semantics. In the worst case, no results are re-used, thus the difference between T and T0 is due to memo-table lookups and updates done by the memoizing semantics. To bound the time for these, consider a memo table lookup or update with a branch b and let jbj be the length of the branch. Since a branch is a sequence of integers, a lookup or update can be performed in expected O(jbj) time using nested hash tables to represent memo tables. Now note that the non-memoizing semantics takes jbj time to build the branch thus, the cost of a lookup or update can be charged to the evaluations that build the branch b, i.e., evaluations of let! and mcase. Furthermore, each evaluation of let! and mcase can be charged by exactly one return. Thus, we conclude that in the expected case. 5 Implementation We describe an implementation of our framework as a Standard ML library. The aspects of the MFL language that relies on the syntactic distinction between resources and variables cannot be enforced statically in Standard ML. Therefore, we use a separate type for resources and employ run-time checks to detect violations of correct usage. signature sig (* Expressions *) type 'a expr val return: (unit -> 'a) -> 'a expr (* Resources *) type 'a res val expose: 'a res -> 'a (* Bangs *) type 'a bang val bang : ('a -> int) -> 'a -> 'a bang val letBang: ('a bang) -> ('a -> 'b expr) -> 'b expr (* Products *) type ('a,'b) prod val pair: 'a -> 'b -> ('a,'b) prod val letx: ('a,'b) prod -> (('a res * 'b res) -> 'c expr) -> 'c expr val split: ('a,'b) prod -> (('a * 'b) -> 'c) -> 'c (* Sums *) type ('a,'b) sum val inl: 'a -> ('a,'b) sum val inr: 'b -> ('a,'b) sum val mcase: ('a,'b) sum -> ('a res -> 'c expr) -> ('b res -> 'c expr) -> 'c expr val choose: ('a,'b) sum -> ('a -> 'c) -> ('b -> 'c) -> 'c (* Memoized arrow *) type ('a,'b) marrow val mfun: ('a res -> 'b expr) -> ('a,'b) marrow val mfun rec: (('a, 'b) marrow -> 'a res -> 'b expr) -> ('a,'b) marrow val mapply: ('a,'b) marrow -> 'a -> 'b signature type 'a box val init: unit->unit val box: 'a->'a box val unbox: 'a box->'a val getKey: 'a box->int Figure 10. The signatures for the memo library and boxes. The interface for the library (shown in Figure 10) provides types for expressions, resources, bangs, products, sums, memoized functions along with their introduction and elimination forms. All expressions have type 'a expr, which is a monad with return as the inclusion and various forms of ?bind? induced by the elimination forms letBang, letx, and mcase. A resource has type 'a res and expose is its elimination form. Resources are only created by the library, thus no introduction form for resources is available to the user. The introduction and elimination form for bang types are bang and letBang. The introduction and elimination form for product types are pair, and letx and split respectively. The letx is a form of ?bind? for the monad expr; split is the elimination form for the term context. The treatment of sums is similar to product types. The introduction forms are inl and inr, and the elimination forms are mcase and choose; mcase is a form of bind for the expr monad and choose is the elimination for the term context. Memoized functions are introduced by mfun and mfun rec; mfun takes a function of type 'a res -> 'b expr and returns the memoized function of type ('a,'b) marrow; mfun rec is similar to mfun but it also takes as a parameter its memoized version. Note that the result type does not contain the ?effect? expr?we encapsulate memoization effects, which are benign, within the function. The elimination form for the marrow is the memoized apply function mapply. functor BuildMemo (structure Box: BOX structure struct type 'a list * (unit -> 'a) type 'a res = 'a res expose val val in ((h v)::branch, susp) type val in f (res x1, res x2) datatype ('a,'b) sum = INL of 'a | INR of 'b mcase s f val case s of | INR v => (1,g (res v)) in (lr::branch,susp) choose s f case s of INL v => f v | INR v => g v type fun mfun rec val val val case Memopad.extend mpad branch of val in | (SOME v,NONE) => v (* Found *) in result in Similar to mfun rec *) mapply f Figure 11. The implementation of the memoization library. Figure 11 shows an implementation of the library without the run-time checks for correct usage. To incorporate the run-time checks, one needs a more sophisticated de?nition of resources in order to detect when a resource is exposed out of its context (i.e., function instance). In addition, the interface must be updated so that the ?rst parameter of letBang, letx, and mcase, occurs in suspended form. This allows us to update the state consisting of certain ?ags before forcing a term. structure struct type 'a (* Some utilities *) fun iBang (* Fibonacci *) letBang (expose n') (fn n => return (fn()=> else mapply f (iBang(n-1))+ mapply f (iBang(n-2)))) mapply (mfun rec mfib') n (* Boxed lists *) datatype 'a | CONS of ('a * (('a blist') box)) type 'a blist = ('a blist') box (* Hash Cons *) letx (expose x') (fn (h',t') => letBang (expose h') (fn h => letBang (expose t') (fn t => return (fn()=> box (CONS(h,t)))))) val hCons = mfun hCons' (* Knapsack *) letx (expose arg) (fn (c',l') => letBang (expose c') (fn c => letBang (expose l') (fn l => return (fn () => case (unbox l) of | CONS((w,v),t) => if (c < w) then mapply mks (pair (iBang c) (bBang t)) else let val (iBang c) (bBang t) val mapply mks arg1 val (iBang (c-w)) (bBang t) val mapply mks arg2 in if (v1 > v2) then v1 else v2 fun mks mapply (mfun rec mks') x (* Quicksort *) val val hCons = mfun hCons' case (unbox l) of | CONS(h,t) => if (f h) then mapply hCons (pair (iBang h) (bBang (fil f t))) else letBang (expose l') (fn l => return (fn () => case (unbox l) of | CONS(h,t) => let val val val mapply qs (bBang ll) val mapply qs (bBang gg) in in mfun rec qs' Figure 12. Examples from Section 3 in the SML library. The implementation extends the operational semantics of the MFL language (Section 4.3) with boxes. The bang primitive takes a value and an injective function, called the index function, that maps the value to an integer, called the index. The index of a value is used to key memo tables. The restriction that the indices be unique, enables us to implement memo tables as a nested hash tables, which support update and lookup operations in expected constant time. The primitive letBang takes a value b of bang type and a body. It applies the body to the underlying value of b, and extends the branch with the index of b. The function letx takes a pair p and a body. It binds the parts of the pair to two resources and and applies the body to the resources; as with the operational semantics, letx does not extend the branch. The function mcase takes value s of sum type and a body. It branches on the outer form of s and binds its inner value to a resource. It then applies the body to the resource and extends the branch with 0 or 1 depending on the outer form of s. The elimination forms of sums and products for the term context, split and choose are standard. The return primitive ?nalizes the branch and returns its body as a suspension. The branch is used by mfun rec or mfun, to key the memo table; if the result is found in the memo table, then the suspension is disregarded and the result is re-used; otherwise the suspension is forces and the result is stored in the memo table keyed by the branch. The mfun rec primitive takes a recursive function f as a parameter and ?memoizes? f by associating it with a memo pad. A subtle issue is that f must calls its memoized version recursively. Therefore f must take its memoized version as a parameter. Note also that the memoized function internally converts its parameter to a resource before applying f to it. The interface of the library provides no introduction form for re- sources. Indeed, all resources are created by the library inside the letx, mcase, mfun rec, and mfun. The function expose is the elimination form for resources. If, for example, one would like to apply letBang to a resource, then he must ?rst expose the re- source, which ?exposes? the underlying value. Figure 12 show the examples from Section 3 written in the SML library. Note that the memoized Fibonacci function mfib creates a memo table every time it is called. When mfib ?nishes, this table can be garbage collected (the same applies to mks). For Quicksort, we provide a function mqs that returns an instance of memoized Quicksort when applied. Each such instance has its own memo table. Note also that mqs creates a local instance of the hash-cons function so that each instance of memoized Quicksort has its own memo table for hash-consing. In the examples, we do not use the sum types provided by the library to represent boxed lists, because we do not need to. In general, one will use the provided sum types instead of their ML counterparts (for example if an mcase is needed). The examples in Figure 12 can be implemented using the following de?nition of boxed lists. datatype 'a ROLL of (unit, (('a, 'a boxlist' box) prod)) sum type 'a boxlist = ('a boxlist') box Changing the code in Figure 12 to work with this de?nition of boxed lists requires several straightforward modi?cations. 6 Discussion Space and Cache Management. Our framework associates a separate memo table with each memoized function. This allows the programmer to control the life-span of memo tables by conventional scoping. This somewhat coarse degree of control is suf?cient in certain applications such as in dynamic programming, but ?ner level of control may be desirable for applications where result re-use is less regular. Such an application can bene?t from specifying a caching scheme for individual memo tables so as to determine the size of the memo table and the replacement policy. We discuss how the framework can be extended to associate a cache scheme with each memo table and maintain the memo table accordingly. The caching scheme should be speci?ed in the form of a parameter to the mfun construct. When evaluated, this construct will bind the caching scheme to the memo table and the memo table will be maintained accordingly. Changes to the operational semantics to accommodate this extension is small. The store s will now map a label to a pair consisting of a memo table and its caching scheme. The handling of the return will be changed so that the stores do not merely expand but are updated according to the caching scheme before adding a new entry. The following shows the updated return rule. Here S denotes a caching scheme and q denotes a memo table. The update function denotes a function that updates the memo table to accommodate a new entry by possibly purging an existing entry. The programmer must ensure that the caching scheme does not violate the integrity of the memo table by tampering with stored values. (Not Found) For example, we can specify that the memo table for the Fibonacci function, shown in Figure 1, can contain at most two entries and be managed using the least-recently-used replacement policy. This is suf?cient to ensure that the memoized Fibonacci runs in linear time. This extension can also be incorporated into the type system described in Section 4. This would require that we associate types with memo stores and also require that we develop a type system for ?safe? update functions if we are to enforce that the caching schemes are safe. Local vs. Non-local Dependences. Our dependence tracking mechanism only captures ?local? dependences between the input and the result of a function. A local dependence of a function f is one that is created inside the static scope of f. A non-local dependence of f is created when f passes its input to some other function g, which examines f's input indirectly. In previous work, Abadi et. al. [1] and Heydon et. al. [14] showed a program analysis technique for tracking non-local dependences by propagating dependences of a function to its caller. They do not, however, make clear the performance implications of their technique. Our framework can be extended to track non-local dependences by introducing an application form for memoized functions in the expression context. This extension would, for example, allow for dependences of non-constant length. We chose not to support non-local dependences because it is not clear if its utility exceeds its performance effects. Memoization and Adaptivity. The work we present in this paper was motivated by our previous work on adaptive computation [2]. We brie?y discuss the relationship between memoization and adaptivity and how they can be combined to obtain ef?cient dynamic or incremental algorithms. [5] [6] An adaptive computation maintains a dynamic dependence graph representing data and control dependences. When the input is modi?ed, a change propagation algorithm updates the output and the dependence graph. The adaptivity mechanism handles ?deep? [7] changes ef?ciently. We say that a change is deep if it affects calls that occur at leaves of the call tree for the computation. In contrast, [8] a change is shallow if it affects by a calls that occur at the roots of the call tree. As an example consider the Quicksort algorithm that picks the ?rst key of its input as pivot. Inserting a new key at the end of the input list is a deep change because this change will affect the last [10] recursive calls of some ?lter functions and will become pivot only at the end of some sequence of recursive calls to Quicksort. In contrast, inserting a new key at the beginning of the list is a shallow change for Quicksort, because the new key will be selected as a pivot immediately by the ?rst call to Quicksort. The adaptivity mechanism based on dynamic dependence graphs handles an insertion at the end of the input, a deep change, in expected O(logn) [12] time [2], whereas the insertion at the beginning of the list, a shallow change, will cause a complete rerun, which takes O(nlogn) time. Using memoization, however, an insertion at the beginning of the list can be handled in O(n) time as showed in Section 3. [13] Any change can be thought of a combination of shallow and deep changes. Since memoization and adaptivity complement each other in their handling of deep and shallow changes, we would expect that a combination of these two techniques would handle general [14] changes ef?ciently. For example, in Quicksort, we expect that an insertion in a random position in the list would be handled in expected time by a combination of these two techniques. [15] 7 Conclusion [16] We presented a framework for selective memoization under programmer control. The framework makes explicit the performance effects of memoization and yields programs whose running times can be analyzed using standard techniques. A key aspect of the [17] framework is that it can capture both control and data dependences between input and the result of a memoized function. The main contributions of the paper are the particular set of primitives we [18] suggest and the semantics along with the proofs that it is sound. We gave a simple implementation of the framework in the Standard [19] ML language. We expect that this framework can be implemented in any purely-functional language. --R Analysis and caching of dependencies. Adaptive functional programming. Selective memo- [23] ization The Design and Analysis of Computer Algorithms. Anatomy of LISP. Dynamic Programming. Tabulation techniques for recursive programs. ACM Computing Surveys Eliminating redundant recursive calls. ACM Transactions on Programming Languages and Systems to Algorithms. Incremental evaluation of attribute grammars with application to syntax directed In Conference Record of the 8th Annual ACM Symposium pages 105? Incremental reduction in the pages 307? Hashing lemmas on time complexities with applications to formula manipulation. Caching function calls using ACM SIGPLAN Notices Elimination of recursive calls using a small table of randomly selected function values. Alphonse: incremental computation as a programming Lazy memo-functions Conference on The Implementation of Dynamic programming via static Static caching for incremental computation. Languages and Systems and Formal Systems 'memo' functions and machine learning. Automating program speedup by deciding what to cache. The wizard of TILT: Ef- ?cient(?) Techniques for automatic memoization with applications to context-free parsing Generating Incremental Attribute Evaluators. Using cached functions and constructors for incremental attribute evalua- tion Structural cut elimination. A judgmental reconstruction of modal logic. Natural deduction for intuitionistic non-commutative linear logic Incremental computation via function caching. An improved replacement strategy for function caching. Incremental computation via function caching. An example of hierarchical design and proof. Incremental compilation via partial evaluation. Automating derivation of incremental programs. --TR Eliminating Redundant Recursive Calls. Lazy memo-functions An improved replacement strategy for function caching Incremental computation via function caching Specification and transformation of programs: a formal approach to software development Introduction to algorithms Incremental reduction in the lambda calculus Alphonse Analysis and caching of dependencies Automating derivation of incremental programs Static caching for incremental computation Caching function calls using precise dependencies Tabulation Techniques for Recursive Programs An example of hierarchical design and proof Adaptive functional programming Anatomy of LISP Incremental evaluation for attribute grammars with application to syntax-directed editors The Design and Analysis of Computer Algorithms Dynamic Programming via Static Incrementalization Natural Deduction for Intuitionistic Non-communicative Linear Logic Using Cached Functions and Constructors for Incremental Attribute Evaluation Structural Cut Elimination Hashing LEMMAs on time complexities with applications to formula manipulation Dynamic Programming --CTR Kedar Swadi , Walid Taha , Oleg Kiselyov , Emir Pasalic, A monadic approach for avoiding code duplication when staging memoized functions, Proceedings of the 2006 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation, January 09-10, 2006, Charleston, South Carolina Haiying Xu , Christopher J. F. Pickett , Clark Verbrugge, Dynamic purity analysis for java programs, Proceedings of the 7th ACM SIGPLAN-SIGSOFT workshop on Program analysis for software tools and engineering, p.75-82, June 13-14, 2007, San Diego, California, USA Kevin Walsh , Emin Gn Sirer, Staged simulation: A general technique for improving simulation scale and performance, ACM Transactions on Modeling and Computer Simulation (TOMACS), v.14 n.2, p.170-195, April 2004 Geoffrey Washburn , Stephanie Weirich, Boxes go bananas: encoding higher-order abstract syntax with parametric polymorphism, ACM SIGPLAN Notices, v.38 n.9, p.249-262, September Darko Marinov , Robert O'Callahan, Object equality profiling, ACM SIGPLAN Notices, v.38 n.11, November Neil D. Jones, Transformation by interpreter specialisation, Science of Computer Programming, v.52 n.1-3, p.307-339, August 2004 Wei-Ngan Chin , Siau-Cheng Khoo , Neil Jones, Redundant Call Elimination via Tupling, Fundamenta Informaticae, v.69 n.1-2, p.1-37, January 2006 Umut A. Acar , Guy E. Blelloch , Robert Harper, Adaptive functional programming, ACM Transactions on Programming Languages and Systems (TOPLAS), v.28 n.6, p.990-1034, November 2006 Umut A. Acar , Guy E. Blelloch , Matthias Blume , Kanat Tangwongsan, An experimental analysis of self-adjusting computation, ACM SIGPLAN Notices, v.41 n.6, June 2006 K. V. Seshu Kumar, Value reuse optimization: reuse of evaluated math library function calls through compiler generated cache, ACM SIGPLAN Notices, v.38 n.8, August
programmer controlled;memoization;performance;selective
604139
Bitwidth aware global register allocation.
Multimedia and network processing applications make extensive use of subword data. Since registers are capable of holding a full data word, when a subword variable is assigned a register, only part of the register is used. New embedded processors have started supporting instruction sets that allow direct referencing of bit sections within registers and therefore multiple subword variables can be made to simultaneously reside in the same register without hindering accesses to these variables. However, a new register allocation algorithm is needed that is aware of the bitwidths of program variables and is capable of packing multiple subword variables into a single register. This paper presents one such algorithm.The algorithm we propose has two key steps. First, a combination of forward and backward data flow analyses are developed to determine the bitwidths of program variables throughout the program. This analysis is required because the declared bitwidths of variables are often larger than their true bitwidths and moreover the minimal bitwidths of a program variable can vary from one program point to another. Second, a novel interference graph representation is designed to enable support for a fast and highly accurate algorithm for packing of subword variables into a single register. Packing is carried out by a node coalescing phase that precedes the conventional graph coloring phase of register allocation. In contrast to traditional node coalescing, packing coalesces a set of interfering nodes. Our experiments show that our bitwidth aware register allocation algorithm reduces the register requirements by 10\% to 50% over a traditional register allocation algorithm that assigns separate registers to simultaneously live subword variables.
INTRODUCTION Programs that manipulate data at subword level, i.e. bit sections within a word, are common place in the embedded domain. Examples of such applications include media processing as well as network processing codes [12, 19]. A key characteristic of such applications is that at some point the data exists in packed form, that is, multiple data items are packed together into a single word of memory. In fact in most cases the input or the output of an application consists of packed data. If the input consists of packed data, the application typically unpacks it for further processing. If the output is required to be in packed form, the application computes the results and explicitly packs it before generating the out- put. Since C is the language of choice for embedded applications, the packing and unpacking operations are visible in form of bitwise logical operations and shift operations in the code. In addition to the generation of extra instructions for packing and unpacking data, additional registers are required to hold values in both packed and unpacked form therefore causing an increase in register pressure. New instruction set architectures for embedded and network processors allow bit sections within a register to be directly referenced [6, 15, 18]. For example, the following instruction adds a 4 bit value from R2 with a 6 bit value from R3 and stores a 8 bit result in R1. The operands are extended by adding leading zero bits to match the size of the result before the addition is carried out. In our recent work we incorporated bit section referencing into the popular ARM processor. We have shown that the proper use of such instructions eliminates the need for explicit packing and unpacking operations and thus reduces the number of executed instructions significantly [13]. Another important consequence of having this instruction set support is that multiple subword sized variables can be made to simultaneously reside in the same register without hindering access to the variables. Thus this approach reduces register requirements of the program. Since embedded processors support a small number of registers (e.g., ARM [16] supports 16 registers and even fewer are directly accessible by most instructions in Thumb mode) efficient use of register resources is extremely important. To illustrate the potential for reduction in register requirements, let us consider the examples shown in Fig. 1 that are typical of embedded codes. These code fragments, taken from the adpcm (au- dio) and gsm (speech) applications respectively, perform unpacking and packing. Each code fragment references three variables which have the declared size of 8 bits each. The live ranges of the variables, including their widths, are shown. By examining these live ranges we find that a traditional register allocator must use two registers to hold their values. However, bitwidth aware register allocation can dramatically reduce the register requirements. We can Unpacking last use of delta1 last use of delta2 Packing Unpacking Packing char char delta1, delta2; char alpha1, alpha2; inbuffer delta2 alpha2 outbuffer Figure 1: Subword variables in multimedia codes. hold the values of these variables in 8 bits and 7 bits of a single register respectively for the two code fragments. The remaining bits of this register can be used to hold additional subword sized variables. In this paper we describe an approach for achieving register allocations that use a part of a single register, as opposed to multiple registers, for the above code fragments. There are two key components of our approach. First, we employ algorithms for constructing live ranges of variables such that the minimal bitwidths, or widths for short, of the live ranges at various program points are also com- puted. Second, we employ a fast and effective method for packing together multiple live ranges. The packing phase essentially performs coalescing of interfering nodes on an enhanced interference graph representation for the program. Following packing, register allocation is carried out using a conventional graph coloring algorithm that assigns a single register to each node in the graph [1, 3, 8]. There are a number of challenges of developing fast and yet effective algorithms for each of the above components that are described below: Live range construction The first challenge is to identify the minimal width of each live range at each relevant program point. Analysis must be developed for this purpose due to two reasons that are illustrated by our exam- ples: variables are declared to be of larger than needed bitwidths (e.g., delta1 is declared as an 8 bit entity while it only uses 4 bits); and the bitwidth of a variable can change from one program point to another as a variable may contain multiple data items which are consumed one by one (e.g., inbuffer initially is 8 bits of data, after delta1 is assigned it contains only 4 bits of useful data). We present a combination of forward and backward data flow analysis to find the minimal widths. The second challenge is to efficiently identify the minimal widths. An obvious way is to develop an analysis which, for a given variable that is declared to be b bits wide, determines the "need" for keeping each of the b bits in a register at each program point. The cost of such bitwise analysis will be high as it is directly dependent upon the bitwidths of the variables. To achieve efficiency, we develop an analysis which views each variable, regardless of its size, as made up of three bit sections called the leading, middle, and trailing sections. The goal of the analysis is to determine the minimal sized middle section that must be kept in the register while the leading and trailing sections can be discarded. This approach is effective in practice because the unneeded bits of a variable at a program point typically form leading and/or trailing bit sections. Packing multiple variables into a register When variables are packed together through coalescing of two nodes in the interference graph, the shapes of the live ranges must be taken into account to determine whether or not the live ranges can be co- alesced, and if coalescing is possible, the characteristics of the coalesced live range must be determined to perform further coalescing. A simple approach to this problem may not be accurate leading to missed opportunities for coalescing. For example, in our earlier example the maximum width of inbuffer and delta1 were 8 and 4 bits respectively. A simple method that ignores their shapes and assigns a width of 12 bits to the live range resulting from coalescing the two, overestimates the width by 4 bits. Therefore while this approach is simple, and thus fast, it will miss coalescing opportunities A completely accurate approach can be developed which compares the shapes of the live ranges at all relevant program points to determine whether they can be coalesced, and if that is possible, it computes the compact shape of the resulting live range. While this approach will not miss coalescing opportunities, it is too expensive. We present a fast and highly accurate approach for node coalescing based upon an enhanced labeled interference graph. The shapes of interfering live range pairs are compared exactly once to generate the labelling. Node coalescing is driven by the labelling which is updated in constant time following each coalescing step. While the labelling is approximate, it is highly accurate in practice and therefore missed coalescing opportunities are rare. Outline The remainder of the paper is organized as follows. In section 2 we present the live range construction algorithm. The enhanced interference graph representation and the node coalescing algorithm based upon it to affect variable packing is described in section 3. Experimental evaluation is presented in section 4. Related work is discussed in section 5 and conclusions are given in section 6. 2. LIVE RANGE CONSTRUCTION Definition 1. (Live Range) The live range of a variable v is the program region over which the value of v is live, that is, for each point in the live range, a subset of bits in v's current value may be used in a future computation. Each right hand side reference of variable v in some program statement does not need to explicitly reference all of the bits in v during the execution of the statement. As a consequence, at each point in v's live range, not all of the bits representing v are live. Therefore, different amounts of bits may be needed to hold the value of v in a register at different program points. Definition 2. (Dead Bits) Given a variable v, which according to its declaration is represented by s bits, a subset of these s bits, say d, are dead at program point p if all computations following point p that use the current value of v can be performed without explicitly referring to the bits in d. Definition 3. (Live Range Width) Given a program point p in variable v's live range, the width of v's live range at point p, denoted by wv (p), is defined such that the bits representing variable v according to its declaration can be divided into three contiguous sections as follows: a leading section of l v (p) dead bits; a middle section of wv (p) live bits; and a trailing section of tv (p) dead bits. (p) Let sv denote a statement that refers to the value of variable v. We define NOUSE(sv ; v) as an ordered pair (l; t) such that the leading l bits and trailing t bits of v need not be explicitly referred to during execution of sv . The conditions under which only a sub-set of, and not all, bits of a variable v are sufficient for evaluating an expression are given in Fig. 2. The first three situations exploit the use of compile time constants in left shift, right shift, and bit-wise and operations. The results computed by these expressions are only dependent upon subset of bits of v and thus the remaining bits are considered as not having been used. The next two situations exploit presence of zero bits in v. Leading zero bits present in v need not be explicitly held in a register to perform arithmetic and relational operations as the results of these operations can be correctly computed without explicitly referring to these bits. Similarly, the results of the bitwise or operation can be computed without explicitly referring to the leading and trailing zero bits of v. Therefore, we consider these zero bits as not having been used. Finally, in all other cases a right hand side reference to v is considered to use all bits of v, i.e. NOUSE(sv ; v) is (0; 0). To identify dead bits and hence the width of the live range at each program point in the live range, we perform the following analy- sis. First we carry out forward analysis to compute a safe estimate of leading and trailing zero bit sections in each program variable at each program point. This information is needed in the computation of NOUSE(sv ; v) in two of the cases described above (arithmetic/relational operations and bitwise or operation). Having computed information fully, second we carry out backward analysis to identify the dead bit sections in each program variable at each program point. We describe these analyses next. Without loss of generailty, we assume in our discussion that all variables have the same declared bitwidth. Leading and trailing zero bit sections As described above, leading and trailing zeros need to be found because results of some operations can be computed without explicitly referring to them and thus these sections can be treated as dead bit sections. Forward analysis is employed to determine the leading and trailing zero bit sections for each variable, at each program point. When a variable v is being assigned, in some cases, by examining the expression on the right hand side we can determine the leading and trailing zero bit sections of v following the assignment. In case of a constant assignment by looking at the value of constant c, we can determine the zero bit sections of v. In case of signed numbers the leading zero bit section is formed by sign extension bits (i.e., from zeros or ones). A right (left) shift by a constant amount, i.e. results in the creation of leading (trailing) bit sections. A bitwise logical or (and) operation, i.e. results in propagation of zero bit sections. For a copy assignment the zero bit sections of x are simply propagated to v. If nothing can be asserted about the value being assigned to v, the analysis conservatively assumes that there are no leading or trailing zero bit sections. Note that since zero bit sections of one variable may depend upon zero bit sections of another variable, all variables must be analyzed simultaneously. The meet operator for this forward analysis safely computes the smallest leading and trailing zero bit sections that are present in each variable across all incoming edges. The data flow equations for computing the zero bit sections are given in Fig. 3, where ZBS in=out [n; v] represents the zero bit sections of variable v at entry/exit of node n. Recall that for simplicity we only list the situations involving variables of the same bitwidth. When variables of different size are considered, additional opportunities arise. For example, when an unsigned short integer is assigned to an unsigned long integer, a leading zero bit section is created in the latter. More situations can be found to enhance the analysis. Leading and trailing dead bit sections Fig. 3 also gives the data flow equations for computing the dead bit sections. DBS in=out [n; v] represents the leading and trailing dead bit sections of variable v at entry/exit of node n. As expected, determination of dead bit sections is based upon backward analysis which examines each statement sv to identify the subset of bits of variable v whose values are not used by the statement. This information is represented by NOUSE(sv ; v) as described earlier, which can be computed for each statement given the results of the zero bit sections analysis. If the bit sections in NOUSE(sv ; v) are dead at the point after statement sv , then they are also dead immediately before statement sv . If a statement defines v and does not use it, then all bits of the variable are dead which is indicated by (>;>), i.e. leading and trailing dead bit sections of size equal to the width of the variable. The join operator conservatively computes those bit sections as dead at the exit of a node that are also dead at entry points of all successor nodes. An example The results of applying the above analyses are illustrated using an example shown in Fig. 4. For simplicity we use a straightline code example although our technique applies to programs with complex control flow structures. For the given code fragment, first we show the zero bit sections of each variable at the point it is assigned some value. Next we show the results of the dead bit sections analysis where the set of dead variables immediately following each statement are given. For example, immediately following statement 3 the higher order 4 bits of variable D are zero. In case the entire variable is dead we simply list the name of the variable (e.g., all of the involved variables are fully dead immediately preceding the code fragment). The results of the dead bit sections analysis are equivalent to the live ranges shown where the area enclosed in solid lines corresponds to the bit section that is not dead. If we examine the above ranges, it is easy to see that the maximum combined width of these live ranges at any program point is bits. Therefore a single bit register is sufficient to handle all these variables. Note that a traditional register allocator which ignores the widths of the variables will need four registers for this code fragment. sv Characteristics of sv NOUSE(sv ; v) trailing bits of v are not used. l is a compile time constant (l; leading bits of v are not used. c is a compile time constant with (l; t) - l leading bits and t trailing l leading and t trailing zero bits bits of v are not used. v op ::: op is an arithmetic or relational operator; (l; leading bits of v are not used. v has at least l leading zero bits v has at least l leading zero bits and (l; t) - l leading bits and t trailing bits trailing zero bits of v are not used. other forms of statements that use v (0; all bits of v are used. Figure 2: Partial use of a variable's bits. Input: control flow graph end), where each node contains a single intermediate code statement. definitions: boundary conditions: for each variable v, ZBS in [start; v] := DBSout [end; v] := (>; >), where > is the bitwidth of variable v. initialization: set all vectors to (>; >) S , where S is the number of variables. meet and join operators: V is the meet and join operator for the forward and backward analysis respectively. Zero Bit Sections Analysis: Solve iteratively ZBS in [n; v] := (ZBSout [p; v]): ZBSout [n; v] :=> > > > > > > > > > > > > > < ve constant; and sections (l c is a ve constant (l c is a ve constant ZBS in [n; x] elseif n is ZBS in [n; x] ^ ZBS in [n; y] elseif n is ZBS in [n; x] _ ZBS in [n; y] elseif n is (0; ZBS in [n; v] otherwise Dead Bit Sections Analysis: Solve iteratively DBS in [n; v] :=< uses v DBSout [n; v] otherwise DBSout [n; v] := (DBS in [s; v]): Figure 3: Forward and backward bit sections analysis. int short D, E; - 16 bits char B, C; - 8 bits 2. 3. 4. this was E's last use. 5. use A 7. 8. 9. last use of A 10. last use of B&0x80 11. last use of C 12. last use of D Zero Bit Sections 1. E: (0,0) 2. D: (0,0) 3. D: (4,0) 4. A: (12,0) 5. 6. A: (24,0) 7. B: (0,0) 8. C: (0,0) 9. 10. 11. 12. Dead Bit Sections 1. A:B:C:D 2. A:B:C 3. A:B:C:D(4,0) 4. A(12,0):B:C:D(4,0):E 5. A(12,0):B:C:D(4,0):E 6. A(24,0):B:C:D(4,0):E 7. A(24,0):C:D(4,0):E 8. A(24,0):B(0,7):D(4,0):E 9. A:B(0,7):D(4,0):E 10. A:B:D(4,0):E 11. A:B:C:D(4,0):E 12. A:B:C:D:E4 121 7E A Figure 4: Illustration of live range construction. 2. 3. 4. this was E's last use. 5. use A 7. 8. 9. last use of A 10. last use of B&0x80 11. last use of C 12. last use of D 1. 2. 3. 4. 5. use R0::19 7. 8. 9. last use of R0::7 10. last use of R16 11. last use of R8::15 12. last use of R20::31 1. 2. 3. 4. 5. use R20::19 7. 8. 9. last use of R20::7 10. last use of R215 11. last use of R216::23 12. last use of R116::27 Original code. Code using one register. Code using two registers. Figure 5: Using registers with packed variables. 3. VARIABLEPACKING=ITERATIVECO- ALESCING OF INTERFERING NODES In this section we present our variable packing algorithm. Let us first see the impact of variable packing on the generated code. Fig. 5 shows the code resulting after packing all variables of Fig. 4's example into one register R. The subscripts indicate the bit sections within R being referenced. It is clear that if bit section referencing is supported, a small number of registers can be used very effectively. Note that the shift operations of statements 3, 4, and 6 are translated into intraregister bit section moves which move a sequence of bits from one position to another. Also two additional intraregister moves, preceding statements 4 and 8, are required. These moves are required because sometimes when a variable that is allocated to the register is being defined, a free contiguous register bit section of the appropriate size may not be available. This is because the free bits may be fragmented. In this case the values of live variables present in the register must be shifted to combine the smaller free bit section fragments into one large contiguous bit section. The algorithm we have developed sacrifices some of the variable packing opportunities in favor of fast execution time. For the preceding example, although one register is sufficient, our algorithms allocates A, B, and C to one register and D and E to another reg- ister. The resulting code based upon using two registers is shown in the figure. Since the variables are not packed as tightly, we find that there is no need to carry out the two intraregister moves for overcoming the problem of fragmentation of free bits. Interference graph Our approach to variable packing is to perform it as a prepass to global register allocation. The merit of this approach is that existing register allocation algorithms can be used without any modifications once variable packing has been performed. In addition, we design the variable packing algorithm to operate upon the live range interference graph which must be constructed any way to perform global register allocation. The nodes of an interference graph correspond to the live ranges. Interference edges are introduced between node pairs representing overlapping live ranges. It is easy to see that from the perspective of the interference graph, variable packing can be performed through iterative coalescing of interfering nodes. In each step a pair of interfering live ranges can be coalesced into one node if no place in the program is their collective width greater than the number of bits in the register. After variable packing, register allocation is performed using the transformed interference graph. Definition 4. (Maximum Interference Width) Given a pair of live ranges lr1 and lr2 , the maximum interference width of these live ranges, denoted by MIW (lr1 ; lr2 ), is the maximum combined width of these live ranges across all program points where the two live ranges overlap. Let p) denote the width of live range lr at program point p. MIW (lr1 ; lr2 ) is computed as follows: iff 8n st lr1 and lr2 overlap at n, It should be clear that (lr1 ; lr2 ) are coalesced iff is the number of bits in each register. We always assume that no variable has width greater than jRj. The desired goal of coalescing can be set as achieving maximal coalesing that reduces the number of nodes in the interference graph to the mimimum possible that is achievable by any legal sequence of coalescing operations. However, the theorem we present next establishes that achieving maximal coalescing is NP-complete. In fact from our construction it can be seen that this result holds true even for straightline code. Theorem (Live Range Coalescing is NP-complete). Given a set of live ranges L, a constant l < jLj. Does there exist a live range coalesing that reduces the number of live ranges to l such that the width of no coalesced variable exceeds jRj at any program point? Proof. It is trivial to see that live range coalescing problem is in NP as given a solution it is easy to verify that it is correct in polynomial time. By performing a reduction from the bin packing problem (see [7], page 226) we can show that live range coalescing is NP-complete. The bin packing problem can be stated as follows. Given a set of items U , a size s(u) for each u 2 U , and a positive integer bin capacity B. Is there a partition of U into disjoint sets U1 , U2 , , UK such that the sum of sizes of the items in each set U i is B or less? An instance of bin packing problem can be transformed into an instance of live range coalescing problem as fol- lows. Corresponding to each item u 2 U , we construct a live range of uniform width s(u). We further assume that there is some program point where all live ranges fully overlap with each other. Now let If we can find a live range coalescing that reduces the number of live ranges to l such that none of the coalesced live ranges has a width greater than jRj, we have essentially solved the corresponding instance of the bin packing problem. The overall outcome of coalescing depends upon the selection and order in which pairs of nodes are examined for coalescing. Given the above result we use an iterative coalescing heuristic which picks a node from the graph, coalesces it with as many neighboring nodes as possible, and then repeats this process for all remaining nodes. Let us briefly consider the runtime complexity of an iterative coalescing algorithm. The coalescing must have been carried out in a series of steps where in each step two nodes are coalesced. To determine whether two nodes, say lr1 and lr2 , can be coalesced, we must check the condition MIW (lr1 ; lr2 ) jRj by scanning the two live ranges across the entire length of the program where the two live ranges overlap. The time complexity of this operation is O(L), where L is bounded by the number of statements in the program. The number of coalescing operations is bounded by the number of nodes N in the interference graph. Thus the total time spent in coalescing is bounded by O(N L). To avoid the expensive operation of scanning two live ranges to compute MIW (lr1 ; lr2 ) at the time of attempting coalescing, we explore the use of fast methods based upon the use of conservative estimates of MIW (lr1 ; lr2 ). A conservative estimate can overestimate MIW but it must never underestimate it. Let us consider a simple and most obvious approximation. By scanning the entire program exactly once, we can precompute the maximum width of each live range lr, MAX(lr). Using this information, estimated maximum interference width EMIW (lr1 ; lr2 ) can be computed as follows: EMIW (lr1 ; lr2 Note we do not need to scan the program to compute EMIW (lr1 ; lr2 ). While this method is simple and allows estimation of EMIW of two live ranges at the time of iterative coalescing in O(1) time, it fails to handle a common situation well. In Fig. 6 live ranges A and B are shown. It is clear that they can be allocated to a single register. However, since 64, we cannot coalesce them using this simple approach. A A A Edge labelling. Node labelling. Figure vs. edge labels. To address the above problem with node labels we make use of edge labels. Each edge (A; B) is labelled with a pair of values Ba), such that A b and Ba represent the widths of A and B respectively at a program point corresponding to maximum interference width of A and B (i.e., MIW For the above example, the edge label is (16; 16). The important observation is that by looking at the edge label we can now determine that coalescing of A and B is possible because their combined width at any program point does not exceed The edge labels are more formally defined below. Definition 5. (Interference Graph Labels) Initially each interference edge (A; B) is labelled with and Ba are the contributions of A and B to MIW (A; B) (i.e., MIW Subsequently, each edge (C; D) formed after coalescing, is labelled with (Cd ; Dc) where Cd and Dc are the contributions of C and D to EMIW (C; D) (i.e., EMIW (C; When nodes are coalesced, labels for the edges emanating from the newly created node must be computed. It is during this process that some imprecision is introduced. We have developed a fast and highly accurate method for computing the edge labels. Next we present this method in detail. Updating edge labels following coalescing If there was an edge between a node C and one or both of nodes A and B, then there will be an edge between AB and C in the transformed graph. We must determine the label (ABc ; Cab ) for this edge. Two cases that arise are handled as shown in Fig. 7. The first case involves the situation in which C was connected by an edge to either A or B. In this case the label of edge (AB; C) will be same as the label on the edge (A; C) or (B; C) as the case may be. Since C interferes only with A (or B), after coalescing of A and B the maximum interference width between AB and C is same as maximum interference width between A (or B) and C. It should be noted that no additional imprecision is introduced during the generation of the label for edge (AB;C). The second case considers the situation in which there is an edge between C and both A and B. In this case additional imprecision may be introduced during the estimation of (ABc ; Cab ) for edge (AB; C) as this label is based upon a conservative estimate of C). Our goal is to carry out this estimation quickly by avoiding examining the complete live ranges corresponding to nodes A, B and C. In addition, we would like to obtain a label that is as precise as possible based upon the existing labels of the three nodes and edges between them. Three candidate estimates for EMIW (A; B; C) denoted by EA , EB , and EC in Fig. 7 are considered. EA is the estimate of the sum of widths of A, B, and C at a point where maximum interference width between B and C takes place. At such a point, the best estimates for the widths of A, B and C are and C b respectively (i.e., represents the point at which maximum interference width of A and C takes place. Therefore values of EB and EC can be similarly computed. While it may not be the case that EMIW (A; B; C) is equal to any of the three computed values (i.e., EA , EB and EC ) we can derive a conservative estimate of EMIW (A; B; C) from these values. In particular, if we sort the values of EA , EB , and EC , the intermediate value Eint is a safe approximation for EMIW (A; B; C). Therefore as shown in Fig. 7, we choose this value and depending upon whether Eint is EA , EB or EC , we accordingly compute (ABc ; Cab ). The theorem in Fig. 8 formally proves the correctness of this method. Case I. Node C has an edge to either A or B. A (Ab,Ba) A (Ab,Ba) (Ac,Ca) =(Ac,Ca) Case II. Node C has an edge to both A and B. A (Ab,Ba) (Ac,Ca) (Bc,Cb) then Figure 7: Updating labels after coalescing A and B. From the intermediate value theorem it follows that a single coalescing operation takes O(1) time. Each coalescing operation removes a node from the interference graph. Therefore the number of coalescing operations is bounded by the number of nodes N in the interference graph. Hence the run time complexity of the coalescing operations is bounded by O(N). Recall that the slow algorithm had a complexity of O(N L). Example Let us apply the coalescing operations using the intermediate value theorem to the interference graph of the live ranges constructed for an example in Fig. 4. We assume that the registers are 32 bits wide for this example. From the live ranges constructed we first build the five node interference graph shown in Fig. 9. While the nodes in the interference graph can be coalesced in a number of ways, one such order is shown in Fig. 9. First we merge D and E. According to rules for handling Case I, the labels for all edges emanating from D become labels of the corresponding edges emanating from DE. In the next two steps nodes A, B, and C are coalesced during which Case II arises. Therefore, the labels on edges are updated using the intermediate value theorem giving the results shown in the figure. Note that if the bitwidths of the variables are ignored, the original interference graph requires 4 registers to color as the graph contains a clique of four nodes. In contrast a register allocator will need to use two colors to color the coalesced interference graph. Thus the proposed coalescing algorithm reduces the register requirements for the interference graph from 4 registers to 2 registers. The code based upon usage of two registers was shown in Fig. 5. Now let us conisder the result of application of simple coalescing approach which only maintains node labels. Assuming that the same pairs of nodes are considered for coalescing as were considered during the application of algorithm based upon edge labels in Fig. 9, we can perform at most two coalescing operations as shown in Fig. 10. Thus, in this case 3 registers would be required. Therefore using edge labels is superior to using node labels in this example. A D A Figure 9: Illustration of node coalescing.8 A A D Figure coalescing using node labels. Theorem (Intermediate Value Theorem). if Emin Eint Emax ; st Eint is safe. Proof. The proof is carried out in two parts. Lemma 1 shows that in general Emin is not a safe estimate for MIW (A; B;C) because Emin can be less than MIW shows that if Emin is less than MIW (A; B; C), then values of both Eint and Emax are greater than MIW (A; B; C). From Lemma 1 and Lemma 2 it follows that Eint is the best safe estimate for MIW (A; B; C) from among the three values, EA , EB and EC . (Lemma 1) Emin < MIW (A; B; C) can be true: Consider the construction of live ranges as shown in the figure be- low. Note that d > 1 in this construction which clearly confirms that indeed Emin may not be a safe estimate of C). A w+d w+d (w,w) A (w,w+d) (w-1,w+d) (Lemma where are contributions of A, B and C to MIW (A; B; C). By definition of MIW it must be the case that: any loss of generality, let us assume that Emin = EA . Given that Emin < MIW 3 and [Bc +C b WB +WC 6 and [Ac C). 7 and [A b +Ba 9 EC > MIW (A; B; C). We have shown that if EA < MIW (A; B;C), then EB > MIW (A; B; C) and EC > MIW (A; B; C). Given that EA is Emin , Thus we conclude that: Emin < MIW C). From Lemma 1 and Lemma 2 it follows that EMIW (A; Eint is the best safe estimate for MIW (A; B; C) from among the three values, EA , EB and EC . Hence the proof of the intermediate value theorem is complete. Figure 8: The intermediate value theorem. Priority based coalescing So far we have focussed on the fundamental issues of bitwidth aware register allocation (i.e., analysis for live range construction and variable packing using node coalescing). We have not addressed the following issues: Is coalescing always good? In what order should node coalescing be attempted? While coalescing can reduce the chromatic number of a graph, this in not always the case. In some situations coalescing may increase the chromatic number of graph - for the graph shown below the chromatic number is two before coalescing but it increases to three after coalescing. A solution for preventing harmful coalescing was proposed by Briggs et al. [1]. They observed that if the node created by coalescing of two nodes has fewer than k neighbors with degree of k or more, where k is the number of colors, the resulting node will always be colorable. Thus, they propose restricting coalescing to situations where resulting nodes are guaranteed to be colorable. A A CD Figure 11: Increase in chromatic number due to coalescing. The order in which node coalescings are attempted impacts the shape of the final graph and thus the number of colors required to color the resulting graph. For example, if we reconsider the example of Fig. 10 and merge nodes A and B as well as nodes C and D, the resulting graph contains three nodes which can be colored using two colors as opposed to three colors that are required by resulting graph of Fig. 10.8 A D E28 Figure 12: The impact of ordering of coalescing operations. One approach that we propose to address the above problem is to assign priorities to all of the nodes. Node with the highest priority, say n, is picked and neighbors of n are considered for coalescing in decreasing order of priority. When no more nodes can be coalesced with n, the next highest priority node is picked and the above process repeated. The priority of a live range l is computed as shown below. The greater the savings due to elimination of loads and stores, the higher is the priority. However, the savings are normalized with respect to the the amount of register resources used. The register usage is based upon the duration and the number of bits that are occupied by the live range. Hence, it is simply the area of the live range which can be obtained by summing together the number of bits occupied by the live range at all relevant program points. LiveRangeArea Our algorithm for carrying out node coalescing followed by register allocation is summarized in Fig. 13. Following the iterative node coalescing phase each set of coalesced variables is given a new name and the code is transformed to use this name. In ad- dition, intravariable moves are introduced to preserve program se- mantics. The resulting interference graph is then processed using a traditional coloring based register allocator. 1. Construct interference graph. 2. Label edges with interference widths. 3. Construct prioritized node list. 4. while node list 6= do 5. Get a node, say n, from prioritized node list. 6. for each node a in n's adjacency list do 7. Attempt coalescing a with n. 8. if successful, update graph and prioritized list. 9. endfor 10. endwhile 11. Replace each coalesced variable set with a new name. 12. Introduce intravariable moves. 13. Perform coloring based register allocation. Figure 13: Algorithm summary. 4. EXPERIMENTAL RESULTS We evaluated the proposed technique using benchmarks taken from the Mediabench [12] (adpcm and g721), NetBench [14] (crc and dh), and Bitwise project at MIT [17] (SoftFloat, NewLife, MotionTest, Bubblesort and Histogram) as they are representative of a class of applications important for the embedded domain. We also added an image processing application (thres). We applied our technique to selected functions from these benchmarks that are large in size. We constructed the interference graphs for the selected functions and measured the register requirements for fully coloring these graphs using the following algorithms: (a) Bitwidth unaware algorithm which at any given time allows only a single variable to reside in a Naive coalescing (NC) algorithm that labels each node with its declared width and uses these labels to perform coalescing; and (c) Our coalescing (OC) algorithm that builds live ranges using bit section analysis and labels edges with maximum interference width information to drive coalescing. In all three cases the register requirements were computed by repeatedly applying Chaitin's algorithm to find the minimum number of registers for which the graph could be fully colored. The results of our experiments are given in Table 1. While the OC algorithm reduces register requirements by 10% to 50%, NC algorithm is nearly not as successful. By reducing the register requirements by a few registers, the quality of code can be expected to improve significantly. This is particularly true for the ARM processor with bit section referencing extensions [13] in context of which this research is being carried out as ARM has 16 only registers. Table 1: Register requirements. Benchmark Registers Used Function BU NC OC adpcm decoder 15 15 13 adpcm coder g721.update g721.quantize 6 5 5 thres.homogen MotionTest.main 6 6 5 Bubblesort.main 9 9 7 Histogram.main 7 7 6 Table 2: Benefits of coalescing. Benchmark Number of Nodes Function Before After adpcm decoder 17 15 adpcm coder 20 17 g721.update 22 15 thres.memo 6 4 thres.coalesce thres.homogen 12 7 thres.clip 7 5 NewLife.main 8 5 MotionTest.main 9 7 Bubblesort.main 15 11 Histogram.main 13 11 crc.main 12 11 dh.encodelastquantum 8 5 Table 3: Change in maximum clique size. Benchmark Number of Nodes Function Before After adpcm decoder 15 13 adpcm coder g721.quantize 6 5 thres.memo 6 4 thres.coalesce thres.homogen 11 6 thres.clip 6 4 NewLife.main 7 4 MotionTest.main 6 5 dh.encodelastquantum 7 4 Table 4: Live ranges with bitwidth < bits. Number Live Range Widths (bits) of live Declared Max Size ranges Size After BSA adpcm.decoder adpcm.coder g721.update g721.fmult g721.quantize thres.memo thres.coalesce thres.homogen thres.clip NewLife.main MotionTest.main Bubblesort.main Histogram.main crc.main dh.encodelastquantum To further understand the significance of the two key steps of our algorithm, namely live range construction based upon bit section analysis and node coalescing, we examined the data in greater detail. The results in Table 2 show the extent to which node coalescing reduces the number of nodes in each interference graph. As we can see significant amount of coalescing is observed to occur. The data in Table 4 shows the significance of our live range construction algorithm. The declared widths of live ranges as well as their reduced maximum widths after bit section analysis (BSA) are given. As we can see, for many live ranges, the declared widths are much larger than their reduced maximum widths. The reason why NC algorithm is nearly not as successful as our OC algorithm is made clear in part by this data - the declared bitwidths of variables are often much greater than their true bitwidths. Finally it should be noted that although coalescing does not necessarily guarantee a reduction in register requirements, in most of the programs a significant reduction was observed. We looked at the interference graphs to understand why this was the case. We found that in most of these programs there were significantly large cliques present which accounted for most of the register require- ments. Moreover the maximum sized clique in the interference graph typically contained multiple subword data items. Thus, node coalescing resulted in a reduction in the size of the maximum sized clique and hence the register requirements. Table 3 shows the reduction in the size of the largest cliques for the programs where the above observation holds. The benchmarks which did not exhibit this behavior are omitted from the table. In the case of Soft- Float and Bubblesort there were no large cliques while in the case of g721.update and Histogram although large cliques were present, they were not reduced in size by node coalescing. 5. RELATED WORK Bit Section Analysis Stephenson et al. [17] proposed bitwidth analysis to discover narrow width data by performing value range analysis. Once the compiler has proven that certain data items do not require a complete word of memory, they are compressed to smaller size (e.g., word data may be compressed to half-word or byte data). There are a number of important differences between bitwidth analysis and our analysis for live range construction. First our analysis is aimed at narrowing the width of a variable at each program point as much as possible since we can allocate varying number of register bits to the variable at different program points. Second, while our approach can eliminate a trailing bit section, value range analysis can never do so. Our approach can eliminate a leading bit section of dead bits which contains non-zero values while value range analysis can only eliminate a leading bit section if it contains zero bits through out the program. Budiu et al. [2] propose a analysis for inferring the values of individual bits. This analysis is much more expensive than our analysis as it must analyze each bit in the variable while our approach maintains summary information in form of three bit sections for each variable. Finally, the analysis by Zhang et al. [9] is aimed at automatic discovery of packed variables, while this paper is aimed at carrying out analysis to facilitate variable packing. Memory coalescing and data compression Davidson and Jinturkar [4] were first to propose a compiler optimization that exploits narrow width data. They proposed memory coalescing for improving the cache performance of a program. Zhang and Gupta [20] have proposed techniques for compressing narrow width and pointer data for improving cache performance. However, both of these techniques were explored in context of general purpose processors. Therefore aggressive packing of scalar variables into registers was not studied. In contrast, the work we present in this paper is aimed at new class of embedded processors where efficient use of small number of registers is made possible by holding multiple values in a single register. The only work we are aware of that deals with register allocation for processors that support bit section referencing is by Wagner and Leupers [18]. How- ever, their work exploits bit section referencing in context of variables that already contained packed data. They do not carry out any additional variable packing as described in this paper. Some multi-media instruction sets support long registers which can hold multiple words of data for carrying out SIMD operations [5, 11]. Compiler techniques allocate array sections to these registers. In con- trast, our work is aimed at shrinking scalars to subword entities and packing them into registers which are one word long. The scalar variables that we handle are ignored by superword techniques. Finally in context of embedded processors work has been done on dealing with irregular constraints on register allocation (e.g., [10]). However, our work is being done in context of ARM instruction set with bit referencing extensions where bit section packing is an important issue [13]. 6. CONCLUSIONS Multimedia and network processing applications make extensive use of subword data. Moreover embedded processors typically support a small number of word sized registers. Instruction set support for bit section referencing provides us with an opportunity to make effective use of small number of registers by packing multiple subword sized variables into a single register, without incurring any additional penalty for accessing packed variables. However, no techniques exist for either identifying variable bitwidth data or packing them into registers. We presented the first algorithms to solve both of these problems. We presented efficient analyses for constructing variable bitwidth live ranges and an efficient variable packing algorithm that operates on an enhanced interference graph. Our experiments show that the proposed techniques can reduce register requirements of embedded applications by 10% to 50%. 7. ACKNOWLEDGEMENTS This work is supported by DARPA award F29601-00-1-0183 and National Science Foundation grants CCR-0208756, CCR-0105535, CCR-0096122, and EIA-9806525 to the University of Arizona. 8. --R "Improvements to graph coloring register allocation," "BitValue Inference: Detecting and Exploiting Narrow Width Computations," "Register allocation and spilling via graph coloring," "Memory access coalescing : a technique for eliminating redundant memory accesses," "Compiling for SIMD within Register," "Data Alignment for Sub-Word Parallelism in DSP," Computers and intractability: a guide to the theory of NP-completeness "Iterated register coalescing," "A Representation for Bit Section Based Analysis and Optimization," "Preference-Directed Graph Coloring," "Exploiting Superword Level Parallelism with Multimedia Instruction Sets," a tool for evaluating and synthesizing multimedia and communications systems," "Bit section instruction set extension of ARM for embedded applications," Benchmarking Suite for Network Processors," "A New Network Processor Architecture for High Speed Communications," "ARM architecture reference manual," "Bitwidth Analysis with Application to Silicon Compilation," "C Compiler Design for an Industrial Network Processor," "Commbench - a telecommunications benchmark for network processors," "Data Compression Transformations for Dynamically Allocated Data Structures," --TR Improvements to graph coloring register allocation Memory access coalescing Iterated register coalescing MediaBench Bidwidth analysis with application to silicon compilation Exploiting superword level parallelism with multimedia instruction sets Compiler Design for an Industrial Network Processor Preference-directed graph coloring ARM Architecture Reference Manual Computers and Intractability Bit section instruction set extension of ARM for embedded applications NetBench Compiling for SIMD Within a Register BitValue Inference A Representation for Bit Section Based Analysis and Optimization Data Compression Transformations for Dynamically Allocated Data Structures Register allocation MYAMPERSANDamp; spilling via graph coloring --CTR Ranjit Jhala , Rupak Majumdar, Bit level types for high level reasoning, Proceedings of the 14th ACM SIGSOFT international symposium on Foundations of software engineering, November 05-11, 2006, Portland, Oregon, USA Bengu Li , Rajiv Gupta, Simple offset assignment in presence of subword data, Proceedings of the international conference on Compilers, architecture and synthesis for embedded systems, October 30-November 01, 2003, San Jose, California, USA Lal George , Matthias Blume, Taming the IXP network processor, ACM SIGPLAN Notices, v.38 n.5, May Oguz Ergin , Deniz Balkan , Kanad Ghose , Dmitry Ponomarev, Register Packing: Exploiting Narrow-Width Operands for Reducing Register File Pressure, Proceedings of the 37th annual IEEE/ACM International Symposium on Microarchitecture, p.304-315, December 04-08, 2004, Portland, Oregon
minimal bitwidth;packing interfering nodes;subword data;embedded applications
604147
A type theory for memory allocation and data layout.
Ordered type theory is an extension of linear type theory in which variables in the context may be neither dropped nor re-ordered. This restriction gives rise to a natural notion of adjacency. We show that a language based on ordered types can use this property to give an exact account of the layout of data in memory. The fuse constructor from ordered logic describes adjacency of values in memory, and the mobility modal describes pointers into the heap. We choose a particular allocation model based on a common implementation scheme for copying garbage collection and show how this permits us to separate out the allocation and initialization of memory locations in such a way as to account for optimizations such as the coalescing of multiple calls to the allocator.
Introduction High-level programming languages such as ML and Java allow programmers to program in terms of abstractions such as pairs, records, and objects, which have well-defined semantics but whose realizations in terms of the underlying concrete machine are left unspecified and unobservable. Sometimes, it is necessary to program without these abstractions. . A programmer may need to interact with an operating system or a network or another programming language in such a way as to require exact knowledge of, and control over, the manner in which data is laid out in memory. . A compiler must choose a concrete implementation for the high-level abstractions provided by the source level language-such as the actual layout of data in memory and the manner in which such memory gets allocated and initialized Traditionally, both of these needs have been addressed in an un- typed, or a weakly typed fashion. Languages such as C give programmers relatively precise control over data layout and initialization at the expense of type and memory safety. Traditional compilers represent programs internally using un-typed languages, relying on the correctness of the compiler to preserve any safety properties enjoyed by the source program. Recently, research in the areas of typed compilation and certified code [12, 21, 11] has focused on providing type systems for low-level languages in which abstractions such as control flow and data layout are made explicit. These ideas have been used in a number of compilers [12, 21, 9, 2, 19, 6]. However, some of the mechanisms that have been invented to describe low-level operations are fairly ad hoc and do not yet have an interpretation in standard type the- ory. For example, in the typed assembly language formalism[11], allocation and initialization can be separated, but at the expense of having to annotate each type with a flag indicating whether or not the value it classifies has been initialized. This kind of low-level technique seems unlikely to integrate well with a high-level programming language. In this paper, we attempt to give a type theoretic account of data layout that provides a foundation for defining how high-level constructs such as pairs are laid out in memory. We realize our system with a concrete allocation model based on a common implementation of a copying garbage collector and show that we can separate out the process of allocating a block of memory from the process of initializing the individual memory words. Our system is flex- 2.3. 3 4 5 1. Figure 1. Three possible layouts for the term (3,(4,5)) ible enough to permit multiple allocation calls to be coalesced so that memory for multiple source level objects can be allocated si- multaneously, while ensuring that calls to the allocator can never invalidate assumptions made about the state of partially initialized data. An important contribution of this work is that it remains completely within the framework of a lambda calculus which enjoys the standard meta-theoretic properties. In this way, we reconcile the very low-level notion of allocated memory with the substitution properties expected of a high-level programming language. This is of particular interest because it suggests the possibility that these ideas could be made available to programmers, so that even programs requiring detailed control of memory layout could be written in a high-level language. 2 Data layout and allocation Specifying the layout of data in memory is an essential part of realizing a high-level program as a concrete collection of machine instructions and data, but one which is usually not of direct interest to programmers. The programmer cares about the ability to construct objects, but most of the time cares about the layout in memory only insofar as it affects the performance of operations on an object. How terms should be laid out in memory is therefore a matter of policy for the compiler writer. For example, the lambda calculus term (3,(4,5)) of type int- (int-int) defines a pair whose first element is 3 and whose second element is a pair containing 4 and 5. Figure shows several possible representations for this term. One compiler might choose to represent this as a pointer to a pair, whose elements are an integer and a pointer to another pair. However, another might choose to add an indirection to integers, or to attempt to flatten the whole term into three adjacent cells in memory. The high level notion of pairing captures certain operational properties that are useful to the programmer, but does not uniquely specify an implementation strategy. Commonly, a compiler simply chooses to interpret the pair type as meaning one particular strategy. For the purposes of giving a general account of data layout, this is clearly unsatisfactory as it does not permit us to break the high-level concept into its constituent concepts. A first step to a more general type theory for data layout is to observe that there seem to be two key concepts used by the different interpretations of pairing given in figure 1: adjacency and indirec- tion. Each of the different choices of representation corresponds to a different choice as to which data is to be represented by physically adjacent bytes in memory and which data is to be represented via an indirection into another portion of memory. This is the first notion that we shall attempt to capture in our type system. 2.1 Allocation Once the layout of data in memory has been made explicit, it becomes possible to consider the process by which new memory is created and initialized. We suggest that it is useful to think of this in terms of three stages, regardless of the mechanism employed. Reservation is the process by which a new block of uninitialized memory is created. Initialization is the process by which values get written into the reserved memory, potentially changing its type. It is important for type safety that either the memory be treated linearly in this stage, or else that the initialization operations be such that they only refine the type [3]. Allocation is the process by which a section of reserved (and presumably initialized) memory is made available as an ordinary unrestricted object. Different memory-management systems combine these stages in different ways. For example, in the TAL framework [11], reservation and allocation are done atomically, and hence initialization is very restricted in how it can change the type. The concrete memory management system that we choose to model is one commonly used in practice by copying garbage collectors and hence is of particular interest. This choice is not essential- other systems can be expressed using similar techniques to those we present here. In a copying garbage collector, the available memory can be divided into two adjacent contiguous sections: a heap containing data that has been allocated since the last garbage collection (or perhaps just the youngest generation thereof), and a possibly empty freespace containing memory that has not yet been allocated. The allocator maintains an allocation pointer (or freespace pointer), which points to the end of the allocated data and the start of the free memory, and a heap-limit pointer, which points to the end of the free memory. To create a new heap object requiring n bytes, the program first compares the allocation pointer to the heap-limit pointer to ensure that there are at least n bytes available in the freespace. If not, it calls the garbage collector to free up enough space. This step corresponds to the reservation phase discussed above. Once sufficient memory has been found-either in the existing freespace or by calling the garbage collector-the program may assume that n bytes of space exist in front of the allocation pointer. We refer to this initialized area as the frontier. Once space has been reserved on the frontier, values can be written into the individual cells of memory via offsets from the allocation pointer. This corresponds to the initialization phase. At any point, the program may "move" a prefix of the frontier into the heap. The value of the allocation pointer becomes the pointer to the new heap value, and the allocation pointer is advanced past the allocated space. This corresponds to the allocation phase. Figure 2 gives an example of this process. The first line shows a schematic diagram of the heap and the freespace, where a.p. stands for the allocation pointer and l.p. stands for the limit pointer. The heap freespace l.p. a.p. d := x c := 3 freespace x5heap l.p. a.p. x y reserve 4 as [a,b,c,d] a := 4 a b c d l.p. a.p. freespace d c heap l.p. a.p. x freespace Figure 2. Reservation, initialization, and allocation of (3,(4,5)) ragged boundary of the freespace indicates that we have no information about its extent-it may potentially be exhausted. The second line of the figure shows the result of reserving four words of space-sufficient for allocating the term (3,(4,5)) using the first layout strategy from Figure 1. We refer to the individual cells of the frontier by the names a,b,c and d. Note that this step may have invoked the garbage collector to free up more memory if the freespace from the previously line was in fact exhausted. To create the pair (4,5) we assign 4 to a, 5 to b, and then allocate a and b into the heap getting back a heap pointer x as shown on the third line of the figure. We can then initialize the top-level pair by writing 3 to c and x to d. A final allocation step gives us a pointer y which refers to a heap allocated structure of the form pictured in the first line of Figure 1. As this example shows, we do not require that the entire frontier be allocated as a single object. The program may choose to reserve space for several objects at once and then initialize and allocate them individually. This optimization avoids multiple checks against the heap-limit pointer. There are two constraints on this process that must be captured by our type system to ensure safety. Firstly, the manner in which we "move" objects into the heap means that objects cannot be allocated from the middle or end of the fron- tier. Only prefixes of the frontier-that is, contiguous blocks of memory adjacent to the allocation pointer-may be allocated. Secondly, reserved space in the frontier cannot persist across successive reservations nor across function calls. When the garbage collector is called it will copy the live data to a new heap and change the allocation pointer to point to this new location. Any partially initialized data that was previously in the frontier will be lost in the process. This corresponds to a kind of destructive effect: the state of the frontier cannot be assumed to be preserved across the evaluation of any term that could potentially call the allocator. The type system must therefore ensure that no assumptions about the state of the frontier can persist across the evaluation of any term that might reserve or allocate memory. 3 Ordered linear type theory Ordered (or non-commutative) linear logic is a variant of standard linear logic in which hypotheses must not only be used exactly once, but must also be used in order [17, 16, 18, 15]. The corresponding proof terms make up an ordered lambda calculus that is characterized by the lack of an exchange property for the ordered context in addition to the usual linearity restrictions. We present a small fragment of the ordered lambda calculus by way of introduction to the these ideas. The presentation here is simpler than previous work, in that it omits the linear context, retaining only the ordered and unrestricted contexts. The modal therefore moves directly from the ordered terms to unrestricted terms. Typing rules for the ordered lambda calculus have the form G;W # t, indicating that the M has type t under the variable assumptions declared in the unrestricted context G and the ordered context W. We distinguish syntactically between ordered variables a which must be used linearly and in order, and unrestricted variables x which may be used arbitrarily often. Unlike standard linear type theory, the ordered comma operator interpreted as simple list concatenation and does not permit the intermingling of hypotheses. Where unambiguous, we write a:t instead of a:t, - for singleton contexts. unrestricted arrow multiplicative unrestricted contexts | x unrestricted variables | n integer literals | M .M fuse intro | leta 1 .a 2 =MinM fuse elim | l(x:t).E lambda intro | M M lambda elim Figure 3. Standard ordered lambda calculus syntax This definition means that concatenation of contexts preserves the order of the entries in the contexts. The multiplicative connective (fuse) demonstrates a use of this concatenation operator. The elimination rule for fuse splits it into components and places them in the ordered context. Notice that the variables representing the components of M 1 go into the ordered context in place of W. Finally, the mobility modal permits terms that are orderedly closed to be moved to the unrestricted context. G; G; 3.1 Size preservation and adjacency There are three interesting observations that we can make about ordered lambda calculus terms that motivate the application of ordered type theory to data layout. 1. Because ordered variables may not exchange position in the context, we may think of ordered variables as simply standing for locations in the ordered context. 2. We may break ordered terms down into their components and re-form them, but we may not change their order. In particu- lar, the term that splits apart an ordered pair and reforms it in the opposite order is not well-typed. let a 1 .a a in a 2 .a 1 Viewed as a linear (rather than ordered) term, this code would be well-typed. 3. The ! modality takes an ordered term whose location is fixed and moves it into the unrestricted context, where its location become indeterminate. Based on these observations, we propose the following three intuitions as the basis for our system. 1. An ordered context may be thought of as describing a particular region of memory under consideration. Ordered variables correspond to locations, or offsets into the region. Adjacent variables in the context correspond to physically adjacent lo- cations, with extents given by the types of the variables. 2. The fuse constructor t 1 .t 2 describes terms that are physically adjacent in memory. The fact that we cannot reorder ordered terms corresponds naturally to the fact that we cannot reorder bytes in memory. 3. The ! modality ! t corresponds to an indirection out of the region of memory described by the ordered context into another (unspecified) part of the heap. The standard ordered lambda calculus does not entirely justify these intuitions. Ordered terms preserve the order of sub-components, but they do not in general preserve their adjacency. The essence of this problem can be seen in the derived ordered substitution principle Notice that the portion of the ordered context that is passed to the term being bound is replaced with the variable itself when type-checking the rest of the body. Our intention is that operations such as this should be done in-place on the memory described by the ordered context. However, the following term demonstrates that this does not hold in the general ordered lambda calculus. G; The problem is that we are able to insert unrestricted terms into the ordered terms in arbitrary places. While this does not violate our notion that ordered variables correspond to locations, it does mean that these locations are not fixed. Operationally, it would seem that we would be forced to shift all of W 2 over in memory to make room for the new term in the context. An alternative way of looking at this is that the general ordered lambda calculus is not size preserving: the sub-derivation G:- # produces a term of size one from a context of size zero. If we interpret the ordered context as describing a region of mem- ory, then the above term inserts a word-sized value into an empty region of memory! In order to prevent such problematic terms, it is necessary to carefully restrict the calculus in such a way as to ensure that operations on memory preserve size. The notion of size preservation is the last insight necessary to formulate a lambda calculus in which we can give a full account for data layout. We will use the fuse type to describe adjacency and the modal type to describe indirection, while restricting the terms in such a way as to enforce various key size preservation properties. The allocation model described in section 2 will be accounted for by using an ordered context to describe the frontier. Ordered variables then become offsets into the frontier, and reservation, initialization, and allocation become operations on ordered terms. The linearity of ns | n | V .V | l(x:t).E | !V ns | n | l(x:t).E | !V | reserve n as ain E | alloc Q as xin E | | let | let | let! (x . x) =M in E | let ! x =M in E Figure 4. Syntax the ordered context will permit destructive operations on the frontier (such as initialization), and the size preservation property will ensure that all operations on the frontier may be done in-place. 4 The orderly lambda calculus We now have all of the ideas that we need to define a language for data layout and allocation, which we shall call the orderly lambda calculus, or l ord for short. For the sake of brevity, this paper will focus on a small core language that captures the essential ideas. The syntax of the core language is given in figure 4. We use the notation t n for an n-ary fuse of t. For data layout purposes, we only require a few new types from the ordered lambda calculus: the fuse constructor which models adjacency; the modal constructor, which models indirection; and the multiplicative unit. Other types include a base type of integers and the type of unrestricted functions. The NS (nonsense) type is the type of a single un-initialized word of memory. It is important for our purposes to distinguish between types which are of unit size and hence can be kept in registers or on the stack, and other types that must be heap allocated. This is accomplished by a kinding distinction k. The kind T reg classifies the types of values which may be loaded into registers, whereas the kind T h classifies types that may be heap-allocated (a strict super-set of the former). An important property of this language is that types uniquely determine the size of the data they classify. For simplicity, the smallest unit of size we consider is a single machine word. The multiplicative unit type has size zero, since it is inhabited by a single value which therefore does not need to be rep- resented. We view the function type as having unit size, since we expect that a practical implementation would use closures to represent functions. Under closure conversion, lambdas become existentially quantified records allocated on the heap, and hence are represented by a pointer of unit size. We assume that the actual code for the function will be statically allocated. Ordered contexts W map ordered variables a to types t, and are used to describe regions of memory (in particular, the frontier). The notion of sizing for types extends naturally to ordered contexts. As before, exchanging, discarding, or duplicating variables in the ordered context is not permitted. Unrestricted contexts G map ordinary variables x to their types. The well-formedness judgement for unrestricted contexts checks that all unrestricted variables have unit-sized types-that is, types whose kind is T reg . Ordinary variables correspond to registers or stack slots in the underlying machine, and so are restricted to have word size via this kinding mechanism. This is a key point about the orderly lambda calculus: all large objects are required to be explicitly allocated and initialized. The term level of l ord is split into four separate syntactic classes: coercion terms Q, heap values V , terms M and expressions E. The main typing judgements are described in figure 5, along with comments about the size properties which they enjoy. Complete definitions of the typing rules can be found in appendix A. Making allocation explicit introduces a kind of effect into the lan- guage. Reserving and allocating memory is an effectful operation, and as we saw in the previous section these effects may interfere. In order to control these effects and their interaction we introduce a distinction between terms M and expressions E in the style of Pfenning and Davies [14], but without an explicit modal type for computations. (The computation type does not seem useful in our setting since we do not have the inclusion of expressions into terms, instead taking the partial arrow as primitive). The syntactic form we impose is not overly restrictive: it is actually related to, but more permissive than, the A-normal or CPS forms that many compilers typically use. 4.1 Terms Terms M correspond to values that do not reserve or allocate in the course of their evaluation, but that may contain free references to ordered variables (that is, to the frontier). In this presentation, all terms are values-but it is straightforward and useful to include other primitive operations that do not allocate (such as integer oper- ations) at this level. The typing judgement for terms is of the form t. The term M may refer to variables in G arbitrarily often, but must refer to each variable in W exactly once, and in an ordered fashion. The typing rules for terms are for the most part unsurprising. For the l-abstraction case, the body of the function is checked as an expression, with the argument placed in the unrestricted context. Notice that we permit free references to the frontier in functions. Since function application lies in the category of expressions, we Judgement Size properties Meaning # W W is a well-formed ordered context. is a well-formed unrestricted context. is a well-formed type. to look like t . is a non-allocating/non-reserving term of type t. typed expression of type t which consumes W. is a closed value of type t. well-typed frontier for the ordered context W. Figure 5. Typing judgements for l ord will defer discussion of the elimination form to Section 4.4. All other terms must be closed with respect to the ordered context. The most non-standard term is !V . This term corresponds to a pointer into the heap to a location occupied by the heap value V , and is the canonical form for terms of type ! t. G; - # trm An interesting facet of our presentation is that we account for heap allocation without requiring an explicit heap (for example in the style of Morrisett and Harper [10]). In a heap semantics, a pointer to a value V is represented by a label #, with # bound to V in an explicit heap data-structure. Since sharing is not observable in our simple calculus, we avoid this extra complexity by representing such values directly as !V , denoting a pointer to a location occupied by V . We stress that this is purely a technical convenience-it is straightforward to give a heap semantics in which the sharing is made explicit in the usual fashion. 4.2 Heap Values may occur in memory. It is therefore essential that they be closed. An open heap term would require that a new copy be implicitly allocated every time different values were substituted into it, which is contrary to the aims of l ord . The typing judgement for heap values, # val t, enforces this property. The primary motivation for having heap values comes from the operational semantics of the language. However, it is not intended that they should play the role of so-called "semantic objects" that are only permitted to be introduced in the course of evaluation. It is perfectly reasonable for a programmer to write heap values in the source program. Doing so corresponds precisely to the notion of statically allocated data-that is, data that is present in the heap at the start of the program. The important difference between heap values and terms is that heap values may be of arbitrary size. This is reflected in the syntax by the value denoting a contiguous block of memory in which V 1 is laid out adjacent to the value V 2 . The fact that fused terms are adjacent means that the . constructor is associative in the sense that the term 3. (4 .5) has the same representation in memory as the term (3 . 4) . 5. Both terms describe three successive words of memory, occupied by the integers 3, 4, and 5 respectively. This is a fundamental difference from ordinary lambda calculus pairing, in which (3,(4,5)) is almost certain to have a different representation from ((3,4),5). This associativity is just one example of values which have different types but the same representations. Other examples include values involving the ordered unit, #. Since we do not choose to represent this value, we expect that the representations of 3 . 3, and 3 will all be the same at runtime. Coercion terms exist to provide a mechanism by which to convert between such values which have different typing structure but the same underlying representation. 4.3 Coercions The level of coercion terms in this fragment of the language is extremely simple, consisting only of variables a, the ordered unit #, and fuse Q 1 .Q 2 . Coercion binding and elimination forms are provided at the expression level (Section 4.4). Intuitively, coercion terms package up the frontier into new forms without changing the underlying representation. For example, the term a 1 . a 2 takes the section of the frontier described by a 1 and the section described by a 2 and combines them into a single fuse which could then be bound at a new name using the expression level coercion let. The orderedness of the terms ensures that the two sections were already adjacent, and hence combining them into a fuse does not change their representation. The typing judgement for coercion terms is of the form W # crc signifying that Q re-associates W to have the form t. The coercive nature of the terms is exhibited in the size preservation property that holds of this judgement: that The unit term is well-typed in the empty context. 4.4 Expressions So far we have only seen the value forms that occupy or coerce memory, but that do not modify it. The memory operations- reservation, allocation, and initialization-are all done at the level of expressions. The well-formedness judgement for expressions is given by t. The ordered context W in the typing judgement describes the current state of the frontier. Because of the destructive nature of the reserve and allocate operations, the interpretation is that the frontier is consumed by the expression E. That is, any space that is on the frontier must either be allocated by E, or explicitly destroyed. As we saw in section 2, memory operations are effectful, and so the type system for expressions must be carefully designed to ensure that these effects do not interfere. This is enforced by always passing the entire ordered context (and hence the entire frontier) to each sub-expression (but not sub-term). In this way, we ensure that every possibly allocating/reserving expression has a correct view of the entire frontier when it is evaluated. The expressions can be conceptually divided into four basic categories Ordinary expressions The inclusion of values into expressions is given by the expression retM. G; G; This is the only value form for expressions, and consumes no re- sources. It is unsound to permit the term M to contain ordered vari- ables, since it may be substituted for an unrestricted variable by the primitive let form discussed below. Function application is an expression, since the evaluation of the body of the function may engender memory effects. Applications are syntactically restricted to permit only application of a term to another term. G; - # trm The term being applied is permitted to refer to ordered variables, but the argument must be closed since unrestricted functions may duplicate or drop their arguments. Application allows us to define a term-level let construct with the following derived typing rule. G; This let is not fully general, since there is no way to bind the result of an application to a variable. Therefore, we introduce a primitive let form to bind expressions to variables. Notice that we pass the entire ordered context to the first sub- expression. This is a crucial point: E 1 may have memory effects that could invalidate any previous assumptions about the state of the frontier that E 2 might make. Therefore, E 2 cannot assume anything at all about the state of the frontier-that is, it must be well-typed in an empty ordered context. Somewhat surprisingly, it is safe to permit E 1 to have free references to the ordered context. This is reasonable because expressions consume resources, but do not contain them. By this we mean that the value form for expressions (retM) is well-typed only in an empty ordered context. Therefore, if the ordered context W is not empty, then E 1 must explicitly destroy or allocate all of the memory described by W before it reaches a value. Since this value will be orderedly closed, it is safe to substitute it freely for the unrestricted variable x. Memory expressions The most interesting and non-standard expressions are those dealing directly with the frontier. Recall that there are three operations of interest: reserving space on the frontier, initializing pieces of the frontier, and allocating prefixes of the frontier into the heap. These three operations are captured directly as primitives. As we shall see later, this is not entirely necessary-by extending the type system somewhat we can give types to these primitives as constants. For simplicity however, we first present them as primitive notions. The first operation, reservation, discards any resources that were previously mentioned in the ordered context, and introduces n words of nonsense into the frontier. reserve n as This corresponds exactly to the reservation operation described in Section 2.1, which destroys any existing data on the frontier and provides a block of "new" uninitialized space. Memory must be written using assignment. G; The ordered term Q gives the location in the ordered context to which the value should be written. This location is then referred to by a in the body of the expression. The linearity of the ordered context is important here, since we are destructively changing the type of a memory location. At any point, space can be allocated from the left side of the frontier with the alloc construct. The coercion term Q describes a section of the frontier to be packaged up as a boxed heap value. The splitting of the ordered context ensures that the term to be allocated is a prefix of the frontier. The new heap value is given a pointer type and permitted to be used unrestrictedly for the rest of the program. Coercion expressions The memory expressions manipulate the frontier using ordered variables, which stand for offsets into the frontier. Coercions are used to manipulate ordered variables, combining them into bigger terms or breaking them into smaller pieces. The simplest coercion expression is the elimination form for unit. G; if t is not a fuse and load t x =M[i] in E load load t is not a fuse Figure 6. An example of a direct-load defined in terms of split Since the unit term is considered to have zero size, we may eliminate it freely from the ordered context without changing the size or adjacency properties of the terms in the frontier. The elimination form for fuse is also a coercion expression. The intuition is that since t 1 . t 2 describes two adjacent blocks of memory, we are free to view the single block of memory described by Q as two adjacent blocks at offsets named by a 1 and a 2 . The last coercion operation is the simple ordered let form, which permits ordered terms to be packaged up or renamed. Load expressions The memory operations account for the creation of heap objects. Equally important is the ability to load values out of the heap. Once an object is in the heap, we must have some way of accessing its components. Pointers to "small" objects can be de-referenced directly G; The kinding restriction ensures that the only values that can be loaded with this operation are those that will fit into a register. To access the fields of larger objects, we provide a composite elimination construct that takes a pointer to a large object, and produces two pointers to the immediate subcomponents of the object. G; Notice that the variables are bound not to the components of M themselves, but rather to pointers to the components of M. Using this expression we may successively iterate over large composite objects until we arrive at a pointer to a small object which can be loaded directly. This construct is somewhat disturbing from a practical standpoint for two reasons. In the first place, it seems to require pointers into the interior of objects (sometimes called locatives) in order to be implemented efficiently. While not completely out of the question, interior pointers can be quite problematic for copying garbage collectors (at least when implemented as direct pointers into the interior of heap objects). More importantly however, this construct does not permit constant time access to fields of a heap-allocated record. For example, to access the last element of a n-ary tuple in right-associated form requires computations before we arrive at a term that can be loaded directly. This is clearly impractical. We choose to use this "split" operation as the primitive notion because it provides a simple and natural elimination form. In practice however, it is likely that this term would be eliminated in favor of one of a number of direct-load constructs that are definable in terms of split (figure 6). By taking such a direct-load as primitive and giving it a direct implementation, the need for the interior pointers is eliminated and fields of records can be loaded in constant time. 4.5 Frontier semantics In order to make the connection between the orderly lambda calculus and the frontier model of allocation clear, the semantics keeps an explicit frontier. This means that the reduction relation is defined not just on expressions, but rather on a frontier and an expression together. Frontier terms w (as defined in figure (that is, offsets) to values V . From the standpoint of the operational se- mantics, the frontier plays a role very similar to an explicit substi- tution. The typing judgement for the frontier, # w : W, asserts that the ordered context W describes a frontier that looks like w. The evaluation relation for the orderly lambda calculus is given in terms of frontier/expression pairs. The relation (w,E) # (w # , indicates that in frontier w, the expression reduces in a single step to the expression E # , with new frontier w # . The complete definition of this relation is given in Appendix B. It is straightforward to show that reduction preserves typing, and that well-typed terms that are not values may always be reduced further. Theorem 1 (Progress & Preservation) 1. Either (w,E) # (w # , 2. if (w,E) # (w # , PROOF. The proof proceeds by induction on the derivation of t, with the help of several substitution lemmas and some auxiliary lemmas proving properties of ordered contexts and frontiers 4.6 Size properties An important property of the orderly lambda calculus is that types uniquely determine the size of the data that they represent. We have informally mentioned a number of sizing properties of the calcu- lus: in particular that coercion terms preserve size, and that terms and expressions are always of unit size (so that they can be kept in registers). These properties can be formalized as follows. Theorem 2 (Size) 1. If # 2. If # then #i such that 3. If W # crc 4. If # val 5. If G;W # trm 6. If G;W # exp 7. If # w PROOF. For each clause we proceed separately by induction on typing derivations. 5 Representing the lambda calculus One of the intended uses of l ord is as a target language for translation from higher-level languages. To show how this can be done, and to provide some intuition into how the language is used, we present in this section a translation from the simply typed lambda calculus with products and unit into the orderly lambda calculus. We begin by defining a translation ptq that maps each ordinary lambda calculus type to a l ord type. The product case is unsurprising: we represent a pair as a pointer to a heap-allocated record containing the sub-components. As discussed in section 2, other representations are possible. We represent the ordinary lambda calculus unit as a pointer to the orderly lambda calculus unit. Recall that l ord . This means that our chosen representation of unit is as a pointer to a zero-word object. This corresponds precisely to the standard implementation of values of type unit as a distinguished pointer to nothing (e.g. the null pointer). An analogous translation is defined at the term level. The interesting case is the translation of pairing, since pairs are the only terms requiring allocation. We begin by defining a l ord function pair. reserve 2 as a (1) in leta 1 .a in leta 2 .a in in a 1 := x 1 as a # 1 (5) in a 2 := x 2 as a # 2 (6) in alloc(a # 1 in ret x (8) The first line of the function reserves the space on the frontier from which the pair will be created. This binds a single ordered variable a which points to the beginning of this space. Line 2 gives the names a 1 and a 2# respectively to the first and second words of the newly allocated space. From the typing rule for reserve we can see that the second location has an extra zero-byte value of type unit attached, so lines 3 and 4 serve to split out and eliminate this. Lines 5 and 6 initialize the two locations, renaming them to a # 1 and a # 2 . Finally, line 7 allocates the initialized space into the heap and names the result x, which becomes the return value of the function in line 8. This definition demonstrates how the various operations interact to permit low-level code to be written in a relatively high-level man- ner. In particular, there is no mention of offsets at all: everything is done in terms of standard alpha-varying variables. It may seem that this code is somewhat verbose, but it is simple to define syntactic abbreviations and composite terms that eliminate much of the verbosity. For example, in the common case for initialization terms where the coercion term Q is a variable, we may take advantage of alpha-conversion to simply re-use the old variable name, yielding a more standard looking assignment syntax. It is also trivial to define a composite reserve operation that pre-computes the offset variables. Working out the definition of this term is left as an exercise to the reader, but using these abbreviations, we can write the pair constructor quite succinctly. reserve in a 1 := x 1 in a 2 := x 2 in alloc(a 1 in ret x The elimination forms for pairs can be given succinct definitions using the direct load defined in Figure 6. fst load in ret x 1 load in ret x 2 The remainder of the translation of the simply typed lambda calculus is straightforward. All variables introduced by the translation are assumed to be fresh. pl(x:t).eq pe in let x in x 1 x 2 in let x in let x in let in ret x in fst x in snd x 5.1 Coalescing reservation Translating simply typed lambda calculus terms into the orderly lambda calculus breaks the high level memory abstractions and exposes a finer grain of detail. Exposing these details can enable optimizations not expressible at the more abstract level. A simple example of this is the ability to coalesce multiple calls to the allocator. For example, consider the result of translating the term (3,(4,5)) under the above translation (with some minor simplifications). in a 1 := 4as a # 1 in a 2 := 5as a # 2 in alloc(a # 1 .a # 2 ) as x in ret x in reserve 2 as[a 3 , a 4 in a 3 := 3as a # 3 in a 4 := x t as a # 4 in alloc(a # 3 .a # 4 ) as x in ret x This code fragment makes two separate calls to the allocator, each reserving two words of space. It is easy to see that the second reserve operation can be coalesced with the first, reducing the total number of calls to the allocator. opt reserve 4 as[a 1 , a 2 , a 3 , a 4 in a 1 := 4as a # 1 in a 2 := 5as a # 2 in alloc(a # 1 in a 3 := 3as a # 3 in a 4 := x t as a # 4 in alloc(a # 3 .a # 4 ) as x in ret x This kind of optimization is commonly done in untyped compilers, but here we can easily express it in a typed setting. A further step to consider is to try to coalesce the two allocation op- erations, in addition to coalescing the reservations. Unfortunately, this is not in general possible in our setting. The problem is that we currently cannot express pointers into the frontier-such pointers would be difficult to typecheck since the types of locations in the frontier can change. Therefore we are unable to initialize the second field of the top level pair until we have moved the other pair into the heap. 6 Extensions and future work This paper has given a detailed presentation of the core of the orderly lambda calculus, developing a high-level framework for discussing issues of allocation and data-layout. The full language includes an account of sums and recursive types that permits sum allocation and tagging to be done using only the memory mechanisms already described. In addition, we have extended the coercion level to include ordered functions and application forms and shown that a rich language of coercions is definable in this setting. Finally, we have shown how the reserve, alloc, and write primitives can be replaced by typed constants, eliminating the need to incorporate special memory-management primitives into the language. The full language is described in a separate technical report [13]. The most important question that we have not yet addressed is how to give an account of the allocation of objects with dynamic extent. The system we have developed so far is predicated on the ability to statically predict the size of an object based on its type. For objects such as arrays however, this is clearly not true. While an ad-hoc treatment of arrays can be fairly easily integrated into the language, this is unsatisfactory since the intention is to make all allocation explicit through the same mechanism. A more interesting possibility is to use a dependent type formalism [23] or a type analysis formalism [4] to introduce a notion of dynamic extent into the type system. We intend to explore this avenue further in the future. Another important area for future research is to attempt to account for pointers into the frontier itself. As we saw in Section 5 we are forced to allocate an object into the heap before we can initialize other objects with a pointer to it, which prevents some useful optimizations such as the destination passing style optimization [8]. 7 Related work Ordered logic and ordered type theory have been explored extensively by Pfenning and Polakow [16, 15]. There is a significant amount of previous work applying ordinary linear type theory to memory management [1, 22, 5, 7], but none of it addresses (nor is intended to address) the question of separating out allocation and initialization, and of giving a foundational account of data layout. The work that most closely addresses the issues that we discuss here is the alias type formalism of Smith, Walker, and Morrisett [20]). Alias types allow aliasing information to be tracked exactly in the type system. A quasi-linear type system allows memory locations to be destructively updated. Since aliasing is tracked exactly, an explicit "free" operation is provided which de-allocates space. Some very useful optimizations such as the destination passing style optimization can be encoded fairly easily in this language. The alias type formalism does not seem to provide for the explicit coalescing of allocator calls, nor does it provide an explicit type theory for describing data layout in the manner that we have attempted to do. --R Reference counting as a computational interpretation of linear logic. A certifying compiler for Java. Type structure for low-level programming langauges Flexible type analysis. Garbage collection based on a linear type system A safe dialect of c A functional represention of data structures with a hole. A realistic typed assembly language. Semantics of memory management for polymorphic languages. From System F to typed assembly language. The design and implementation of a certifying compiler. Frank Pfen- ning A judgmental reconstruction of modal logic. Ordered linear logic and applications. Natural deduction for intuitionistic non-commutative linear logic Relating natural deduction and sequent calculus for intuitionistic non-commutative linear logic Properties of terms in continuation-passing style in an ordered logical framework An overview of the FLINT/ML compiler. Alias types. Operational interpretations of linear logic. Eliminating array bound checking through dependent types. --TR A functional representation of data structures with a hole Eliminating array bound checking through dependent types The design and implementation of a certifying compiler Quasi-linear types Semantics of memory management for polymorphic languages Flexible type analysis Operational interpretations of linear logic From system F to typed assembly language A certifying compiler for Java Type Structure for Low-Level Programming Languages Natural Deduction for Intuitionistic Non-communicative Linear Logic Ordered linear logic and applications --CTR Byoungro So , Mary W. Hall , Heidi E. Ziegler, Custom Data Layout for Memory Parallelism, Proceedings of the international symposium on Code generation and optimization: feedback-directed and runtime optimization, p.291, March 20-24, 2004, Palo Alto, California Lars Birkedal , Noah Torp-Smith , John C. Reynolds, Local reasoning about a copying garbage collector, ACM SIGPLAN Notices, v.39 n.1, p.220-231, January 2004 Amal Ahmed , David Walker, The logical approach to stack typing, ACM SIGPLAN Notices, v.38 n.3, March
memory management;type theory;data representation;ordered logic
604149
Toward a foundational typed assembly language.
We present the design of a typed assembly language called TALT that supports heterogeneous tuples, disjoint sums, and a general account of addressing modes. TALT also implements the von Neumann model in which programs are stored in memory, and supports relative addressing. Type safety for execution and for garbage collection are shown by machine-checkable proofs. TALT is the first formalized typed assembly language to provide any of these features.
Introduction The proliferation of low-cost computing hardware and the ubiquity of the Internet has created a situation where a huge amount of computing power is both idle and-in principle-accessible to developers. The goal of exploiting these idle computational resources has existed for years, and, beginning with SETI@Home [27] in 1997, a handful of projects have successfully made profitable use of idle computational resources on the Internet. More recently, this paradigm, now called grid computing, has elicited serious interest among academics [5, 15] and in industry as a general means of conducting low-cost supercomputing. Despite the increasing interest in grid computing, a remaining obstacle to its growth is the (understandable) reluctance of computer owners to download and execute software from developers they do not know or trust, and may not have even heard of. This has limited the practical use of grid computing to the small number of potential users that have been able to obtain the trust of thousands of computer owners they do not know. The ConCert project at CMU [9] is seeking to overcome this obstacle by developing a system for trustless dissemination of software. In the ConCert framework, a machine owner installs a "steward" program that ensures the safety of any downloaded software. When a new grid application is obtained for execution (other parts of the ConCert framework determine when and how this takes place), that application is expressed in the form of certified code, in which the executable code is accompanied by a certificate proving that the code is safe. The steward then verifies that the certificate is valid before permitting the code to be executed. The form of certified code used in the prototype ConCert system [7] is Typed Assembly Language (TAL) [19, 18], as implemented in the TALx86 system [17], which was developed primarily at Cornell. TALx86 specializes TAL to the Intel IA-32 architecture 1 [14], and enhances it with a number of constructs not supported in the theoretical system. Although certified code eliminates the need to trust the developers of grid applications, there remains the need to trust the soundness of the steward. For TALx86 (other production-quality certified code systems such as the Java VM [16] or Proof-Carrying Code (PCC) [8] are similar), the need for trust stems from four issues: 1. TALx86's safety is justified informally (by analogy to TAL and other work), not by any rigorous proof. 2. The safety of TAL (and TALx86 by analogy) is given in terms of an abstract machine. Although this abstract machine is very low-level for a type system, in a few ways it is still somewhat high-level compared to the concrete architecture, and obscures some important issues thereof. 3. The safety proofs that exist are given in written form, and consequently checking their veracity is error-prone and can be done only by experts. 4. One must trust that the TALx86 type checking software correctly implements its type system. To a certain extent, the need to trust the steward under these conditions is not a serious obstacle. Machine owners routinely trust the safety of a great variety of applications and have far less formal basis for doing so. Moreover, a certain amount of trust is required in any case, since very few participants will personally inspect any of the components of the system before using it. Nevertheless, minimizing the system's trusted computing base is always a laudable goal. known as the "x86" architecture. For grid computing, however, the desire to minimize trust in the steward goes beyond such general considerations. The key issue is extensibility. Our aim is to enable the establishment of a decentralized grid computing fabric available for a wide array of participants. For this purpose, it is implausible to imagine that a single type system will su#ce for all potential grid applications. Furthermore, it is also implausible (and indeed undesirable) that a single trusted agent would check the soundness of all proposed new type systems. Thus, it is necessary that the basic steward can be safely extended with new type systems from untrusted sources. The natural way to achieve this is using foundational certified code, in which the entire safety argument, down to a safety policy expressed in terms of the concrete architecture, is given in machine-checkable form. In its incarnation as foundational PCC [1], a binary is accompanied by an complete proof of its safety. In our proposed foundational TAL, a program's safety argument is broken into two parts: The first portion, a self-certified type system, is the specification of a type system and a machine-checkable proof that it satisfies an established safety policy. This portion would generally be independent of any particular application. The second portion is the application's typing derivation in a certified type system. In this model, any grid application developer could devise his or her own type system su#cient to certify his or her applications. Whenever a steward encountered a certified application referring to an unknown type system, the steward would automatically download the type system, verify its safety proof, and thereafter accept applications with valid typing derivations in that type system. This model addresses each of the four issues demanding trust of the new type system. The first three issues are clearly dealt with by the use of complete, machine-checkable proofs. By packaging applications with typing derivations, as opposed to type annotations, the fourth issue is also addressed: a single proof checker can check derivations for any type system, and no new checker need ever be employed. The aim of this work is to implement a first example of foundational typed assembly language for the Intel IA-32 architecture, and also to build a flexible foundation on which a variety of other type systems may be built. Accordingly, we have broken the development of our system into two stages (in the model of Hamid, et al.'s development of ``Featherweight TAL'' [12]): . The first stage develops a general typed assembly language that is not (very) specific to any architecture. This general language is given an operational semantics, and its abstract safety is established by machine-checkable proofs of type preservation and progress. The safety of garbage collection is also established at this level (Section 4). . The second stage shows that the abstract operational semantics maps correctly onto the concrete architecture. The general type system is designed to account for all those issues that pertain to the type system (including nearly all central issues), so this second stage is a simulation argument. This topic of this paper is the first stage of this e#ort. The second is currently underway. 1.1 TALT This paper presents a new typed assembly language called TALT ("TAL Two"). The aims of TALT are threefold: First, TALT is intended to provide su#cient expressive power to serve as the target language for certifying compilers for expressive, high-level languages (in particular, Standard ML and Popcorn (a safe dialect of C) [17]). Second, TALT's operational semantics is intended to account, to the greatest extent possible, for the central issues of execution on the actual hardware, so that the second stage of the foundational safety proof discussed above is a simple (albeit lengthy and tedious) simulation argument. Third, TALT is intended to be fully formalized and enjoy a machine-checkable type safety proof. We begin our discussion with an overview of how TALT accomplishes each of these aims: Expressiveness In order to provide the expressive power necessary to compile practical, high-level programming languages, TALT follows TALx86 [17] in adding support for heterogeneous tuples (i.e., tuples in which not all fields have the same size), recursive types, disjoint sums, and arrays. Unlike TALx86, however, TALT supports these constructs using a formalized type theory, rather than using specialized code in the type checker. TALT provides all the expressive power of the original published TALx86, with the exception of TAL's initialization flags, which are replaced by another, slightly less general mechanism (Sec- tion 2.2.2). Most later enhancements of TALx86 are not supported in TALT, although many could be added without di#culty. Completeness The operational semantics of TAL is specified in terms of a low-level abstract machine, including an explicit register file, memory, and (in stack-based TAL [18]) stack. This brings TAL nearly to as low a level as possible without committing to the details of an architecture. However, the TAL machine model did not include a program counter; instead, it included a stream of input instructions that served as a surrogate for the program counter. On any branch instruction, the machine would discard the current stream of instructions and copy in the instructions at the branch address. TALT, on the other hand, includes an explicit program counter. A program counter must be part of the model to address a few important issues: On the concrete architecture, it is possible in principle to write into the code just ahead of the program counter. This is rarely permitted in practice, of course, but even so, since programs are in fact stored in memory, it is an essential part of a foundational safety proof to explicitly address the issue. The requisite argument is not di#cult (TALT follows most standard practice and makes the code read-only), but the machine model must include an explicit program counter to make the argument at all. An explicit program counter is also necessary to account for the notion of relative addressing, which is particularly important on the IA-32 where most control transfers (including all conditional jumps) are relative. Finally, an explicit program counter, or, more precisely, the fact that each instruction is individually addressable, allows for a true call instruction in which the return address is taken from the program counter. Our system includes a conservative garbage collector [4] as part of its trusted computing base. This makes the garbage collector e#ectively a part of the architecture. Accordingly, there is no need to prove that the collector itself is safe, but it is necessary to show that programs adhere to the invariants that the collector requires [3, 2]. The TALT type system accounts for these invariants, and using those invariants we prove that type safety is not disrupted by garbage collection (Section 4). In the interest of simplicity, the version of TALT in this paper provides only a few representative operations (add, subtract, and compare). We also omit any discussion of floating point; this is because the IA-32's implementation of floating point (using register stacks) is very idiosyncratic. We foresee no fundamental di#culties in extending TALT in either direction. TALT also follows stack-based TAL in viewing the stack as a separate unbounded resource, rather than as just a designated area of memory. This dramatically simplifies the type system [18], but requires the second stage of the foundational safety proof to show that the TALT stack can be mapped onto the concrete stack. The principal issue in doing so is stack overflow, which we address in Section 6. Machine-Checkable Proofs TALT is formalized in LF [13] as mechanized in the Twelf system [23, 24]. In accordance with the usual LF methodology, TALT typing judgements correspond to LF types, typing rules correspond to LF constants, and TALT typing derivations correspond to LF terms. The validity of a typing derivation can then be verified by type checking. Of central importance to this e#ort are the type safety meta-theorems (progress, type preserva- tion, and GC safety). These are expressed in Twelf in relational form as logic programs [21, 22]. In support of this, Twelf provides a totality checker [26, 24] that ensures that the relations represent total functions, and are therefore valid meta-proofs. This is discussed in detail in Section 5. It is important to note that decidable checking of typability is not an aim for TALT. Unlike TAL and TALx86, TALT is a type assignment (or Curry-style) system; values contain none of the type annotations they carry in explicitly typed (or Church-style) systems such as TAL. This means that checking the typability of TALT programs requires type inference, and since TALT's type system is polymorphic, this means that typability checking is almost certainly undecidable [30]. Consequently, the safety certificate for a TALT program is an entire typing derivation, rather than-as it is in TALx86-a collection of type annotations from which one can reconstruct a typing derivation. However, this is largely just a matter of presentation; a TALT typing derivation contains little information that would not appear in type annotations, and we conjecture that what overhead remains can be eliminated using Necula and Rahul's technique [20]. This paper is organized as follows: We begin in Section 2 by presenting the basic TALT language, and in Section 3 we present extensions supporting disjoint sums, arrays, and relative addressing. In Section 4 we give our formalization of GC safety. Section 5 discusses the pragmatics of our machine-checked proofs. Concluding remarks follow in Section 6. 2 Basic TALT We begin our presentation of the basic TALT language by presenting its untyped fragment in four parts: First we present the structure of values, second we present the machine model, third we discuss the instruction set, and fourth we give its operational semantics. Following this, we present the type system. Throughout this section we will remark on the di#erences between TALT and TAL for the benefit of those readers familiar with the latter; readers unfamiliar with TAL may skip these remarks. We adopt the following notational conventions: W stands for the size of the machine word (measured in bytes, 4 for the IA-32); i, j, k, m and n range over nonnegative integers; bit ranges over {0, 1}; b ranges over bytes (i.e., integers modulo 256); and B ranges over words (i.e., integers As usual, we consider alpha-equivalent expressions to be identical. However, section identifiers (#) and registers (r) will not be considered variables and will not alpha-vary; the only variables appearing in TALT will be type constructor variables (#). unit values u ::= b | junk | a:i | # k :i values v ::= #u 1 , . , addresses a ::= #+n cond. codes cc ::= {cf # bit , zf # bit} memories register files R ::= states M ::= (H, R, a) Figure 1: Untyped TALT Syntax 2.1 Untyped TALT Values TAL separated its collection of values into two syntactic classes, called "heap" and "word" values. 2 This syntactic distinction determined what could fit into a register. In TALT, we combine these into a single syntactic class of values that may vary in size, and use types rather than syntax to determine how they may be used. The syntax of type-free TALT appears in Figure 1. Values are simply sequences of zero or more unit values, each of which is exactly one byte in size. We construct values from unit values to ensure that any byte (including bytes in the middle of an atomic object) may be addressed, and to make it easy to compute the size of any value. Note that it is not merely a cosmetic change to eliminate word values but add unit values; unlike TAL's word values, unit values are never objects of interest by themselves and are used only to construct values. By a convenient abuse of notation, we will also often write values in the form #v 1 , . , v n #, representing the appending of several values. There are four forms of value that we may consider atomic: literal bytes b, junk values, addresses a (which are W bytes in length), and instruction encodings # k . The metavariable # k ranges over all k-byte instruction encodings. At this level of abstraction, it is not appropriate to specify the possible values for # k ; instead, instead we assume the existence of a decoding function [[# k takes instruction encodings to instructions (#), which we discuss a bit later. Note that need not be injective, as a single instruction can have multiple encodings, nor need it be surjective. Literals and junk values are one byte in size, and are represented directly as unit value con- structs. However, addresses and (usually) instruction encodings have size greater than one byte. Thus, the latter two forms of unit value represents bytes taken from larger atomic values: a:i represents the ith byte of the address a, and # k :i represents the ith byte of the instruction encoding # k . When i is out of the appropriate range, these constructs are considered junk values. We will rarely need to deal with subcomponents of addresses and instructions, so for most purposes a and # k can be viewed as value forms, using the abbreviations: a included a third class called "small" values. These were not truly values at all, and were renamed "operands" in later work [18], as they are called here. registers r ::= r1 | - | rN operands destinations d ::= rdest(r) | mdest(m, o, n) conditions # ::= eq | neq | lt | lte | gt | gte instructions # ::= add d, | cmp | jcc #, | jmp | malloc n, d | mov d, | sub d, code I ::= #; I Figure 2: Instructions We also write B for the encoding of B in bytes; on a little-endian architecture such as the IA-32, Machine Model Like TAL, the TALT machine model contains a memory and register file, but it replaces TAL's stream of input instructions with an explicit program counter. We also augment the state with a collection of condition codes (indicating the carry and zero flags here, but it would not be di#cult to add more), which it is convenient to consider as part of the register file, contained in a flag (fl) register. The TALT register file has a fixed collection of N general-purpose registers, r1 through rN. 3 (TAL, on the other hand, assumed an infinite supply of registers.) The TALT memory is broken into sections, identified by section identifiers #. A section represents an area of memory that is known to be contiguous. Distinct sections, however, appear in an unknown order in memory, possibly with intervening gaps. Thus, we view the TALT memory as a mapping of section identifiers to values (since values are simply sequences of bytes). Any byte in memory can be addressed (subject to the limitations of the garbage collector) by combining a section identifier # with a numeric o#set n into the section to produce an address #+n. When we consider garbage collection in Section 4, it will be necessary for us to distinguish between the heap (which the collector manages) and the remainder of memory. We refer to these portions as the heap and code segments. In anticipation of this development, we make a few remarks now. We view the segment that a section resides in to be an intrinsic property of the section that may be determined from its identifier. This is formalized using two predicates; hseg(#) holds if # resides in the heap segment and conversely for cseg. The heap segment is traced by the collector and is read/write; the code segment is not traced and is read-only. Newly allocated sections always appear in the heap segment. The Instruction Set The basic TALT instruction set is given in Figure 2. With the exception of malloc (which is implemented by the run-time system, rather than the architecture), the in- 3 On the IA-32, N is 7, since the stack pointer is treated specially (Section 2.3). structions should be familiar to any programmer of the IA-32. Note that instructions are given in Intel-style (destination first) notation. Note also that the load and store instructions of TAL are omitted; they are replaced by the mov instruction used with appropriate addressing modes. Code sequences (I) are not used in the TALT operational semantics, but will arise in the type checking rules. Our notation for operands and destinations is more novel. The operand im(v) indicates an immediate operand, and the operand rco(r) indicates that the operand is the contents of the register r. The contents of memory are obtained using the operand mco(m, o, n), where o is a sub- operand providing an address; n indicates a fixed o#set from that address at which to read, and m indicates the size of the operand to be read (typically W ). Similarly, rdest(r) indicates that the destination for the instruction is the register r, and mdest(m, o, n) indicates that the destination (of size m) is in memory, with the address indicated by the operand In order to make TALT as elegant and as general as possible, no e#ort has been made to limit the available operands or operand/instruction combinations to those actually supported on the IA-32 (or any other) architecture. (For example, no real architecture permits arbitrary chaining of indirection through nesting of memory operands as TALT does; and few sizes of memory reads are permitted.) It is more elegant to include a variety of unsupported possibilities, and to note that these unsupported instructions are simply not in the range of the decoding function. Operational Semantics The operational semantics are given in Figure 3. The main judgement is indicating that the machine state M steps to the machine state M # . There are three main auxiliary judgements to discuss; with them established, and using some auxiliary definition given in the figure, the operational semantics should be entirely unsurprising. The resolution of operands is formalized by the judgement M # which indicates that in machine state M , the operand o resolves to value v. Propagation of computed results to their destinations is formalized by the judgement M # d := v # (H, R), which indicates that in machine state M , when a destination d is assigned the value v, the resulting memory and register file are H and R. Finally, conditions (for the conditional jump jcc) are handled by the proposition cc #, which is true if and only if the condition codes cc satisfy the condition #. A few other points of notation merit comment. Note that the arithmetic equations in the semantics specify a condition code result as well as the numeric result. The condition code results are determined in the usual manner: the carry flag (cf) is set when the operation generates a carry or borrow (formally, when the denormalized result lies outside the allowable range), and the zero flag (zf) is set when the result is zero. Map update is written H{# v} for memories and similarly for register files. Map extension (for memories only) is written H{{# v}}, when # is fresh. 2.2 The Type System The types of TALT appear in Figure 4. The base types are B0 which is the type of the zero-length value (#), and B1 which is the type of byte literals. The most important type constructor is the product space, # 1 - # 2 , which contains values consisting of two adjacent values, having types # 1 and # 2 . Since appending of values is associative and has a unit (namely #), products are also associative and have a (left and right) unit (namely B0); these equivalences are realized by a collection of subtyping rules. Note that unlike in TAL, a product space does not contain pointers to tuples; in TALT the pointer is made explicit with its own type constructor (box, below). This is one factor necessary to combine TAL's heap and word values; since tuples and pointers to tuples have di#erent types, they need not be distinguished by syntactic class, as in TAL. if add d, o1 , o2 (H # , R # {fl # cc}, a jcc #, jcc #, (H{{# junk n mov d, sub d, o1 , o2 Operand Resolution Destination Propagation Condition Satisfaction Definitions |#u1 , . , un #| def | {z } times Figure 3: Operational Semantics kinds K ::= T types | types of size i | B0 null value | B1 bytes | box(#) pointers | mbox(#) mutable pointers | code(#) code values | #:K.# universal quant. | #:K.# existential quant. | ns top (nonsense) type | void bottom (empty) type | -# recursive type r. f. types # ::= mem. types contexts Figure 4: Type Syntax Three di#erent types are provided for pointers: box(#) is the type of ordinary pointers to # , mbox(#) is the type of mutable pointers, and # 0 is the type of code pointers. Each pointer type provides di#erent privileges: box is covariant but immutable, mbox is mutable but invariant, and only code pointers may be jumped to. A subtyping rule is provided for promoting mutable pointers to covariant ones. A series of instructions can be given the type code(#) when it is executable provided the register file has type #. The function space # 0 contains executable code pointers; # 0 is like box(code(#)), except that the pointer must point into the code segment. Universal and existential quantifiers, intersection types, union types, and recursive types are standard (for a Curry-style system). The top type (ns) contains any value of size 1. (Wider top types may be defined by exponents of ns.) The bottom type (void) is empty. Several useful abbreviations (including a word-sized top nsw) are defined in Figure 5. There are two kinds for TALT types: the kind T contains all types, and the sized kind contains those types whose elements all have size i. For example, B0 belongs to T0 , B1 belongs to belongs to T (i . The various pointer types all belong to TW . Uninhabited types may vacuously belong to more than one sized kind (e.g., B0 # B1 belongs to T0 and T1 , and void vacuously belongs to any Ti ), but any inhabited type has at most one sized kind. Register file types give the type for each register (other than fl). In a well-formed register file type, each register's type must have kind TW . Every register must be included, so no width int ns W Figure 5: Type Abbreviations Judgement Interpretation well-formed with kind K # is well-formed # is well-formed a subtype of # 2 a subtype of # 2 propagation of a value having type # to destination d results in a register file with type # I code I is executable when the register file has type # I inits r:mbox(#) discussed in Section 2.2.2 well-formed with type # is well-formed with type # is well-formed Figure subtyping rules need be included. Instead, when a register's value is irrelevant it may be given the type nsw, and promotion to nsw can be done using depth subtyping. Heap types give a type for each section. 2.2.1 Static Semantics The collection of judgements in the TALT static semantics is given in Figure 6. There are thirteen total judgements. The complete set of rules appears in Appendix A.1. Three judgements are for type formation; these rules are unsurprising and are given only in the Appendix. Two judgements are for subtyping, one for ordinary types and one for register file types; the latter simply applies the former pointwise to each register's type. The remaining judgements are for typing. Three are for typing values, operands, and destina- tions; two are for typing code (the second is an auxiliary judgement for typing tuple initialization code); and the final three judgements are for typing machine states and their top-level components. Since pointers may appear anywhere and the type of a pointer depends on the type of the value where: ns Figure 7: Typing Rules (except instructions) it points to, each typing judgement (except state typing 4 ) includes a memory type as part of the context. Operands, destinations, and code can also refer to registers, so their typing judgements also include a register file type in the context. The TALT typing rules appear in Figures 7 and 8 and are discussed below. Machine States The typing rules for machine states are essentially the same as those of TAL. A state is well-formed if there exists a memory type # and register file type # with respect to which the memory, register file, and program counter may be consistently typed. To type check the program counter, the current code I is looked up in memory at the program counter's address and type checked. The memory's series of bytes is converted to a code sequence by the function which lifts the instruction decode function from single instructions to series of instructions. Two aspects of this will change in future developments. First, we will add a second state typing 4 The state typing judgement omits a memory type because the full machine state is closed. Although the full memory is also closed, the memory typing judgement still includes a memory type as part of the context because it is occasionally necessary to type check a memory under weakened assumptions. rule for typing the intermediate states of tuple initialization (Section 2.2.2). Second, the decode function will be generalized to account for relative addressing (Section 3.3). Values Most of the value typing rules are self-explanatory, but the rules for pointers merit dis- cussion. A pointer with o#set n may be given the type when the section it points to can be all elements of # 1 have size n (i.e., they are skipped by the o#set). Pointers # into the heap segment may be given the stronger type mbox(# 2 ), provided that #) is a subtype and a supertype of # 1 - # 2 . This ensures that when a # 2 is written back into the heap object, the object still has type #), so the heap's type is unchanged. The value typing rules tell far from the entire story. Most of the flexibility of the TALT type system is provided by its subtyping rules. Subtyping provides the introduction facility for existen- tial, union, and recursive types; the elimination facility for universal, intersection, and recursive types; associativity and identity rules for products; and distributivity rules for intersection and union types and void. There are about fifty subtyping rules in all, listed in Appendix A.1; in the interest of brevity, we will discuss individual rules only as they arise. Operands and Destinations Since an operand may be drawn from a register, the operand typing judgement includes the register file's type in its context. Similarly, since a destination may be a register, propagation of a value to a destination can change the register file type, and hence the destination typing judgement includes register file types for before and after. The typing rules for memory operands and destinations are novel. Using the associativity and identity subtyping rules for products, 5 one casts the pointer's type in the form (m)box(# is the operand's type, and # 1 and # 3 are the types of the left and right residual values. The sizes are checked using kinds: # 1 must have kind Tn to match the o#set, and # 2 must have kind Tm to match the operand size. Note that unlike register destinations, memory destinations are forbidden to change the data's type; allowing changes would be unsound due to the possibility of aliasing. Instructions With much of the type system moved into the rules for operands and destinations, the typing rules for instructions given in Figure 8 should be largely as expected. The final two rules merit comment. The first is a subtyping rule for code; it states that if I type checks under assumptions # then it also type checks under the stronger assumptions #. The second rule is the elimination rule for existential types. When a register contains a value of existential type, it allows that value to be unpacked in place. (The TAL instruction unpack is obtained by combining a mov instruction with this rule.) 2.2.2 Allocation and Initialization The most complicated TALT typing rule is for malloc. A newly allocated tuple begins filled with junk and is then initialized field-by-field. As a tuple is initialized, its type must change to reflect its new components. This means that initialization is incompatible with our usual rule for memory writes. TAL provided an elegant way to handle this using "initialization flags," in which the a newly allocated tuple is essentially stamped with its ultimate type and any initialization must move toward that ultimate type [10]. This addressed the aliasing problem because any aliases could have 5 Although mbox is invariant, it does respect symmetric subtyping (that is, # ), so associativity and identity for products can be applied beneath an mbox. # add d, # jcc #, o; I # jmp o; I # mov d, o; I I I Figure 8: Instruction Typing Rules (except allocation) weaker views of a tuple, but not incompatible ones. Moreover, since TAL conflates the mechanisms of pointers and tuples, TAL can track the initialization of a tuple on a field-by-field basis. Thus, TAL permits the interleaving of initialization with other computation. Unfortunately, (field-by-field) initialization flags are incompatible with TALT because of TALT's decoupling of pointers and tuples. Moreover, the flexibility a#orded by initialization flags appears rarely to be used in practice. Therefore, as an expedient alternative, TALT requires that a newly allocated object be fully initialized before any other computation takes place. During this uninterrupted initialization, it is easy to maintain the invariant that no aliases to the new object exist. A more powerful account of initialization could likely be given using alias types [28], but we have not explored such an extension. The rules implementing this mechanism appear in Figure 9. The first rule provides that when an object is allocated and its pointer is placed in register r, type checking moves into a special mode in which r's type can be updated, but r cannot be used for any other purpose (the latter is enforced by giving it type nsw). After a series of initializing moves, the final rule is used to make r an ordinary pointer and shift back into the ordinary type checking mode. An additional (ugly) rule for type checking machine states in the midst of initialization appears in Appendix A.1; it expresses the invariants of initialization so that the Type Preservation property can be established. # mov mdest(m, rco(r), n), o; I inits r:mbox(#) I I inits r:mbox(#) Figure 9: Allocation/Initialization Typing Rules 2.3 Stacks TALT supports stacks using type mechanism essentially identical to those of stack-based TAL [18], although a variety of its special instructions have been folded into TALT's operand/destination mechanism. The full details appear in Appendix A. For reasons of brevity, we omit any discussion of stacks in the body of this paper beyond a few remarks here. Since TALT already has the notions of a null object (#) and of concatenation of objects in memory (-), there is no need to introduce special types (nil and ::) as in stack-based TAL. There is, however, a need for a special kind: since the stack's type must determine its size, and TALT types do not always do so (e.g., B0#B1), we require a kind of types whose size are determined (though possibly unknown, as for variables of kind TD). This kind, called TD , is rarely useful aside from stacks, so for practical purposes it serves as the kind of stack types. 2.4 Multiple Entry Points One facility provided by TALT that may not immediately be obvious is the ability to jump into the middle of a block of code, which is impossible in TAL. Operationally it is clear that one can jump to any valid address. What is less obvious is that such jumps can be well-typed. Suppose where, for simplicity, #v code , v morecode # and v morecode are each executable with register file type #, and suppose |v code We wish to assign # a type so that both #+0 and #+n have type # 0. This is possible by giving # the type: (ns n This makes it possible to structure TALT code with any desired forward and backward jumps, without needing to insert arbitrary breaks for typing purposes. More importantly, since any executable address can be given a type in this manner, TALT can support a true call instruction in which the return address is obtained from the program counter. Details of the call instruction appear in Appendix A. Figure 10: Integer Ranges Extensions 3.1 Disjoint Sums The standard implementation of a disjoint sum type, say int is as a pointer to a tuple whose leading field is a tag identifying the arm of the sum. In TALx86, this idiom is supported directly by a special type for disjoint sums. In TALT, we decompose it into its primitive components: First we add the notion of a singleton type, written set= (B), containing only the integer B. With it, we can easily construct a type that faithfully characterizes this encoding: An element of this type is either a pointer to an int following a zero tag, or a pointer to an int-int following a one tag. Figure gives the typing rules and some pertinent subtyping rules for set= , and also for the upper and lower subrange types set< and set> , which will be useful shortly. By themselves, these rules are not su#cient, however, because although the type above accurately expressed the members of a disjoint sum, it is not immediately useful. The problem is the absence of an elimination rule for union types. We may load the tag word instructions # ::= - | cmpjcc # neq,B unsat unsat # void (7) Figure 11: Union Elimination from o#set 0 into the disjoint union, since: (distributing # over box) (distributing # over -) # (promotion of set= to int) box(int - (int # (int - int))) Then, by comparing the tag to zero, we may determine (dynamically) which arm of the disjoint union the object belongs to. However, with the rules discussed so far, there is no way to take advantage of that information in the static typing, so there is no way to access the variant constituents of the disjoint union. To make it possible to eliminate union types, we add a new instruction cmpjcc. Operationally, is identical to the two-instruction sequence cmp evaluation rule is formalized in Appendix A.2) . What is special about this (pseudo-)instruction is its typing rule. and r is used in the comparison of . (In the example above, r has type (#), and the comparison is of mco(W, rco(r), 0) to im(0) using condition eq.) The idea of the rule is to eliminate r's union type by providing a static proof that r cannot have type # 2 when the branch is taken, and that r cannot have type # 1 when the branch is skipped. It follows that r can be given type # 1 for the branch, and # 2 for the non-branch. Consider the cmpjcc typing rule, given in Figure 11. Clauses 1 and 2 ensure that the comparison itself is permissible, and indicate that the value being compared against is the number B. In the event the branch is taken, must have the type #,B sat , and #,B unsat if it is not. Clause 3 identifies the union type of interest, # 1 # 2 . It follows that r has either type # 1 or type re-types the first operand in the first hypothetical circumstance. Thus, if r has 1 . However, if the branch is skipped, must also have the type #,B unsat , and clause 7 proves that both cannot simultaneously be true. Therefore, if the branch is skipped we may conclude that r has type # 2 (clause 10). A similar argument shows that if the branch is taken, we may conclude that r has type # 1 (clause 9). For example, suppose r has type (#) and we wish to jump if the tag is zero using cmpjcc mco(W, rco(r), 0), im(0), eq, The first six clauses are easily established (using the argument above for clause 1); # out to be set= (0) and set= (1). It remains to show that and It is easy to obtain the first using distributivity and the contradiction subtyping rules set= (B) # void. For the second, observe that set= (1) # set> (0) and then the result follows by the latter contradiction subtyping rule. Thus, we may continue type checking with a refined type for r in each branch. In the more general case of n-ary sums, we may wish to case-analyze a sum using binary search to execute log 2 n comparisons rather than n - 1. This can be done using the same rule by choosing an inequality comparison rather than equality. To set up the rule, it is necessary to use the associativity of union types to cast an n-ary sum in the form of a single union type in which one arm is incompatible with branching and the other with not branching. 3.2 Arrays In the developments so far, TALT already supports an array-like type in the form # n , for an n-element #-array. However, this type has the shortcoming that the array's length must be known statically. What we want is something like #n.# n . First we add the facility to quantify over array length by adding a new form of type constructor representing numbers. Thus far, we have not referred to type constructors because all of TALT's type constructors have been actual types; now we must rename the syntactic class of types to type constructors (or "tycons" for short). We will use the metavariable c for type constructors in general, but will continue to use the metavariable # for tycons of kind T and will use the metavariable x for tycons of kind Num. With this terminology established, we add a new kind Num and a new tycon B : Num. We will occasionally find it convenient to allow the word B (an integer modulo 2 8W ) to be used in place of an ordinary nonnegative integer, in which case B should be interpreted as its canonical representative. We also generalize each of the integer subrange types to be defined over tycons of kind Num including variables, and generalize the various rules dealing with subranges accordingly. Finally, we add the type of x-element arrays of # as # x. These developments are summarized in Figure 12. We can now give the type of an array of unknown length as #:Num. set= (#) - mbox(#). kinds K ::= - | Num tycons c, #, x ::= - | set= (x) | set< (x) | set> (x) operands destinations d ::= - | imdest(m, Figure 12: Arrays Since the addressing modes we have provided so far provide only for fixed o#sets into tuples, we must also provide an operand and destination construct for reads from and writes to dynamically specified o#sets into arrays. For this purpose we provide an "indexed memory" operand form imco(m, and a similar destination form imdest(m, The o#set calculation for these constructs is n+ k - the base address and size remain m. Thus, when points to an array in which each element has size k, imco extracts o#set n from the element of the array. The typing rules for imco and imdest are given in Figure 12; the operational rules are given in Appendix A.2. A pseudo-instruction mallocarr is provided to allocate and initialize arrays. Due to space considerations we do not discuss it here; full details appear in Appendix A. Note that imco and imdest include no array-bounds checks; the typing derivation is responsible for showing that the index is within the allowable range. For the (typical) case where an array- bound check is necessary, one could add another cmpjcc rule to refine a integers to subranges, but it turns out that the existing cmpjcc su#ces with the addition of a trichotomy rule: 6 On the IA-32, these addressing modes are provided as primitives for and 8; on some other architectures or for other values of k they would need to be synthesized. (and some rearranging) we may obtain It seems likely that a more sophisticated treatment of array bounds checks is possible using something like Xi and Harper's DTAL [31] to track dependencies between various integer values, but we have not explored such an extension at this time, as mechanizing their proofs seems likely to be burdensome. 3.3 Relative Addressing Given the TALT machine model, PC-relative addressing is not di#cult to add operationally. We simply add a new operand form pcrel(-n) and the operand resolution rules: and For the type system, however, matters are trickier. Relative addressing creates a situation in which code (and therefore values in general) may have a certain type only when it resides in a particular location, at least when viewed naively. This situation is undesirable for two reasons: First, making the typing rules aware of the locations in which values reside would require wide-scale changes to the type system that would lessen its elegance. Second, the resulting type system would be very unlike conventional type systems in which a value's type does not depend on where it is written. To preserve the type system in its current form, we introduce a technical device we call delocal- ization. We employ a function deloc to convert relative addresses to absolute ones. For example: deloc(a, mco(m, o, Code is always type checked in delocalized form, so no typing rule need be provided for relative operands. Consequently, the typing rules for instruction can be preserved without change. The burden of delocalization is assumed in the code typing rule, where values are converted to code sequences for type checking. Recall the rule from Figure 8: (old) First, we modify the decode function (now [[[v]]]a) to account for delocalization: Second, since the typing rule does not know where in memory v lies, it is permitted to assume any address (just as it may assume any register file type) and it records the assumption in the type: (new) The type code(a, #) should be read as "code that may be executed when the register file has type #, provided it resides at address a." The obligation is discharged in the typing rule for code pointers, which admits only properly delocalized pointers as code pointers: (new) Note that if a code block is delocalized at an address other than where it resides, that address cannot be given a code pointer type. The only other change that must be made to the type system is that the top-level state typing rule must be modified in the obvious manner to account for delocalization: The principal safety results for TALT, as usual, are Progress and Type Preservation: Theorem 4.1 (Progress) If # M then M # M # , for some M # . Theorem 4.2 (Type Preservation) If # M and M # M # then # M # . The Progress proof is by induction on the typing derivation. The Type Preservation proof is by case analysis on the evaluation derivation, with an outer induction on the typing derivation (to handle the register file subsumption and existential unpacking rules). Additionally, since the TALT operational semantics does not account for garbage collection, we must prove an additional result showing that garbage collection does not disrupt typability. Like TALx86, TALT is designed for use with the Boehm-Demers-Weiser conservative garbage collector [4]. Therefore there is no need to maintain any tagging invariants in order to assist the collector in distinguishing pointers from integers. However, one GC safety condition must be maintained for the collector to function properly [3]: Every live heap object must be reachable by a chain of pointers from the root set. A pointer is permitted to reach an object by pointing anywhere from the object's beginning to its end. 7 Our root set is the collection of values in the register file and stack. If this condition is not maintained, the only consequence is that live objects may be garbage collected. Therefore, for our purposes we define a live object to be one whose presence is required for the state to be well-typed. Our main GC result then will be a proof that garbage collecting unreachable objects cannot break typability of the state. In order to satisfy the GC safety condition, we impose the following two invariants on well-typed TALT code: 7 Interior pointers are not permitted by Boehm and Chase's specification [3], but are permitted by the collector's implementation. where # dom(#) | cseg(#)} Figure 13: Modified Rules for GC Safety 1. The code segment contains no (non-accidental) pointers into the heap segment. 2. Immediate operands contain no (non-accidental) pointers into the heap segment. Invariant 1 is necessary because the code segment is not part of the collector's root set. Invariant 2 is not stricly speaking necessary but is not burdensome either; if an operand is part of an instruction in the code segment then invariant 2 follows from invariant 1, and if not the instruction is useless anyway. The invariant is imposed because it dramatically simplifies the development to since it means there is no need to formalize how to look for pointers in code values. These invariants are achieved by replacing the typing rules for immediate operands and memories with the rules in Figure 13, which strip all heap sections from the memory type when typing code sections and immediate operands. To formalize the GC safety theorem, we need a definition of unreachability: Definition 4.3 Suppose S is a set of heap section identifiers. Then S is H-reachable from v if v can be written in the form #v 1 , #+n, v 2 # for some # S and n # |H(#)|. A section is unreachable from the memory as a whole if every section that can reach it is either untraced (i.e., in the code segment) or unreachable itself: Definition 4.4 Suppose S is a set of heap section identifiers. Then S is unreachable from H if for every # dom(H), either cseg(#) or # S or S is not H-reachable from H(#). Definition 4.5 Suppose S is a set of heap section identifiers. Then S is unreachable in (H, R, a) . S is unreachable from H, and . for every r, S is not H-reachable from R(r), and . S is not H-reachable from R(sp). Note that the definition of unreachability is not deterministic. When S is unreachable in M , S can be as small as the empty set. The definition is crafted in this manner because we cannot predict what objects will actually be collected by a conservative collector. Instead, we prove our result for all unreachable sets, thereby covering whatever the collector turns out to do. Theorem 4.6 (GC Safety) Suppose S is unreachable in (H, R, a) and suppose that # (H, R, a). The proof is by induction on the typing derivation. 5 Machine-Checked Proofs The results of this paper are formalized as machine-checked proofs in the Twelf system [23, 24]. The first step in this formalization is to encode the TALT syntax, type system, and operational semantics as an LF signature [13] wherein judgements become types and derivations become terms. This process is standard, so we will not belabor it here. Once the language is formalized, we can state and prove the principal meta-theorems: Progress, Type Preservation, and GC Safety. A meta-theorem statement is encoded as a relation between derivations [21, 22]. For example, the principal meta-theorem statements become: progress %mode progress +D1 -D2. preservation -> machineok M' -> type. %mode preservation +D1 +D2 -D3. collect collect M M' -> machineok M' -> type. %mode collect ok +D1 +D2 -D3. For instance, the progress theorem is a relation between machineok M derivations and stepsto M M' derivations, and so forth. The %mode declaration following each statement indicates the input and output arguments of the relation [25]. In each of these cases, the last argument (with the "-" mode) is the sole output argument. A proof of a meta-theorem so encoded is a logic program whose type is the relational encoding of the theorem. The program can then (in principle) be given derivations in the input arguments and unification variables in the output arguments and executed to obtain the resulting derivations. A logic program represents a valid meta-proof if the execution always runs to a successful conclusion. The Twelf totality checker verifies that the logic program is in fact total, with assistance from the programmer in identifying the induction variable(s). This consists of checking three facts: 1. Mode checking: output arguments (and input arguments to subcalls) are fully determined. 2. Termination checking: the induction variable(s) decrease in all recursive calls. 3. Totality checking: in every case analysis, all cases are covered. For details, the reader is referred to Pfenning and Sch-urmann [24] or Sch-urmann [26]. The specification of TALT in LF consists of 2081 lines of Twelf code, and the complete proof of Theorems 4.1, 4.2 and 4.6 consists of 10137 lines of Twelf code (including comments). A breakdown of the proof code for the interested reader is given in Table 1. The full proof takes approximately three minutes to check in Twelf 1.3R3 on a Pentium 3 with 128 megs of RAM. Proof Components lines purpose 210 Properties of canonical forms 252 Properties of conditions Properties of memory lookup/update/extension Instruction decode lemmas 372 Properties of register file lookup/update 399 Properties of values 407 Equality lemmas 429 Properties of natural number arithmetic 515 Validity (well-behavedness of derivations) 537 Canonical Forms lemma 548 Lemmas regarding type formation Progress 713 Weakening and strengthening of memory types Operand/destination lemmas 925 Type Preservation 1245 Properties of binary arithmetic Table 1: Safety Proof Breakdown 6 Conclusion TALT provides an elegant, expressive, and fully formalized type system for assembly language. The machine-checkable safety theorems of Section 5 provide a complete safety argument for TALT programs in terms of a safety policy expressed (by the operational semantics) at the assembly language level. To complete a foundational TAL system, this work must be combined with a proof that the TALT operational semantics maps correctly on the concrete architecture. TALT is designed so that this latter stage of the proof implementation is a type-free simulation argument. TALT is also designed to be easily adaptable to other architectures. The general architectural constants (big-endian vs. little-endian, the number of registers, and the size of the machine word) are parameters to the language and can easily be changed. New instructions can also easily be added; in fact, given the generality of the TALT operand/destination mechanism, many "new" instructions may already be present. This means that the primary burden of specializing TALT to an architecture is accounting for its idiosyncrasies (e.g., the IA-32's treatment of floating point, or the delay slots following jumps on many RISC architectures). One issue not addressed in TALT is the issue of processor exceptions and faults (e.g., division by zero, stack overflow, or various floating-point exceptions). These can be prohibitively expensive to prevent dynamically, and are di#cult to prevent statically. Fortunately, for our purposes they can be safely ignored, assuming that the occurrence of an exception aborts the program, because a program that is no longer running is certainly safe. The issue of stack overflow is a little bit more involved, because we must ensure that any stack that overflows will cause the stack overflow exception. We can do so by following the standard practice of preceding 8 the stack in memory by at least one (typically many) unmapped memory pages. Any push instruction that overflows the stack will therefore hit an unmapped page and cause the exception. The salloc instruction, which increases the stack's size by an arbitrary amount, is a bit trickier because it could skip all the unmapped pages and land in accessible memory. We can prevent this by limiting salloc to one page at a time and forcing it to touch the top of the stack as push does. This ensures that any overflowing salloc will hit the unmapped page. To assist in the development of TALT programs, we have also designed an explicitly typed variant of TALT, called XTALT, that enjoys decidable type checking. XTALT adds type annotations to sections and replaces TALT's subtyping with explicit coercions. We are implementing an assembler that typechecks XTALT programs, generates the corresponding TALT derivations, and compresses them using Necula and Rahul's technique [20]. Also under development is a Popcorn [17] to XTALT compiler. These tools can be combined with Dunfield's Standard ML to Popcorn compiler [11] (based on RML [29] and MLton [6]) to provide a complete certifying compiler from Standard ML to TALT. A direct Standard ML to TALT compiler is also underway. --R A semantic model of types and machine instructions for proof-carrying code Simple garbage-collector safety A proposal for garbage-collector-safe C compilation Garbage collection in an uncooperative environment. First International Workshop on Grid Comput- ing Trustless grid computing in ConCert. A certifying compiler for Java. Type structure for low-level programming langauges Personal communication. A syntactic approach to foundational proof-carrying code A framework for defining logics. Second International Workshop on Grid Computing The Java Virtual Machine Specification. A realistic typed assembly language. From System F to typed assembly language. Logic programming in the LF logical framework. Implementing the meta-theory of deductive sys- tems System description: Twelf - a meta-logic framework for deductive systems Twelf User's Guide Mode and termination checking for higher-order logic programs Automating the Meta Theory of Deductive Systems. Alias types. From ML to Ada: Strongly-typed language interoperability via source translation Typability and type checking in System F are equivalent and undecidable. A dependently typed assembly language. --TR Garbage collection in an uncooperative environment Logic programming in the LF logical framework A framework for defining logics Simple garbage-collector-safety From system F to typed assembly language A semantic model of types and machine instructions for proof-carrying code A certifying compiler for Java Oracle-based checking of untrusted software Java Virtual Machine Specification Grid Computing Mode and Termination Checking for Higher-Order Logic Programs Flow-Directed Closure Conversion for Typed Languages Alias Types A Syntactic Approach to Foundational Proof-Carrying Code Type Structure for Low-Level Programming Languages Stack-Based Typed Assembly Language Implementing the Meta-Theory of Deductive Systems System Description --CTR Joseph C. Vanderwaart , Karl Crary, Automated and certified conformance to responsiveness policies, Proceedings of the 2005 ACM SIGPLAN international workshop on Types in languages design and implementation, p.79-90, January 10-10, 2005, Long Beach, California, USA Michael F. Ringenburg , Dan Grossman, Types for describing coordinated data structures, Proceedings of the 2005 ACM SIGPLAN international workshop on Types in languages design and implementation, p.25-36, January 10-10, 2005, Long Beach, California, USA Adam Chlipala, Modular development of certified program verifiers with a proof assistant, ACM SIGPLAN Notices, v.41 n.9, September 2006 Hongxu Cai , Zhong Shao , Alexander Vaynberg, Certified self-modifying code, ACM SIGPLAN Notices, v.42 n.6, June 2007 Brigitte Pientka, Verifying Termination and Reduction Properties about Higher-Order Logic Programs, Journal of Automated Reasoning, v.34 n.2, p.179-207, December 2005 Feng , Zhaozhong Ni , Zhong Shao , Yu Guo, An open framework for foundational proof-carrying code, Proceedings of the 2007 ACM SIGPLAN international workshop on Types in languages design and implementation, January 16-16, 2007, Nice, Nice, France Bor-Yuh Evan Chang , Adam Chlipala , George C. Necula , Robert R. Schneck, Type-based verification of sssembly language for compiler debugging, Proceedings of the 2005 ACM SIGPLAN international workshop on Types in languages design and implementation, p.91-102, January 10-10, 2005, Long Beach, California, USA Feng , Zhong Shao, Modular verification of concurrent assembly code with dynamic thread creation and termination, ACM SIGPLAN Notices, v.40 n.9, September 2005 Andrew W. Appel , Paul-Andr Mellis , Christopher D. Richards , Jrme Vouillon, A very modal model of a modern, major, general type system, ACM SIGPLAN Notices, v.42 n.1, January 2007 Bor-Yuh Evan Chang , Adam Chlipala , George C. Necula , Robert R. Schneck, The open verifier framework for foundational verifiers, Proceedings of the 2005 ACM SIGPLAN international workshop on Types in languages design and implementation, p.1-12, January 10-10, 2005, Long Beach, California, USA Juan Chen , Dinghao Wu , Andrew W. Appel , Hai Fang, A provably sound TAL for back-end optimization, ACM SIGPLAN Notices, v.38 n.5, May Zhaozhong Ni , Zhong Shao, Certified assembly programming with embedded code pointers, ACM SIGPLAN Notices, v.41 n.1, p.320-333, January 2006 Dan Grossman, Quantified types in an imperative language, ACM Transactions on Programming Languages and Systems (TOPLAS), v.28 n.3, p.429-475, May 2006
typed assembly language;proof-carrying code
604151
A type system for higher-order modules.
We present a type theory for higher-order modules that accounts for many central issues in module system design, including translucency, applicativity, generativity, and modules as first-class values. Our type system harmonizes design elements from previous work, resulting in a simple, economical account of modular programming. The main unifying principle is the treatment of abstraction mechanisms as computational effects. Our language is the first to provide a complete and practical formalization of all of these critical issues in module system design.
Introduction The design of languages for modular programming is surprisingly delicate and complex. There is a fundamental tension between # The ConCert Project is supported by the National Science Foundation under grant number 0121633: "ITR/SY+SI: Language Technology for Trustless Software Dissemination". Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. POPL'03, January 15-17, 2003, New Orleans, Louisiana, USA. ACM 1-58113-628-5/03/0001 .$5.00 the desire to separate program components into relatively independent parts and the need to integrate these parts to form a coherent whole. To some extent the design of modularity mechanisms is independent of the underlying language [17], but to a large extent the two are inseparable. For example, languages with poly- morphism, generics, or type abstraction require far more complex module mechanisms than those without them. Much work has been devoted to the design of modular programming languages. Early work on CLU [19] and the Modula family of languages [34, 2] has been particularly influential. Much effort has gone into the design of modular programming mechanisms for the ML family of languages, notably Standard ML [23] and Objective Caml [27]. Numerous extensions and variations of these designs have been considered in the literature [21, 18, 28, 31, 5]. Despite (or perhaps because of) these substantial efforts, the field has remained somewhat fragmented, with no clear unifying theory of modularity having yet emerged. Several competing designs have been proposed, often seemingly at odds with one another. These decisions are as often motivated by pragmatic considerations, such as engineering a useful implementation, as by more fundamental considerations, such as the semantics of type abstraction. The relationship between these design decisions is not completely clear, nor is there a clear account of the trade-offs between them, or whether they can be coherently combined into a single design. The goal of this paper is to provide a simple, unified formalism for modular programming that consolidates and elucidates much of the work mentioned above. Building on a substantial and growing body of work on type-theoretic accounts of language structure, we propose a type theory for higher-order program modules that harmonizes and enriches these designs and that would be suitable as a foundation for the next generation of modular languages. 1.1 Design Issues Before describing the main technical features of our language, it is useful to review some of the central issues in the design of module systems for ML. These issues extend to any language of similar expressive power, though some of the trade-offs may be different for different languages. Controlled Abstraction Modularity is achieved by using signatures (interfaces) to mediate access between program components. The role of a signature is to allow the programmer to "hide" type information selectively. The mechanism for controlling type propagation is translucency [11, 14], with transparency and opacity as limiting cases. Phase Separation ML-like module systems enjoy a phase separation property [12] stating that every module is separable into a static part, consisting of type information, and a dynamic part, consisting of executable code. To obtain fully expressive higher-order modules and to support abstraction, it is essential to build this phase separation principle into the definition of type equivalence. Generativity MacQueen coined the term generativity for the creation of "new" types corresponding to run-time instances of an abstraction. For example, we may wish to define a functor SymbolTable that, given some parameters, creates a new symbol table. It is natural for the symbol table module to export an abstract type of symbols that are dynamically created by insertion and used for subsequent retrieval. To preclude using the symbols from one symbol table to index another, generativity is essential-each instance of the hash table must yield a "new" symbol type, distinct from all others, even when applied twice to the same parameters. Separate Compilation One goal of module system design is to support separate compilation [14]. This is achieved by ensuring that all interactions among modules are mediated by interfaces that capture all of the information known to the clients of separately- compiled modules. Principal Signatures The principal, or most expressive, signature for a module captures all that is known about that module during type checking. It may be used as a proxy for that module for purposes of separate compilation. Many type checking algorithms, including the one given in this paper, compute principal signatures for modules. Modules as First-Class Values Modules in ML are "second- class" in the sense that they cannot be computed as the results of ordinary run-time computation. It can be useful to treat a module as a first-class value that can be stored into a data structure, or passed as an ordinary function argument or result [11, 24]. Hidden Types Introducing a local, or "hidden", abstract type within a scope requires that the types of the externally visible components avoid mention of the abstract type. This avoidance problem is often a stumbling block for module system design, since in most expressive languages there is no "best" way to avoid a type variable 1.2 A Type System for Modules The type system proposed here takes into account all of these design issues. It consolidates and harmonizes design elements that were previously seen as disparate into a single framework. For example, rather than regard generativity of abstract types as an alternative to non-generative types, we make both mechanisms available in the language. We support both generative and applicative functors, admit translucent signatures, support separate compilation, and are able to accommodate modules as first-class values [24, 29]. Generality is achieved not by a simple accumulation of features, but rather by isolating a few key mechanisms that, when com- bined, yield a flexible, expressive, and implementable type system for modules. Specifically, the following mechanisms are crucial. Singletons Propagation of type sharing is handled by singleton signatures, a variant of Aspinall's and Stone and Harper's singleton kinds [33, 32, 1]. Singletons provide a simple, orthogonal treatment of sharing that captures the full equational theory of types in a higher-order module system with subtyping. No previous module system has provided both abstraction and the full equational theory supported by singletons, 1 and consequently none has provided optimal propagation of type information. Static Module Equivalence The semantics of singleton signatures is dependent on a (compile-time) notion of equivalence of modules. To ensure that the phase distinction is respected, we define module equivalence to mean "equivalence of static compo- nents," ignoring all run-time aspects. Subtyping Signature subtyping is used to model "forgetting" type sharing, an essential part of signature matching. The coercive aspects of signature matching (dropping of fields and specialization of polymorphic values) are omitted here, since the required coercions are definable in the language. Purity and Impurity Our type system classifies module expressions into pure (effect-free) and impure (effectful) forms. To ensure proper enforcement of abstraction, impure modules are incomparable (may not be compared for equality with any other module) and non-projectible (may not have type components projected from them). It follows that impure modules are also non-substitutable (may not be substituted for a module variable in a signature). Abstraction and Sealing Modules that are sealed with a signature to impose type abstraction [11] are regarded as impure. In other words, sealing is regarded as a pro forma computational effect. This is consistent with the informal idea that generativity involves the generation of new types at run time. Moreover, this ensures that sealed modules are incomparable and non-projectible, which is sufficient to ensure the proper semantics of type abstraction. Totality and Partiality Functors are l-abstractions at the level of modules. A functor whose body is pure is said to be total; otherwise it is partial. It follows that the application of a pure, total functor to a pure argument is pure, whereas the application of a pure, partial functor to a pure argument is impure. Partial functors are naturally generative, meaning that the abstract types in its result are "new" for each instance; total functors are applicative, meaning that equal arguments yield equal types in the result. Generative functors are obtained without resort to "generative stamps" [23, 21]. Weak and Strong Sealing Since sealing induces a computational effect, only partial functors may contain sealed sub- structures; this significantly weakens the utility of total functors. To overcome this limitation we distinguish two forms of effect, static and dynamic, and two forms of sealing, weak and strong. Weak sealing induces a static effect, which we think of as occurring once during type checking; strong sealing induces a dynamic effect, which we think of as occurring during execution. Dynamic effects induce partiality, static effects preserve totality. Existential Signatures In a manner similar to Shao [31], our type system is carefully crafted to circumvent the avoidance prob- lem, so that every module enjoys a principal signature. However, this requires imposing restrictions on the programmer. To lift these restrictions, we propose the use of existential signatures to provide principal signatures where none would otherwise exist. We show that these existential signatures are type-theoretically ill-behaved in 1 Typically the omitted equations are not missed because restrictions to named form or valuability prevent programmers from writing code whose typeability would depend on those equations in the first place [4]. terms e signatures s modules let s =M 1 in M:>s | M::s contexts G ::= . | G,s:s Figure 1. Syntax general, so, we restrict their use to a well-behaved setting. In the style of Harper and Stone [13], we propose the use of an elaboration algorithm from an external language that may incur the avoidance problem, into our type system, which does not. Packaged Modules Modules in our system are "second-class" in the sense that the language of modules is separate from the language of terms. However, following Mitchell et al. [24] and Russo [29], we provide a way of packaging a module as a first-class value. In prior work, such packaged modules are typically given an existential type, whose closed-scope elimination construct can make for awkward programming. Instead, our account of type generativity allows us to employ a more natural, open-scope elimination con- struct, whereby unpackaging a packaged module engenders a dynamic effect. While these features combine naturally to form a very general language for modular programming, they would be of little use in the absence of a practical implementation strategy. Some previous attempts have encountered difficulties with undecidability [11] or incompleteness of type checking [27]. In contrast, our formalism leads to a practical, implementable programming language. The rest of this paper is structured as follows: In Section 2 we present our core type system for higher-order modules, including the intuition behind its design and a brief description of the decidable typechecking algorithm. In Section 3 we discuss the programming importance of having both weak and strong forms of sealing. In Section 4 we explain the avoidance problem and how it can be circumvented using an elaboration algorithm. In Section 5 we present a very simple, orthogonal extension of our core system to provide support for packaging modules as first-class values. Fi- nally, in Section 6 we compare our system with related work and in Section 7 we conclude. Technical Development We begin our technical development by presenting the syntax of our language in Figure 1. Our language consists of four syntactic classes: terms, types, modules, and signatures (which serve as the types of modules). The language does not explicitly include higher-order type constructors or kinds (which ordinarily serve as constructors' types); in our language the roles of constructors and kinds are subsumed by modules and signatures. Contexts bind module variables (s) to signatures. As usual, we consider alpha-equivalent expressions to be identical. We write the capture-avoiding substitution of M for s in an expression Types There are three basic types in our language. The product standard. The function type, Ps:s.t, is the type of functions that accept a module argument s of signature s and return a value of type t (possibly containing s). As usual, if s does not appear free in t, we write Ps:s.t as s#t. (This convention is used for the dependent products in the signature class as well.) Finally, when M is a module containing exactly one type (which is to say that M has the signature [[T ]]), that type is extracted by Typ M. A full-featured language would support a variety of additional types as well. Terms The term language contains the natural introduction and elimination constructs for recursive functions and products. In ad- dition, when M is a module containing exactly one value (which is to say that M has the signature [[t]], for some type t), that value is extracted by Val M. When f does not appear free in e, we write fix f (s:s):t.e as Ls:s.e. The conventional forms of functions and polymorphic function are built from module functions. Ordinary functions are built using modules containing a single value: and polymorphic functions are built using modules containing a single type: et Signatures There are seven basic signatures in our language. The atomic signature [[T is the type of an atomic module containing a single type, and the atomic signature [[t]] is the type of an atomic module containing a single term. The atomic modules are written [t] and [e : t], respectively. (We omit the type label ": t" from atomic modules when it is clear from context.) The trivial atomic signature 1 is the type of the trivial atomic module #. The functor signatures P tot s:s 1 .s 2 and P par s:s 1 .s 2 express the type of functors that accept an argument of signature s 1 and return a result of signature s 2 (possibly containing s). The reason for two different P signatures is to distinguish between total and partial functors, which we discuss in detail below. For convenience, we will take P (without a superscript) to be synonymous with P tot . When s does not appear free in s 2 , we write Ps:s 1 .s 2 as s 1 #s 2 . The structure signature Ss:s 1 .s 2 is the type of a pair of modules where the left-hand component has signature s 1 and the right-hand component has signature s 2 , in which s refers to the left-hand com- ponent. As usual, when s does not appear free in s 2 , we write The singleton signature s(M) is used to express type sharing infor- mation. It classifies modules that have signature [[T are statically equivalent to M. Two modules are considered statically equivalent if they are equal modulo term components; that is, type fields must agree but term fields may differ. Singletons at signatures other than [[T are not provided primitively because they can be defined using the basic singleton, as described by Stone and Harper [33]. The definition of s s (M) (the signature containing only modules equal to M at signature s) is given in Figure 5. signature sig type s type u val end . is compiled as . Figure 2. ML Signature Example Modules The module syntax contains module variables (s), the atomic modules, and the usual introduction and elimination constructs for P and S signatures, except that S modules are introduced by #, in which s stands for M 1 and may appear free in does not appear free in M 2 , the "s =" is omitted.) No introduction or elimination constructs are provided for singleton signatures. Singletons are introduced and eliminated by rules in the static semantics; if M is judged equivalent to M # in s, then M belongs to s s (M # ), and vice versa. The remaining module constructs are strong sealing, written M:>s, and weak sealing, written M::s. When a module is sealed either strongly or weakly, the result is opaque. By opaque we mean that no client of the module may depend on any details of the implementation of M other than what is exposed by the signature s. The distinction between strong and weak sealing is discussed in detail below. Although higher-order type constructors do not appear explicitly in our language, they are faithfully represented in our language by unsealed modules containing only type components. For example, the kind (T #T )#T is represented by the signature ([[T ]]; and the constructor la:(T #T ).(int -aint) is represented by the module ls:([[T Examples of how ML-style signatures and structures may be expressed in our language appear in Figures 2 and 3. Comparability and Projectibility Two closely related issues are crucial to the design of a module system supporting type abstraction 1. When can a module be compared for equivalence with another module? 2. When can a type component be projected from a module and used as a type? We say that a module is comparable iff it can be compared for equivalence with another module, and that a module is projectible its type components may be projected and used as type expres- sions. (In the literature most presentations emphasize projectibil- ity [11, 14, 15].) structure struct structure struct type string val val end . is compiled as . Figure 3. ML Structure Example A simple analysis of the properties of comparability and projectibil- ity suggests that they are closely related. Suppose that M is a pro- jectible module with signature [[T ]], so that Typ M is a type. Since type equality is an equivalence relation, this type may be compared with any other, in particular, Typ M # for another projectible module M # of the same signature. But since Typ M and Typ M # fully determine M, we are, in effect, comparing M with M # for equiva- lence. This suggests that projectible modules be regarded as comparable for type checking purposes. Conversely, if M is a comparable module, then by extensionality M should be equivalent to [Typ M], which is only sensible if M is also projectible. Purity and Impurity The design of our module system rests on the semantic notions of purity and impurity induced by computational effects. To motivate the design, first recall that in a first-class module system such as Harper and Lillibridge's [11] there can be "impure" module expressions that yield distinct type components each time they are evaluated. For example, a module expression might consult the state of the world, yielding a different module for each outcome of the test. The type components of such a module are not statically well-determined, and hence should not be admitted as type expressions at all, much less compared for equiv- alence. On the other hand, even in such a general framework, pure (effect-free) modules may be safely regarded as both comparable and projectible. In a second-class module system such examples are not, in fact, expressible, but we will nevertheless find it useful to classify modules according to their purity. 2 This classification is semantic, in the sense of being defined by judgments of the calculus, rather than syntactic, in the sense of being determined solely by the form of expression. Such a semantic approach is important for a correct account of type abstraction in a full-featured module language. The axiomatization of purity and impurity in our system is based on a set of rules that takes account of the types of expressions, as well as their syntactic forms. The type system is conservative in that it "assumes the worst" of an impure module expression, ruling it 2 Moreover, in Section 5 we will introduce the means to re-create these examples in our setting, making essential use of the same classification system. incomparable and non-projectible, even when its type components are in fact statically well-determined. As we will see shortly, this is important for enforcing type abstraction, as well as ensuring soundness in the presence of first-class modules. In addition, since it is sound to do so, we deem all pure module expressions to be comparable and projectible. That is, to be as permissive as possible without violating soundness or abstraction, we identify comparability and projectibility with purity. Finally, note that a module is judged pure based on whether its type components are well-determined, which is independent of whether any term components have computational effects. In the literature different accounts of higher-order modules provide different classes of pure modules. For example, in Harper and Lil- libridge's first-class module system [11], only syntactic values are considered pure. In Leroy's second-class module calculi [14, 15], purity is limited to the syntactic category of paths. In Harper et al.'s early "phase-distinction" calculus [12] all modules are deemed to be pure, but no means of abstraction is provided. Abstraction via Sealing The principal means for defining abstract types is sealing, written M:>s. Sealing M with s prevents any client of M from depending on the identities of any type components specified opaquely-with signature [[T From the point of view of module equivalence, this means that a sealed module should be considered incompara- ble. To see this, suppose that regarded as comparable. Presumably, M could not be deemed equivalent to since their underlying type components are different. However, since module equivalence is reflexive, if M is comparable, then M must be deemed equivalent to itself. This would mean that the type system would distinguish two opaque modules based on their underlying implementation, a violation of type abstraction. A significant advantage of our judgmental approach to purity is that it affords a natural means of ensuring that a sealed module is in- comparable, namely to judge it impure. This amounts to regarding sealing as a pro forma run-time effect, even though no actual effect occurs at execution time. Not only does this ensure that abstraction violations such as the one just illustrated are ruled out, but we will also show in Section 3 that doing so allows the type system to track the run-time "generation" of "new" types. Applicative and Generative Functors Functors in Standard ML are generative in the sense that each abstract type in the result of the functor is "generated afresh" for each instance of the functor, regardless of whether or not the arguments in each instance are equivalent. Functors in Objective Caml, however, are applicative in the sense that they preserve equivalence: if applied to equivalent arguments, they yield equivalent results. In particular, the abstract types in the result of a functor are the same for any two applications to the same argument. Continuing the analogy with computational effects, we will deem any functor whose body is pure to be total, otherwise partial. The application of a pure, total functor to a pure argument is pure, and hence comparable. Total functors are applicative in the sense that the application of a pure total functor to two equivalent pure modules yields equivalent pure modules, because the applications are pure, and hence comparable. Partial functors, on the other hand, always yield impure modules when applied. Therefore they do not respect equivalence of arguments (because the results, being im- pure, are not even comparable), ensuring that each instance yields a distinct result. We distinguish the signatures of total (applicative) and partial (gen- erative) functors. Total functors have P signatures, whereas partial functors have P par signatures. The subtyping relation is defined so that every total functor may be regarded (degenerately) as a partial functor. Weak and Strong Sealing In our system we identify applicative functors with total ones, and generative functors with partial ones. To make this work, however, we must refine the notion of effect. For if sealing is regarded as inducing a run-time effect, then it is impossible to employ abstraction within the body of a total func- tor, for to do so renders the body impure. (We may seal the entire functor with a total functor signature to impose abstraction, but this only ensures that the exported types of the functor are held abstract in any clients of that functor. It does not permit a substructure in the body of the functor to be held abstract in both the clients of the functor and in the remainder of the functor body.) The solution is to distinguish two forms of sealing-strong, written M:>s as before, and weak, written M::s. Both impose abstraction in the sense of limiting type propagation to what is explicitly specified in the ascribed signature by regarding both forms of sealing as inducing impurity. However, to support a useful class of applicative functors, we further distinguish between static and dynamic effects. Weak sealing induces a static effect, whereas strong sealing induces dynamic effect. The significance of this distinction lies in the definition of total and partial functors. A functor whose body involves a dynamic effect (i.e., is dynamically impure), is ruled partial, and hence generative. Thus strong sealing within a functor body induces generativity of that functor. A functor whose body is either pure, or involves only a static effect (i.e., is dynamically pure), is ruled total, and hence applicative. This ensures that applicative functors may use abstraction within their bodies without incurring generative behavior. The methodological importance of this distinction is discussed in Section 3. A dynamic effect may be thought of as one that occurs during exe- cution, whereas a static effect is one that occurs during type check- ing. Dynamic effects are suspended inside of a l-abstraction, so functor abstractions are dynamically pure. However, when applied, the dynamic effects inside the functor are released, so that the application is dynamically impure. On the other hand, static effects occur during type checking, and hence are not suspended by l- abstraction, nor released by application. Formalization The typing judgment for our system is written purity. The classifier k is drawn from the following four-point lattice: The point P indicates that M is pure (and hence comparable and pro- jectible), D indicates dynamic purity, S indicates static purity, and W indicates well-formedness only (no purity information). Hence, our purity judgment. It will prove to be convenient in our typing rules to exploit the ordering (written #), meets (#), and joins (#) of this lattice, where P is taken as the bottom and W is taken as the top. We also sometimes find it convenient to use the notation P d s:s 1 .s 2 for a functor signature that is either total or partial depending on whether Figure 4. Key Typing Rules Some key rules are summarized in Figure 4. Pure modules are dynamically pure and statically pure, and each of those are at least well-formed (rule 1). Strongly sealed modules are neither statically nor dynamically pure (2); weakly sealed modules are not statically pure, but are dynamically pure if their body is (3). Applicative functors must have dynamically pure bodies (5); generative functors have no restriction (6). Applicative functors may be used as generative ones (7). Variables are pure (4), and lambdas are dynamically pure (5 and 6). The application of an applicative functor is as pure as the functor itself (8), but the application of a generative functor is at best statically pure (9). Finally, the purity of a module is preserved by signature subsumption (12). The complete set of typing rules is given in Appendix A. The rules for functor application (rules 8 and require that the functor argument be pure. This is because the functor argument is substituted into the functor's codomain to produce the result signa- ture, and the substitution of impure modules for variables (which are always pure) can turn well-formed signatures into ill-formed ones (for example, [Typ s] becomes ill-formed if an impure module is substituted for s). (An alternative rule proposed by Harper and Lillibridge [11] resolves this issue, but induces the avoidance problem, as we discuss in Section 4.) Therefore, when a functor is to be applied to an impure argument, that argument must first be bound to a variable, which is pure. Similarly, projection of the second component of a pair is restricted to pure pairs (rule 11), but no such restriction need be made for projection of the first component (rule 10), since no substitution is involved. Static Equivalence In the foregoing discussion we have frequently made reference to a notion of module equivalence, without specifying what this means. A key design decision for a module calculus is to define when two comparable modules are to be deemed equivalent. Different module systems arise from different notions of equivalence. If a pure module has signature [[T ]], it is possible to extract the type component from it. Type checking depends essentially on the matter of which types are equal, so we must consider when Typ M is equal to Typ M # . The simplest answer would be to regard exactly when the modules M and M # are equal. But this is too naive because we cannot in general determine when two modules are equal. Suppose F : but the latter equality is undecidable in general. A characteristic feature of second class module systems is that they respect the phase distinction [12] between compile-time and run-time computation. This property of a module system states that type equivalence must be decidable independently of term equivalence. This should be intuitively plausible, since a second-class module system provides no means by which a type component of a module can depend on a term component. (This is not happenstance, but the result of careful design. We will see in Section 5 that the matter is more subtle than it appears.) Based on this principle, we define module equivalence to be "equiv- alence for type checking purposes", or static equivalence. Roughly speaking, two modules are deemed to be equivalent whenever they agree on their corresponding type components. 3 We write our module equivalence judgment as G # M The rules for static equivalence of atomic modules are the expected ones. Atomic type components must be equal, but atomic term components need not be: Since the generative production of new types in a generative functor is notionally a dynamic operation, generative functors have no static components to compare. Thus, pure generative functors are always statically equivalent, just as atomic term modules are: The complete set of equivalence rules is given in Appendix A. As an aside, this discussion of module equivalence refutes the misconception that first-class modules are more general than second-class modules. In fact, the expressiveness of first- and second-class modules is incomparable. First-class modules have the obvious advantage that they are first-class. However, since the type components of a first-class module can depend on run-time computations, it is impossible to get by with static module equivalence and one 3 The phase distinction calculus of Harper, et al. [12] includes "non-standard" equality rules for phase-splitting modules M into structures #M stat , M dyn # consisting of a static component M stat and a dynamic component M dyn . Our static equivalence M # =M # amounts to saying M stat =M # stat in their system. However, we do not identify functors with structures, as they do. must use dynamic equivalence instead (in other words, one cannot phase-split modules as in Harper et al. [12]). Consequently, first-class modules cannot propagate as much type information as second-class modules can. Singleton Signatures Type sharing information is expressed in our language using singleton signatures [33], a derivative of translucent sums [11, 14, 18]. (An illustration of the use of singleton signatures to express type sharing appears in Figure 2.) The type system allows the deduction of equivalences from membership in singleton signatures, and vice versa, and also allows the forgetting of singleton information using the subsignature relation: When deductions follow using primitive rules of the type system (since s [[T tures, they follow from the definitions given in Figure 5. Beyond expressing sharing, singletons are useful for "selfifica- tion" [11]. For instance, if s is a variable bound with the signature can be given the fully transparent signature s(s). This fact is essential to the existence of principal signatures in our type checking algorithm. Note that since singleton signatures express static equivalence information, the formation of singleton signatures is restricted to pure modules. Thus, only pure modules can be selfi- fied (as in Harper and Lillibridge [11] and Leroy [14]). Singleton signatures complicate equivalence checking, since equivalence can depend on context. For example, ls:[[T ]].[int] and ls:[[T ]].s are obviously inequivalent at signature [[T ever, using subsignatures, they can also be given the signature and at that signature they are equivalent, since they return the same result when given the only permissible argument, [int]. As this example illustrates, the context sensitivity of equivalence provides more type equalities than would hold if equivalence were strictly context insensitive, thereby allowing the propagation of additional type information. For example, ]], then the types Typ(F(ls:[[T ]].[int])) and Typ (F(ls:[[T ]].s)) are equal, which could not be the case under a context-insensitive regime. A subtle technical point arises in the use of the higher-order singletons defined in Figure 5. Suppose F : which intuitively contains the modules equivalent to F: those that take members of F's domain and return the same thing that F does. Formally speaking, however, the canonical member of this signature is not F but its eta-expansion ls:[[T ]].Fs. In fact, it is not obvious that F belongs to s [[T ]]#[[T To ensure that F belongs to its singleton signature, our type system (following Stone and Harper [33]) includes the extensional typing rule: Using this rule, F belongs to Ps:[[T ]].s(F s) because it is a function and because Fs belongs to s(F s). A similar extensional typing rule is provided for products. It is possible that the need for these s (Ms) Figure 5. Singletons at Higher Signatures rules could be avoided by making higher-order singletons primitive, but we have not explored the meta-theoretic implications of such a change. Since a module with a (higher-order) singleton signature is fully transparent, it is obviously projectible and comparable, and hence could be judged to be pure, even if it would otherwise be classified as impure. This is an instance of the general problem of recognizing that "benign effects" need not disturb purity. Since purity is a judgment in our framework, we could readily incorporate extensions to capture such situations, but we do not pursue the matter here. Type Checking Our type system enjoys a sound, complete, and effective type checking algorithm. Our algorithm comes in three main parts: first, an algorithm for synthesizing the principal (i.e., minimal) signature of a module; second, an algorithm for checking subsignature relationships; and third, an algorithm for deciding equivalence of modules and of types. Module typechecking then proceeds in the usual manner, by synthesizing the principal signature of a module and then checking that it is a subsignature of the intended signature. The signature synthesis algorithm is given in Appendix B, and its correctness theorems are stated below. The main judgment of signature synthesis is G # k M # s, which states that M's principal signature is s and M's purity is inferred to be k. Subsignature checking is syntax-directed and easy to do, given an algorithm for checking module equivalence; module equivalence arises when two singleton signatures are compared for the subsigna- ture relation. The equivalence algorithm is closely based on Stone and Harper's algorithm [33] for type constructor equivalence in the presence of singleton kinds. Space considerations preclude further discussion of this algorithm here. Full details of all these algorithms and proofs appear in the companion technical report [7]. THEOREM 2.1 (SOUNDNESS). If G THEOREM 2.2 (COMPLETENESS). If G Note that since the synthesis algorithm is deterministic, it follows from Theorem 2.2 that principal signatures exist. Finally, since our synthesis algorithm, for convenience, is presented in terms of inference rules, we require one more result stating that it really is an algorithm: THEOREM 2.3 (EFFECTIVENESS). For any G and M, it is decidable whether there exist s and k such that G # k M # s. signature SYMBOL sig type symbol val string to symbol : string -> symbol val symbol to string : symbol -> string val functor SymbolTableFun () :> SYMBOL struct val table : string array = (* allocate internal hash table *) Array.array (initial size, NONE) fun string to symbol (* lookup (or insert) x *) . fun symbol to string (case Array.sub (table, n) of | NONE => raise (Fail "bad symbol")) structure Figure 6. Strong Sealing Example 3 Strong and Weak Sealing Generativity is essential for providing the necessary degree of abstraction in the presence of effects. When a module has side-effects, such as the allocation of storage, abstraction may demand that types be generated in correspondence to storage allocation, in order to ensure that elements of those types relate to the local store and not the store of another instance. Consider, for example, the symbol table example given in Figure 6. A symbol table contains an abstract type symbol, operations for in- terconverting symbols and strings, and an equality test (presumably faster than that available for strings). The implementation creates an internal hash table and defines symbols to be indices into that internal table. The intention of this implementation is that the Fail exception never be raised. However, this depends on the generativity of the symbol type. If another instance, SymbolTable2, is created, and the types SymbolTable.symbol and SymbolTable2.symbol are considered equal, then SymbolTable could be asked to interpret indices into SymbolTable2's table, thereby causing failure. Thus, it is essential that SymbolTable.symbol and SymbolTable2.symbol be considered unequal. The symbol table example demonstrates the importance of strong sealing for encoding generative abstract types in stateful modules. Generativity is not necessary, however, for purely functional mod- ules. Leroy [15] gives several examples of such modules as motivation for the adoption of applicative functors. For instance, one may wish to implement persistent sets using ordered lists. Figure 7 signature sig type elem val compare : elem * elem -> order signature persistent sets *) sig type elem type set val empty : set val insert : elem * set -> set struct list structure struct val structure structure Figure 7. Weak Sealing Example exhibits a purely functional SetFun functor, which is parameterized over an ordered element type, and whose implementation of the abstract set type is sealed. When SetFun is instantiated multiple times-e.g., in different client modules-with the same element type, it is useful for the resulting abstract set types to be seen as interchangeable. In our system, SetFun is made applicative, but still opaque, by weakly sealing its body. Specifically, IntSet1.set and IntSet2.set are both equivalent to SetFun(IntOrd).set. This type is well-formed because SetFun has an applicative functor sig- nature, and SetFun and IntOrd, being variables, are both pure. Recall that a functor containing weak sealing is impure and must be bound to a variable before it can be used applicatively. The astute reader may notice that weak sealing is not truly necessary in the SetFun example. In fact, one can achieve the same effect as the code in Figure 7 by leaving the body of the functor unsealed and (strongly) sealing the functor itself with an applicative functor signature before binding it to SetFun. This is the technique employed by Shao [31] for encoding applicative functors, as his system lacks an analogue of weak sealing. A failing of this approach is that it only works if the functor body is fully transparent-in the absence of weak sealing, any opaque substructures would have to be strongly sealed, preventing the functor from being given an applicative signature. The best examples of the need for opaque substructures in applicative functors are provided by the interpretation of ML datatype's as abstract types [13]. In both Standard ML and Caml, datatype's are opaque in the sense that their representation as recursive sum types is not exposed, and thus distinct instances of the same datatype declaration create distinct types. Standard ML and Caml differ, however, on whether datatype's are generative. In the presence of applicative functors (which are absent from Standard ML) there is excellent reason for datatype's not to be generative-namely, that a generative interpretation would prevent datatype's from appearing in the bodies of applicative functors. This would severely diminish the utility of applicative functors, particularly since in ML recursive types are provided only through the datatype mechanism. For example, an implementation of SetFun with splay trees, using a datatype declaration to define the tree type, would require the use of weak sealing. For these reasons, strong sealing is no substitute for weak sealing. Neither is weak sealing a substitute for strong. As Leroy [15] ob- served, in functor-free code, generativity can be simulated by what we call weak sealing. (This can be seen in our framework by observing that dynamic purity provides no extra privileges in the absence of functors.) With functors, however, strong sealing is necessary to provide true generativity. Nevertheless, it is worth noting that strong sealing is definable in terms of other constructs in our language, while weak sealing is not. In particular, we can define strong sealing, using a combination of weak sealing and generative functor application, as follows: The existence of this encoding does not diminish the importance of strong sealing, which we have made primitive in our language regardless. 4 The Avoidance Problem The rules of our type system (particularly rules 8, 9, and 11 from Figure are careful to ensure that substituted modules are always pure, at the expense of requiring that functor and second-projection arguments are pure. This is necessary because the result of substituting an impure module into a well-formed signature can be ill- formed. Thus, to apply a functor to an impure argument, one must let-bind the argument and apply the functor to the resulting (pure) variable. A similar restriction is imposed by Shao [31], but Harper and Lillibridge [11] propose an alternative that softens the restriction. Harper and Lillibridge's proposal (expressed in our terms) is to include a non-dependent typing rule without a purity restriction: When M 2 is pure, this rule carries the same force as our dependent rule, by exploiting singleton signatures and the contravariance of functor signatures: When M 2 is impure, this rule is more expressive than our typing rule, because the application can still occur. However, to exploit this rule, the type checker must find a non-dependent supersignature that is suitable for application to M 2 . The avoidance problem [9, 18] is that there is no "best" way to do so. For example, consider the signature: To obtain a supersignature of s avoiding the variable s, we must forget that the first component is a constant function, and therefore we can only say that the second component is equal to the first component's result on some particular argument. Thus, for any type t, we may promote s to the supersignature: This gives us an infinite array of choices. Any of these choices is superior to the obvious ([[T but none of them is comparable to any other, since F is abstract. Thus, there is no minimal supersignature of s avoiding s. The absence of minimal signatures is a problem, because it means that there is no obvious way to perform type checking. In our type system, we circumvent the avoidance problem by requiring that the arguments of functor application and second-projection be pure (thereby eliminating any need to find non-dependent super- signatures), and provide a let construct so that such operations can still be applied to impure modules. We have shown that, as a result, our type theory does enjoy principal signatures. To achieve this, however, our let construct must be labeled with its result signature (not mentioning the variable being bound), for otherwise the avoidance problem re-arises. This essentially requires that every functor application or projection involving an impure argument be labelled with its result signature as well, leading to potentially unacceptable syntactic overhead in practice. Fortunately, programs can be systematically rewritten to avoid this problem, as we describe next. 4.1 Elaboration and Existential Signatures Consider the unannotated let expression let pure, then the let expression can be given the minimal signature s 2 (M 1 ). Otherwise, we are left with the variable s leaving scope, but no minimal supersignature of s 2 not mentioning s. However, if we rewrite the let expression as the #, then we may give it the signature Ss:s 1 .s 2 and no avoidance problem arises. Similarly, the functor application F(M) with can be rewritten as #s =M,F(s)# and given signature Ss:s 1 .s 2 . Following Harper and Stone [13], we propose the use of an elaboration algorithm to systematize these rewritings. This elaborator takes code written in an external language that supports unannotated let's, as well as impure functor application and second-projection, and produces code written in our type system. Since the elaborator rewrites modules in a manner that changes their signatures, it also must take responsibility for converting those modules back to their expected signature wherever required. This means that the elabora- tor must track which pairs are "real" and which have been invented by the elaborator to circumvent the avoidance problem. The elaborator does so using the types. When the elaborator invents a pair to circumvent the avoidance problem, it gives its signature using an existential # rather than S. In the internal language, #s:s 1 .s 2 means the same thing as Ss:s 1 .s 2 , but the elaborator treats the two signatures differently: When the elaborator expects (say) a functor and encounters a Ss:s 1 .s 2 , it generates a type error. However, when it encounters an #s:s 1 .s 2 , it extracts the s 2 component (the elab- orator's invariants ensure that it always can do so), looking for the expected functor. Space considerations preclude further details of the elaboration algorithm, which appear in the companion technical report [7]. In a sense, the elaborator solves the avoidance problem by introducing existential signatures to serve in place of the non-existent minimal supersignatures not mentioning a variable. In light of this, a natural question is whether the need for an elaborator could be eliminated by making existential signatures primitive to the type system. One natural way to govern primitive existentials is with the introduction and elimination rules: and With these rules, the avoidance problem could be solved: The least supersignature of s 2 not mentioning s:s 1 would be #s:s 1 .s 2 (s). Unfortunately, these rules (particularly the first) make type checking undecidable. For example, each of the queries and (ls:s.[t]) holds if and only if there exists pure s such that the types t[M/s] and t # [M/s] are equal. Thus, deciding subsignature or equivalence queries in the presence of existentials would be as hard as higher-order unification, which is known to be undecidable [10]. 4.2 Syntactic Principal Signatures It has been argued for reasons related to separate compilation that principal signatures should be expressible in the syntax available to the programmer. This provides the strongest support for separate compilation, because a programmer can break a program at any point and write an interface that expresses all the information the compiler could have determined at that point. Such strong support does not appear to be vital in practice, since systems such as Objective Caml and Standard ML of New Jersey's higher-order modules have been used successfully for some time without principal signatures at all, but it is nevertheless a desirable property. Our type system (i.e., the internal language) does provide syntactic principal signatures, since principal signatures exist, and all the syntax is available to the programmer. However, the elaborator's external language does not provide syntax for the existential signatures that can appear in elaborator signatures, which should be thought of as the principal signatures of external modules. Thus, we can say that our basic type system provides syntactic principal signatures, but our external language does not. In an external language where the programmer is permitted to write existential signatures, elaborating code such as: requires the elaborator to decide whether M can be coerced to belong to #s:s 1 .s 2 , which in turn requires the elaborator to produce a Determining whether any such M # exists requires the elaborator to solve an undecidable higher-order unification problem: if s only if t[M # /s] and t # [M # /s] are equal. Thus, to allow programmer-specified existential signatures in the greatest possible generality would make elaboration undecidable. Partial measures may be possible, but we will not discuss any here. Packaging Modules as First-Class Values It is desirable for modules to be usable as first-class values. This is useful to make it possible to choose at run time the most efficient implementation of a signature for a particular data set (for example, sparse or dense representations of arrays). However, fully general first-class modules present difficulties for static typing [18]. One practical approach to modules as first-class values was suggested by Mitchell, et al. [24], who propose that second-class modules automatically be wrapped as existential packages [25] to obtain first-class values. A similar approach to modules as first-class values is described by Russo and implemented in Moscow ML [29]. This existential-packaging approach to modules as first-class values is built into our language. We write the type of a packaged module as #|s|# and the packaging construct as pack M as #|s|#. Elimination of packaged modules (as for existentials) is performed using a closed-scope unpacking construct. These may be defined as follows pack M as #|s|# def unpack e as s:s in (Compare the definition of #|s|# with the standard encoding of the existential type #b.t as #a.(#b.t#a)#a.) The main limitation of existentially-packaged modules is the closed-scope elimination construct. It has been observed repeatedly in the literature [20, 3, 18] that this construct is too restrictive to be very useful. For one, in "unpack e as s:s in (e # : t)", the result type t may not mention s. As a consequence, functions over packaged modules may not be dependent; that is, the result type may not mention the argument. This deficiency is mitigated in our language by the ability to write functions over unpackaged, second-class mod- ules, which can be given the dependent type Ps:s.t(s) instead of #|s|# t. Another problem with the closed-scope elimination construct is that a term of package type cannot be unpacked into a stand-alone second-class module; it can only be unpacked inside an enclosing term. As each unpacking of a packaged module creates an abstract type in a separate scope, packages must be unpacked at a very early stage to ensure coherence among their clients, leading to "scope inversions" that are awkward to manage in practice. What we desire, therefore, is a new module construct of the form "unpack e as s", which coerces a first-class package e of type #|s|# back into a second-class module of signature s. The following example illustrates how adding such a construct carelessly can lead to unsoundness: module module module Note that the argument of the functor F is an atomic term module, so all arguments to F are statically equivalent. If F is given an applicative signature, then X 1 and X 2 will be deemed equivalent, even if the original modules M 1 and M 2 are not! Thus, F must be types t ::= - | #|s|# terms e ::= - | pack M as #|s|# modules M ::= - | unpack e as s pack M as #|s|#|s|# Figure 8. Packaged Module Extension deemed generative, which in turn requires that the unpack construct induce a dynamic effect. Packaged modules that admit this improved unpacking construct are not definable in our core language, but they constitute a simple, orthogonal extension to the type system that does not complicate type checking. The syntax and typing rules for this extension are given in Figure 8. Note that the closed-scope unpacking construct is definable as Intuitively, unpacking is generative because the module being unpacked can be an arbitrary term, whose type components may depend on run-time conditions. In the core system we presented in Section 2, the generativity induced by strong sealing was merely a pro forma effect-the language, supporting only second-class mod- ules, provided no way for the type components of a module to be actually generated at run time. The type system, however, treats dynamic effects as if they are all truly dynamic, and thus it scales easily to handle the real run-time type generation enabled by the extension in Figure 8. 6 Related Work Harper, Mitchell and Moggi [12] pioneered the theory of phase sep- aration, which is fundamental to achieving maximal type propagation in higher-order module systems. Their non-standard equational rules, which identify higher-order modules with primitive "phase- split" ones, are similar in spirit to, though different in detail from, our notion of static module equivalence. One may view their system as a subsystem of ours in which there is no sealing mechanism (and consequently all modules are pure). MacQueen and Tofte [21] proposed a higher-order module extension to the original Definition of Standard ML [22], which was implemented in the Standard ML of New Jersey compiler. Their semantics involves a two-phase elaboration process, in which higher-order functors are re-elaborated at each application to take advantage of additional information about their arguments. This advantage is balanced by the disadvantage of inhibiting type propagation in the presence of separate compilation since functors that are compiled separately from their applications cannot be re-elaborated. A more thorough comparison is difficult because MacQueen and Tofte employ a stamp-based semantics, which is difficult to transfer to a setting. Focusing on controlled abstraction, but largely neglecting higher-order modules, Harper and Lillibridge [11] and Leroy [14, 16] introduced the closely related concepts of translucent sums and manifest types. These mechanisms served as the basis of the module system in the revised Definition of Standard ML 1997 [23], and Harper and Stone [13] have formalized the elaboration of Standard ML 1997 programs into a translucent sums calculus. To deal with the avoidance problem, Harper and Stone rely on elaborator mechanisms similar to ours. The Harper and Stone language can be viewed as a subsystem of ours in which all functors are generative and only strong sealing is supported. Leroy introduced the notion of an applicative functor [15], which enables one to give fully transparent signatures for many higher-order functors. Leroy's formalism may be seen as defining purity by a syntactic restriction that functor applications appearing in type paths must be in named form. On one hand, this restriction provides a weak form of structure sharing in the sense that the abstract type F(X).t can only be the result of applying F to the module named X. On the other hand, the restriction prevents the system from capturing the full equational theory of higher-order functors, since not all equations can be expressed in named form [4]. Together, manifest types and applicative functors form the basis of the module system of Objective Caml [27]. The manifest type formalism, like the translucent sum formalism, does not address the avoidance prob- lem, and consequently it lacks principal signatures. More recently, Russo, in his thesis [28], formalized two separate module languages: one being a close model of the SML module system, the other being a higher-order module system with applicative functors along the lines of O'Caml, but abandoning the named form restriction as we do. Russo's two languages can be viewed as subsystems of ours, the first supporting only strong sealing, the second supporting only weak sealing. We adopt his use of existential signatures to address the avoidance problem, although Russo also used existentials to model generativity, which we do not. Russo's thesis also describes an extension to SML for packaging modules as first-class values. This extension is very similar to the existential- packaging approach discussed in the beginning of Section 5, and therefore suffers from the limitations of the closed-scope unpacking construct. While Russo defined these two languages separately, he implemented the higher-order module system as an experimental extension to the Moscow ML compiler [26]. Combining the two languages without distinguishing between static and dynamic effects has an unfortunate consequence. The Moscow ML higher-order module system places no restrictions on the body of an applicative in particular, one can defeat the generativity of a generative functor by eta-expanding it into an applicative one. Exploiting this uncovers an unsoundness in the language [6], that, in retrospect, is clear from our analysis: one cannot convert a partial into a total functor. Shao [31] has proposed a single type system for modules supporting both applicative and generative functors. Roughly speaking, Shao's system may be viewed as a subsystem of ours based exclusively on strong sealing and dynamic effects, but supporting both P and P par signatures. As we observed in Section 3, this means that the bodies of applicative functors may not contain opaque substructures (such as datatype's). Shao's system, like ours, circumvents the avoidance problem (Section 4) by restricting functor application and projection to pure arguments (which must be paths in his system), and by eliminating implicit subsumption, which amounts to requiring that let expressions be annotated, as in our system. It seems likely that our elaboration techniques could as well be applied to Shao's system to lift these restrictions, but at the expense of syntactic principal signatures. Shao also observes that fully transparent functors may be regarded as applicative; this is an instance of the general problem of recognizing benign effects, as described in Section 2. 7 Conclusion Type systems for first-order module systems are reasonably well understood. In contrast, previous work on type-theoretic, higher-order modules has left that field in a fragmented state, with various competing designs and no clear statement of the trade-offs (if any) between those designs. This state of the field has made it difficult to choose one design over another, and has left the erroneous impression of trade-offs that do not actually exist. For example, no previous design supports both (sound) generative and applicative functors with opaque subcomponents. Our language seeks to unify the field by providing a practical type system for higher-order modules that simultaneously supports the key functionality of preceding module systems. In the process we dispel some misconceptions, such as a trade-off between fully expressive generative and applicative functors, thereby eliminating some dilemmas facing language designers. Nevertheless, there are several important issues in modular programming that go beyond the scope of our type theory. Chief among these are: . Structure Sharing. The original version of Standard ML [22] included a notion of module equivalence that was sensitive to the dynamic, as well as static, parts of the module. Although such a notion would violate the phase distinction, it might be possible to formulate a variation of our system that takes account of dynamic equivalence in some conservative fashion. It is possible to simulate structure sharing by having the elab- orator add an abstract type to each structure to serve as the "compile-time name" of that structure. However, this would be merely an elaboration convention, not an intrinsic account of structure sharing within type theory. . Recursive Modules. An important direction for future re-search is to integrate recursive modules [8, 5, 30] into the present framework. The chief difficulty is to achieve practical type checking in the presence of general recursively dependent signatures, or to isolate a practical sub-language that avoids these problems. --R Type Systems for Modular Programs and Specifications. The Modula-3 type system Abstract types and the dot notation. Sound and complete elimination of singleton kinds. What is a recursive module? Moscow ML's higher-order modules are un- sound A type system for higher-order modules (expanded version) Cool modules for HOT languages. Bounded existentials and minimal typing. The undecidability of the second-order unification problem Manifest types Applicative functors and fully transparent higher-order modules A syntactic theory of type generativity and sharing. A modular module system. Translucent Sums: A Foundation for Higher-Order Module Systems Abstraction and Specification in Program Development. Using dependent types to express modular structure. A semantics for higher-order functors The Definition of Standard ML. David Mac- Queen An extension of Standard ML modules with subtyping and inheritance. Abstract types have existential type. Types for Modules. Recursive structures for Standard ML. Transparent modules with fully syntactic signa- tures Singleton Kinds and Singleton Types. Deciding type equivalence in a language with singleton kinds. Programming in Modula-2 --TR Abstraction and specification in program development Abstract types have existential type The ModulaMYAMPERSANDndash;3 type system Higher-order modules and the phase distinction An extension of standard ML modules with subtyping and inheritance Manifest types, modules, and separate compilation A type-theoretic approach to higher-order modules with sharing Applicative functors and fully transparent higher-order modules Bounded existentials and minimal typing Units What is a recursive module? Transparent modules with fully syntatic signatures Deciding type equivalence in a language with singleton kinds A type-theoretic interpretation of standard ML Recursive structures for standard ML Using dependent types to express modular structure The Definition of Standard ML A Semantics for Higher-Order Functors Sound and Complete Elimination of Singleton Kinds First-class structures for standard ML Singleton kinds and singleton types --CTR Oleg Kiselyov , Chung-chieh Shan, Lightweight Static Capabilities, Electronic Notes in Theoretical Computer Science (ENTCS), v.174 n.7, p.79-104, June, 2007 Norman Ramsey , Kathleen Fisher , Paul Govereau, An expressive language of signatures, ACM SIGPLAN Notices, v.40 n.9, September 2005 Karl Crary, Sound and complete elimination of singleton kinds, ACM Transactions on Computational Logic (TOCL), v.8 n.2, p.8-es, April 2007 Manuel M. T. Chakravarty , Gabriele Keller , Simon Peyton Jones, Associated type synonyms, ACM SIGPLAN Notices, v.40 n.9, September 2005 Dimitrios Vytiniotis , Geoffrey Washburn , Stephanie Weirich, An open and shut typecase, Proceedings of the 2005 ACM SIGPLAN international workshop on Types in languages design and implementation, p.13-24, January 10-10, 2005, Long Beach, California, USA Derek Dreyer, A type system for well-founded recursion, ACM SIGPLAN Notices, v.39 n.1, p.293-305, January 2004 Andreas Rossberg, Generativity and dynamic opacity for abstract types, Proceedings of the 5th ACM SIGPLAN international conference on Principles and practice of declaritive programming, p.241-252, August 27-29, 2003, Uppsala, Sweden Derek Dreyer , Robert Harper , Manuel M. T. Chakravarty , Gabriele Keller, Modular type classes, ACM SIGPLAN Notices, v.42 n.1, January 2007 Daniel K. Lee , Karl Crary , Robert Harper, Towards a mechanized metatheory of standard ML, ACM SIGPLAN Notices, v.42 n.1, January 2007 Derek Dreyer, Recursive type generativity, ACM SIGPLAN Notices, v.40 n.9, September 2005 Eijiro Sumii , Benjamin C. Pierce, A bisimulation for dynamic sealing, Theoretical Computer Science, v.375 n.1-3, p.169-192, May, 2007 Eijiro Sumii , Benjamin C. Pierce, A bisimulation for dynamic sealing, ACM SIGPLAN Notices, v.39 n.1, p.161-172, January 2004 James J. Leifer , Gilles Peskine , Peter Sewell , Keith Wansbrough, Global abstraction-safe marshalling with hash types, ACM SIGPLAN Notices, v.38 n.9, p.87-98, September Manuel M. T. Chakravarty , Gabriele Keller , Simon Peyton Jones , Simon Marlow, Associated types with class, ACM SIGPLAN Notices, v.40 n.1, p.1-13, January 2005 Andreas Rossberg, The missing link: dynamic components for ML, ACM SIGPLAN Notices, v.41 n.9, September 2006 Owens , Matthew Flatt, From structures and functors to modules and units, ACM SIGPLAN Notices, v.41 n.9, September 2006 John Billings , Peter Sewell , Mark Shinwell , Rok Strnia, Type-safe distributed programming for OCaml, Proceedings of the 2006 workshop on ML, September 16-16, 2006, Portland, Oregon, USA Martin Sulzmann , Manuel M. T. Chakravarty , Simon Peyton Jones , Kevin Donnelly, System F with type equality coercions, Proceedings of the 2007 ACM SIGPLAN international workshop on Types in languages design and implementation, January 16-16, 2007, Nice, Nice, France
modularity;singleton types;computational effects;functors;abstract data types;type theory;generativity
604154
Interprocedural compatibility analysis for static object preallocation.
We present an interprocedural and compositional algorithm for finding pairs of compatible allocation sites, which have the property that no object allocated at one site is live at the same time as any object allocated at the other site. If an allocation site is compatible with itself, it is said to be unitary: at most one object allocated at that site is live at any given point in the, execution of the program. We use the results of the analysis to statically preallocate memory space for the objects allocated at unitary sites, thus simplifying the computation of an upper bound on the amount of memory required to execute the program. We also use the analysis to enable objects allocated at several compatible allocation sites to share the same preallocated memory. Our experimental results show that, for our set of Java benchmark programs, 60% of the allocation sites are unitary and can be statically preallocated. Moreover, allowing compatible unitary allocation sites to share the same preallocated memory leads to a 95% reduction in the amount of memory preallocated for these sites.
INTRODUCTION Modern object-oriented languages such as Java present a clean and simple memory model: conceptually, all objects are allocated in a garbage-collected heap. While this abstraction simplies many aspects of the program devel- opment, it can complicate the calculation of an accurate upper bound on the amount of memory required to execute the program. Scenarios in which this upper bound is especially important include the development of programs for embedded systems with hard limits on the amount of available memory and the estimation of scoped memory sizes for real-time threads that allocate objects in sized scoped memories [9]. This paper presents a static program analysis designed to nd pairs of compatible allocation sites; two sites are compatible if no object allocated at one site may be live at the same time as any object allocated at the other site. If an allocation site is compatible with itself (we call such allocation sites unitary allocation sites), then at any time during the execution of the program, there is at most one live object that was allocated at that site. It is therefore possible to statically preallocate a xed amount of space for that allocation site, then use that space to hold all objects allocated at that site. Any further space usage analyses can then focus only on the non-unitary allocation sites. Our analysis uses techniques inspired from register allocation [2, 6] to reduce the amount of memory required to hold objects allocated at unitary allocation sites. The basic approach is to build and color an incompatibility graph. The nodes in this graph are the unitary allocation sites. There is an undirected edge between two nodes if the nodes are not compatible. The analysis applies a coloring algorithm that assigns a minimal number of colors to the graph nodes subject to the constraint that incompatible nodes have dierent colors. This information enables the compiler to statically preallocate a xed amount of memory for each color. At each unitary allocation site, the generated code bypasses the standard dynamic allocation mechanism and instead simply returns a pointer to the start of the statically preallocated memory for that allocation site's color. The object is stored in this memory for the duration of its lifetime in the com- putation. Our algorithm therefore enables objects allocated at compatible allocation sites to share the same memory. Results from our implemented analysis show that, for our set of Java benchmark programs, our analysis is able to identify 60% of all allocation sites in the program as unitary allocation sites. Furthermore, our incompatibility graph coloring algorithm delivers a 95% reduction in the amount of memory required to store objects allocated at these unitary allocation sites. We attribute the high percentage of unitary allocation sites to specic object usage patterns characteristic of Java programs: many unitary allocation sites allocate exception, string buer, or iterator objects. We identify two potential benets of our analysis. First, it can be used to simplify a computation of the amount of memory required to execute a given program. We have implemented a memory requirements analysis that, when pos- sible, computes a symbolic mathematical expression for this amount of memory [16]. Our results from [16] show that preceding the memory requirements analysis with the analysis presented in this paper, then using the results to compute the memory requirements of unitary sites separately, can signicantly improve both the precision and the e-ciency of the subsequent memory requirements analysis. The second potential benet is a reduction in the memory management overhead. By enabling the compiler to convert heap allocation to static allocation, our analysis can reduce the amount of time required to allocate and reclaim memory. This paper makes the following contributions: Object Liveness Analysis: It presents a compositional and interprocedural object liveness analysis that conservatively estimates the set of objects that are live at each program point. Compatibility Analysis: It presents a compositional and interprocedural analysis that nds sets of compatible allocation sites. All objects allocated at sites in each such set can share the same statically preallocated memory. This analysis uses the results of the object liveness analysis. Implementation: We implemented our analyses in the MIT Flex [3] compiler and used them to analyze a set of Java benchmark programs. Our results show that our analyses are able to classify the majority of the allocation sites as unitary allocation sites, and that many such sites can share the same memory. We also implemented and evaluated a compiler optimization that transforms each unitary allocation site to use pre-allocated memory space instead of invoking the standard memory allocator. The rest of this paper is organized as follows. Section 2 presents the analysis algorithm. Section 3 describes the implementation and presents our experimental results. We discuss related work in Section 4 and conclude in Section 5. 2. ANALYSIS PRESENTATION Given a program P , the goal of the analysis is to detect pairs of compatible allocation sites from P , i.e., sites that have the property that no object allocated at one site is live at the same time as any object allocated at the other site. Equivalently, the analysis identies all pairs of incompatible allocation sites, i.e., pairs of sites such that an object allocated at the rst site and an object allocated at the second site may both be live at the same time in some possible execution of P . An object is live if any of its elds or methods is used in the future. It is easy to prove the following fact: Fact 1. Two allocation sites are incompatible if an object allocated at one site is live at the program point that corresponds to the other site. To identify the objects that are live at a program point, the analysis needs to track the use of objects throughout the program. There are two complications. First, we have an abstraction problem: the analysis must use a nite abstraction to reason about the potentially unbounded number of objects that the program may create. Second, some parts of the program may read heap references created by other parts of the program. Using a full-edged ow-sensitive pointer analysis would substantially increase the time and space requirements of our analysis; a ow-insensitive pointer analysis [18, 5] would not provide su-cient precision since liveness is essentially a ow-sensitive property. We address these complications as follows: We use the object allocation site model [13]: all objects allocated by a given statement are modelled by an inside node 1 associated with that statement's program label. The analysis tracks only the objects pointed to by local variables. Nodes whose address may be stored into the heap are said to escape into the heap. The analysis conservatively assumes that such a node is not unitary (to ensure this, it sets the node to be incompatible with itself). Notice that, in a usual Java program, there are many objects that are typically manipulated only through local variables: exceptions, iterators, string buers, etc. 2 Under these assumptions, a node that does not escape into the heap is live at a given program point if and only if a variable that is live at that program point refers to that node. Variable liveness is a well-studied data ow analysis [2, 6] and we do not present it here. As a quick reminder, a variable v is live at a program point if and only if there is a path through the control ow graph that starts at that program point, does not contain any denition of v and ends at an instruction that uses v. The analysis has to process the call instructions accu- rately. For example, it needs to know the nodes returned from a call and the nodes that escape into the heap during the execution of an invoked method. Reanalyzing each method for each call instruction (which corresponds conceptually to inlining that method) would be ine-cient. In- stead, we use parameter nodes to obtain a single context-sensitive analysis result for each method. The parameter nodes are placeholders for the nodes passed as actual argu- ments. When the analysis processes a call instruction, it replaces the parameter nodes with the nodes sent as argu- ments. Hence, the analysis is compositional : in the absence of recursion, it analyzes each method exactly once to extract a single analysis result. 3 At each call site, it instantiates the result for the calling context of that particular call site. We use the adjective \inside" to make the distinction from the \pa- rameter" nodes that we introduce later in the paper. 2 It is possible to increase the precision of this analyis by tracking one or more levels of heap references (similar to [8]). 3 The analysis may analyze recursive methods multiple times before it reaches a xed point. I Figure 1: Node Abstraction Figure presents a summary of our node abstraction. We use the following notation: INode denotes the set of all inside nodes, PNode denotes the set of parameter nodes, and Node denotes the set of all nodes. When analyzing a method M , the analysis scope is the method M and all the methods that it transitively invokes. The inside nodes model the objects allocated in this scope. n I lb denotes the inside node associated with the allocation site from label lb (the superscript I stands for \inside"; it is not a free variable). n I lb represents all objects allocated at label lb in the currently analyzed scope. The parameter nodes model the objects that M receives as arguments. The parameter node n P models the object that the currently analyzed method receives as its ith argument of object type. 4 The analysis has two steps, each one an analysis in itself. The rst analysis computes the objects live at each allocation site or call instruction. 5 The second analysis uses the liveness information to compute the incompatibility pairs. We formulate our analyses as systems of set inclusion constraints and use a bottom-up, iterative xed-point algorithm to compute the least (under set inclusion) solution of the constraints. For a given program, the number of nodes is bounded by the number of object allocation sites and the number of parameters. Hence, as our constraints are mono- tonic, all xed point computations are guaranteed to terminate The rest of this section is organized as follows. Section 2.1 describes the execution of the analysis on a small example. Section 2.2 presents the program representation that the analysis operates on. Section 2.3 describes the object liveness analysis. In Section 2.4, we describe how to use the object liveness information to compute the incompatibility pairs. Section 2.5 discusses how to apply our techniques to multithreaded programs. 2.1 Example Consider the Java code from Figure 2. The program creates a linked list that contains the integers from 0 to 9, removes from the list all elements that satisfy a specic condition (the even numbers in our case), then prints a string representation of the remaining list. The program contains six lines that allocate objects. The two Iterators from lines 3a and 3b are allocated in library code, at the same allocation site. The other four lines allocate objects directly by executing new instructions. For the sake of simplicity, we ignore the other objects allocated in the library. In our exam- ple, we have ve inside nodes. Node n I 1 represents the linked list allocated at line 1, node n I 2 represents the Integers allocated at line 2, etc. The iterators from lines 3a and 3b are both represented by the same node n I 3 (they are allocated at the same site). Figure 3 presents the incompatibility graph for this example. 4 I.e., not primitive types such as int, char etc. 5 The object liveness analysis is able to nd the live nodes at any program point; however, for e-ciency reasons, we produce an analysis result only for the relevant statements. static void main(String args[]) { static List createList(int size) { 1: List list = new LinkedList(); { 2: Integer list.add(v); return list; static void filterList(List l) { { static String listToString(List l) { 4: StringBuffer buffer = new StringBuffer(); { buffer.append(v).append(" "); 5: return new String(buffer); Figure 2: Example Code The analysis processes the methods in a bottom-up fash- ion, starting from the leaves of the call graph. The library method LinkedList.add (not shown in Figure 2) causes its parameter node n P 1 is the this parameter) to escape into the heap (its address is stored in a list cell). createList calls add with n I 2 as argument; therefore, the analysis instantiates 2 with n I 2 and detects that n I escapes. In filterList, the parameter node n P (the list) escapes into the heap because list.iterator() stores a reference to the underlying list in the iterator that it creates. In the listToString method, n I 4 is live \over the call" to list.iterator() that allocates n I is pointed to by the local variable buffer, which is live both before and after the call. Therefore, n I 4 is incompatible with n I 3 . Because n I 4 is live at line 5, n I 4 is also incompatible with n I 5 . n I 3 is not live n In In In In I Figure 3: Incompatibility graph for the code from Figure 2. Circles represent inside nodes; a double circle indicates that the node escapes into the heap. I 3 and n I 5 are compatible unitary nodes. Name Format Informal semantics local variable into another new C create one object of class C create a heap reference RETURN return v normal return from a method THROW throw v exceptional return from a method nodes in join points Figure 4: Instructions relevant for the analysis. at line 5, so n I 3 and n I 5 are still compatible. The parameter node n P (the list) is live at lines 4 and 3b (but not at 5). Therefore, n P 1 is incompatible with n I 4 and n I 3 . The analysis of main detects that l points to n I (because createList returns n I As the parameter of filterList escapes into the heap, the analysis detects that n I escapes. When processing the call to listToString, the analysis instantiates 1 with n I 1 and discovers the incompatibility pairs hn I 4 i. The analysis has already determined that n I escapes into the heap and is not an unitary node; we generate the last two incompatibility pairs for purely expository purposes. The graph coloring algorithm colors n I 3 and n I 5 with the same color. This means that the two iterators and the String allocated by the program have the property that no two of them are live at the same time. Hence, the compiler can statically allocate all of these objects into the same memory space. 2.2 Program Representation We work in the context of a static compiler that compiles the entire code of the application before the application is deployed and executes. Our compiler provides full re ec- tive access to classes and emulates the dynamic loading of classes precompiled into the executable. It does not support the dynamic loading of classes unknown to the compiler at compile time. This approach is acceptable for our class of target applications, real time software for embedded devices, for which memory consumption analysis is particularly important The analyzed program consists of a set of methods with a distinguished main method. Each method m is represented by its control ow graph CFGm . The vertices of CFGm are the labels of the instructions composing m's body, while the edges represent the ow of control inside m. Each method has local variables Var is the set of local variables and method parameters. Figure 4 contains the instructions that are relevant for the analysis. We assume that the analyzed program has already been converted into the Single Static Information (SSI) form [4], an extension of the Static Single Assignment explain the dierences later in this sec- tion). Our intermediate representation models the creation and the propagation of exceptions explicitly. Each instruction that might generate an exception is preceded by a test. If an exceptional situation is detected (e.g., a null pointer deref- erencing), our intermediate representation follows the Java convention of allocating and initializing an exception ob- ject, (e.g., a NullPointerException), then propagating the exception to the appropriate catch block or throwing the exception out of the method if no such block exists. Notice that due to the semantics of the Java programming lan- guage, each instruction that can throw an exception is also a potential object allocation site. Moreover, the exception objects are rst class objects: once an exception is caught, references to it can be stored into the heap or passed as arguments of invoked methods. In practice, we apply an optimization so that each method contains a single allocation site for each automatically inserted exception (for example, NullPointerException and ArrayIndexOutOfBoundsException) that the method may generate but not catch. When the method detects such an exception, it jumps to that allocation site, which allocates the exception object and then executes an exceptional return out of the method. To allow the inter-procedural propagation of exceptions, a CALL instruction from label lb has two successors: for the normal termination of the method and for the case when an exception is thrown out of the invoked method. In both cases | locally generated exceptions or exceptions thrown from an invoked method | the control is passed to the appropriate catch block, if any. This block is determined by a succession of \instanceof" tests. If no applicable block exists, the exception is propagated into the caller of the current method by a THROW instruction \throw v". Unlike a throw instruction from the Java language, a THROW instruction from our intermediate representation always terminates the execution of the current method. Note: we do not check for exceptions that are subclasses of java.lang.Error. 6 This is not a signicant restriction: as we work in the context of a static compiler, where we know the entire code and class hierarchy, most of these errors cannot be raised by a program that compiled successfully in our system, e.g. VirtualMachineError, NoSuchFieldError etc. If the program raises any one of the rest of the errors, e.g., OutOfMemoryError, it aborts. In most of the cases, this is the intended behavior. In particular, none of our benchmarks catches this kind of exception. We next present the informal semantics of the instructions from Figure 4. A COPY instruction copies the 6 In the Java language, these exceptions correspond to severe errors in the virtual machine that the program is not expected to handle. value of local variable v1 into local variable v2 . A PHI instruction is an SSA node that appears in the join points of the control ow graph; it ensures that each use of a local variable has exactly one reaching de- nition. If the control arrived in the PHI instruction on the ith incoming edge, v i is copied into v. A NEW instruction new C" allocates a new object of class C and stores a reference to it in the local variable v. A CALL instruction \hvN ; vE calls the method named mn of the object pointed to by v1 , with the arguments If the execution of the invoked method terminates with a RETURN instruction \return v", the address of the returned object is stored into vN and the control ow goes to succN (lb ), where lb is the label of the call instruction. Otherwise, i.e., if an exception was thrown out of the invoked method, the address of the exception object is stored into vE and the control ow goes to succE (lb ). A TYPESWITCH instruction \hv1 ; C" corresponds to a Java \instanceof" test. It checks whether the class of the object pointed to by v is a subclass of C. v is split into two variables: v1 is v's restriction on the true branch, while v2 is v's restriction on the false branch. Therefore, the object pointed to by v1 is an instance of C, while the object pointed to by v2 is not. A TYPESWITCH instruction is a simple example of an SSI \sigma" node, (v)", that the SSI form introduces to preserve the ow sensitive information acquired in the test instruc- tions. SSI thus allows the elegant construction of predicated data ow analyses. Apart from this \variable splitting", SSI is similar to the SSA form. In particular, the SSI conversion seems to require linear time in practice [4]. Finally, a STORE instruction \v1 sets the eld f of the object referenced by v1 to point to the object referenced by v2 . The other instructions are irrelevant for our analysis. In particular, as we do not track heap references, the analysis cannot gain any additional information by analyzing the instructions that read references from memory. However, we do analyze the STORE instructions because we need to identify the objects that escape into the heap. We assume that we have a precomputed call each label lb that corresponds to a CALL instruction, callees(lb ) is the set of methods that that call instruction may invoke. The analysis works with any conservative approximation of the runtime call graph. Our implementation uses a simplied version of the Cartesian Product Algorithm [1]. 2.3 Object Liveness Analysis Consider a method M , a label/program point lb inside M , and let live(lb ) denote the set of inside and parameter nodes that are live at lb . We conservatively consider that a node is live at lb i it is pointed to by one of the variables that are live at that point: v live in lb P (v) where P (v) is the set of nodes to which v may point. To interpret the results, we need to compute the set EG of inside nodes that escape into the heap during the execution 7 For the sake of simplicity, in the presentation of the analysis we consider only instance methods (in Java terms, non-static methods), i.e., with v1 as the this argument. The implementation handles both instance methods and static methods. of the program. To be able to process the calls to M , we also compute the set of nodes that can be normally returned from M , RN (M ), the set of exceptions thrown from M , RE (M ), and the set of parameter nodes that may escape into the heap during the execution of M , E(M ). More formally, the analysis computes the following mathematical objects: EG INode We formulate the analysis as a set inclusion constraint problem. Figure 5 presents the constraints generated for a method the beginning of the method, p i points to the parameter node n P . A COPY instruction sets v1 to point to all nodes that v2 points to; accordingly, the analysis generates the constraint P The case of a PHI instruction is similar. A NEW instruction from label lb , \v new C", makes v point to the inside node n I lb attached to that allocation site. The constraints generated for RETURN and THROW add more nodes to RN (M) and RE (M ), re- spectively. A STORE instruction \v1 causes all the nodes pointed to by v2 to escape into the heap. Accordingly, the nodes from P (v2) are distributed between EG (the inside nodes) and E(M) (the parameter nodes). A TYPESWITCH instruction \hv1 ; v2 C" works as a type lter: v1 points to those nodes from P (v) that may represent objects of a type that is a subtype of C, while v2 points to those nodes from P (v) that may represent objects of a type that is not a subtype of C. In Figure 5, denotes the set of all subtypes (i.e., Java sub- classes) of C (including C). We can precisely determine the type type(n I of an inside node n I lb 0 by examining the NEW instruction from label lb 0 . Therefore, we can precisely distribute the inside nodes between P (v1 ) and P (v2 ). As we do not know the exact types of the objects represented by the parameter nodes, we conservatively put these nodes in both sets. 9 A CALL instruction \hvN ; vE vN to point to the nodes that may be returned from the invoked method(s). For each possible callee m 2 callees(lb ), we include the nodes from RN (m) into P (vN ). Note that RN (m) is a parameterized result. We therefore instantiate RN (m) before use by replacing each parameter node n P i with the nodes that the corresponding argument v i points to, i.e., the nodes from P (v i ). The case of vE is analogous. The execution of the invoked method m may also cause some of the nodes passed as arguments to escape into the heap. Accord- ingly, the analysis generates a constraint that instantiates the set E(m) and the uses the nodes from the resulting set E(m)hP (v1 to update EG and E(M ). Here is a more formal and general denition of the previously mentioned instantiation operation: if S Node is a set that contains some of the parameter nodes n P (not necessarily all), and 8 As we use the SSI form, this is the only denition of v1 ; therefore, we do not lose any precision by using \=" instead of \". 9 A better solution would be to consider the declared type Cp of the corresponding parameter and check that Cp and C have at least one common subtype. s method entry P (p where are M 's parameters. RETURN: return v RN (M) P (v) THROW: throw v RE (M) P (v) RN (m)hP (v1 let E(M) A \ PNode ; EG A \ INode TYPESWITCH: denotes the set of subclasses of class C. Figure 5: Constraints for the object liveness analysis. For each method M , we compute RN (M), RE (M), E(M) and P (v) for each variable v live in at a relevant label. We also compute the set EG of inside nodes that escape into the heap. 2.4 Computing the Incompatibility Pairs Once the computation of the object liveness information completes, the analysis computes the (global) set of pairs of incompatible allocation sites IncG INode INode. 10 The analysis uses this set of incompatible allocation sites to detect the unitary allocation sites and to construct the compatibility classes. Figure 6 presents the constraints used to compute IncG . An allocation site from label lb is incompatible with all the allocation sites whose corresponding nodes are live at lb . However, as some of the nodes from live(lb ) may be parameter nodes, we cannot generate all incompatibility pairs directly. Instead, for each method M , the analysis collects the incompatibility pairs involving one parameter node into a set of parametric incompatibilities ParInc(M ). It instantiates this set at each call to M , similar to the way it instantiates Recall that there is a bijection between the inside nodes and the allocation sites. (S i is the set of nodes that the ith argument sent to M might point to). Notice that some S i may contain a parameter node from M 's caller. However, at some point in the call graph, each incompatibility pair will involve only inside nodes and will be passed to IncG . To simplify the equations from Figure 6, for each method M , we compute the entire set of incompatibility pairs AllInc(M ). After AllInc(M) is computed, the pairs that contain only inside nodes are put in the global set of incompatibilities IncG ; the pair that contains a parameter node are put in ParInc(M ). Our implementation of this algorithm performs this separation \on the y", as soon as an incompatibility pair is generated, without the need for AllInc(M ). In the case of a CALL instruction, we have two kinds of incompatibility pairs. We have already mentioned the rst kind: the pairs obtained by instantiating ParInc(m); 8m 2 callees(lb ). In addition, each node that is live \over the call" (i.e., before and after the call) is incompatible with all the nodes corresponding to the allocation sites from the invoked methods. To increase the precision, we treat the normal and new C live(lb ) fn I lb g AllInc(M) . & (live(lb) \ live(succN (lb ))) AN (m) AllInc(M) (live(lb) \ live(succE (lb))) AE (m) AllInc(M) AllInc(M) \ (INode INode) IncG AllInc(M) n (INode INode) ParInc(M) Figure Constraints for computing the set of incompatibility pairs. Instruction at label lb in method M Condition Generated constraints new C lb ; return n I Figure 7: Constraints for computing AN , AE . For each relevant instruction, if the condition from the second column is satised, the corresponding constraint from the third column is generated. the exceptional exit from an invoked method separately. Let AN (m) INode be the set of inside nodes that represent the objects that may be allocated during a method execution that returns normally. Similarly, let AE (m) INode be the set of inside nodes that represent the objects that may be allocated during an invocation of m that returns with an exception. We describe later how to compute these sets; for the moment we suppose the analysis computes them just before it starts to generate the incompatibility pairs. Let succN (lb ) be the successor corresponding to the normal return from the CALL instruction from label lb . The nodes from live(lb ) \ live(succN (lb are incompatible with all nodes from AN (m). A similar relation holds for AE (m). Computation of AN (M), AE (M) Given a label lb from the code of some method M , we dene the predicate \lb ; return" to be true i there is a path in CFGM from lb to a RETURN instruction (i.e., the instruction from label lb may be executed in an invocation of M that returns normally). Analogously, we dene throw" to be true i there is a path from lb to a THROW instruction. Computing these predicates is an easy graph reachability problem. For a method M , AN (M) contains each inside node n I lb that corresponds to a NEW instruction at label lb such that lb ; return. In addi- tion, for a CALL instruction from label lb in M 's code, if then we add all nodes from AN (m) into AN (M ), for each possible callee m. Analogously, if The computation of AE (m) is similar. Figure 7 formally presents the constraints for computing the sets AN (M) and AE (M ). 2.5 Multithreaded Applications So far, we have presented the analysis in the context of a single-threaded application. For a multithreaded appli- cation, the analysis needs to examine all methods that are transitively called from the main method and from the run() methods of the threads that may be started. In addition, all nodes that correspond to started threads need to be marked as escaped nodes. The rest of the analysis is unchanged. In Java, each thread is represented by a thread object allocated in the heap. For an object to escape one thread to be accessed by another, it must be reachable from either the thread object or a static class variable (global variables are called static class variables in Java). In both cases, the analysis determines that the corresponding allocation site is not unitary. Therefore, all objects allocated at unitary allocation sites are local to the thread that created them and do not escape to other threads. Although we know that no two objects allocated by the same thread at the same unitary site are live at any given moment, we can have multiple live objects allocated at this site by dierent threads. Hence, for each group of compatible unitary sites, we need to allocate one memory slot per thread, instead of one per program. The compiler generates code such that each time the program starts a new thread, it preallocates memory space for all unitary allocation sites that may be executed by that thread. For each unitary allocation site, the compiler generates code that retrieves the current thread and uses the preallocated memory space for the unitary site in the current thread. When a thread terminates its execution, it deallocates its preallocated memory space. As only thread-local objects used that space, this deallocation does not create dangling references. To bound the memory space occupied by the unitary allocation sites, we need to bound the number of threads that simultaneously execute in the program at any given time. 2.6 Optimization for Single-Thread Programs In the previous sections, we consider a node that escapes into the heap to be incompatible with all other nodes, including itself. This is equivalent to considering the node to be live during the entire program. We can gain additional precision by considering that once a node escapes, it is live only for the rest of the program. This enhancement allows us to preallocate even objects that escape into the heap, if their allocation site executes at most once. This section presents the changes to our analysis that apply this idea. We no longer use the global set EG . Instead, for each label lb , E(lb) Node denotes the set of nodes that the instruction at label lb may store a reference to into the heap. This set is relevant only for labels that correspond to STOREs and CALLs; for a CALL, it represents the nodes that escape during the execution of the invoked method. We extend the set of objects live at label lb (from method M) to include all objects that are escaped by instructions at labels lb ' from M that can reach lb in CFGM : live(lb v live in lb P (v) [ We change the constraints from Figure 5 as follows: for a STORE instruction \v1 only the constraint E(lb we generate the same constraints as before for P (vN ) and P (vE ), and the additional constraint The rules for STORE and CALL no longer generate any constraints for EG (unused now) and E(M ). Instead, we dene E(M) as lb in M E(lb) E(M) P(Node) denotes the set of all nodes | not only parameter nodes as before, but also inside nodes | that escape into the heap during M 's execution. The rest of the analysis is unchanged. The new denition of live(lb ) ensures that if a node escapes into the heap at some program point, it is incompatible with all nodes that are live at any future program point. Notice that objects allocated at unitary sites are no longer guaranteed to be thread local, and we cannot apply the preallocation optimization described at the end of Section 2.5. Therefore, we use this version of the analysis only for single thread programs 3. EXPERIMENTAL RESULTS We have implemented our analysis, including the optimization from Section 2.6, in the MIT Flex compiler system [3]. We have also implemented the compiler transformation for memory preallocation: our compiler generates executables with the property that unitary sites use preallocated memory space instead of calling the memory allocation primitive. The memory for these sites is preallocated at the beginning of the program. Our implementation does not currently support multithreaded programs as described in Section 2.5. We measure the eectiveness of our analysis by using it to nd unitary allocation sites in a set of Java programs. We obtained our results on a Pentium 4 2.8Ghz system with 2GB of memory running RedHat Linux 7.3. We ran our compiler and analysis using Sun JDK 1.4.1 (hotspot, mixed mode); the compiler generates native executables that we ran on the same machine. Table 1 presents a description of the programs in our benchmark suite. We analyze programs from the SPECjvm98 benchmark suite 11 and from the Java version of the Olden benchmark suite [12, 11]. In addition, we analyze JLex, JavaCUP, and 205 raytrace. Table presents several statistics that indicate the size of each benchmark and the analysis time. The statistics refer to the user code plus all library methods called from the user code. As the data in Table 2 indicate, in general, the time required to perform our analysis is of the same order of magnitude as the time required to build the intermediate representation of the program. The only exceptions are 202 jess and 213 javac. Table 3 presents the number of total allocation sites and unitary allocation sites in each program. These results show that our analysis is usually able to identify the majority of these sites as unitary sites: of the 14065 allocation sites in our benchmarks, our analysis is able to classify 8396 (60%) as unitary sites. For twelve of our twenty benchmarks, the analysis is able to recognize over 80% of the allocation sites as unitary. Table 3 also presents results for the allocation sites that allocate exceptions (i.e., any subclass of java.lang.Throwable), non-exceptions (the rest of the ob- jects), and java.lang.StringBuers (a special case of non- exceptions). For each category, we present the total number of allocation sites of that kind and the proportion of these sites that are unitary. The majority of the unitary allocation sites in our benchmarks allocate exception or string buer objects. Of the 9660 total exception allocation sites in our benchmarks, our analysis is able to recognize 6602 (68%) as unitary sites. For thirteen of our twenty benchmarks, the analysis is able to recognize over 90% of the exception allocation sites as unitary sites. Of the 1293 string buer allocation sites, our analysis is able to recognize 1190 (92%) as unitary sites. For eight benchmarks, the analysis is able to recognize over 95% of the string buer allocation sites as unitary sites. Table 4 presents the size of the statically preallocated memory area that is used to store the objects created at unitary allocation sites. The second column of the table presents results for the case where each unitary allocation site has its own preallocated memory chunk. As described in the introduction of the paper, we can decrease the pre-allocated memory size signicantly if we use a graph coloring algorithm to allow compatible unitary allocation sites to share the same preallocated memory area. The third column of Table presents results for this case. Our compiler optimization always uses the graph coloring algorithm; we provide the second column for comparison purposes only. 11 With the exception of 227 mtrt, which is multithreaded. Application Description SPECjvm98 benchmark set 200 check Simple program; tests JVM features compress File compression tool jess Expert system shell 209 db Database application 213 javac JDK 1.0.2 Java compiler 222 mpegaudio Audio le decompression tool 228 jack Java parser generator Java Olden benchmark set BH Barnes-Hut N-body solver BiSort Bitonic Sort Em3d Models the propagation of electromagnetic waves through three dimensional objects Health Simulates a health-care system MST Computes the minimum spanning tree in a graph using Bentley's algorithm Perimeter Computes the perimeter of a region in a binary image represented by a quadtree Power Maximizes the economic e-ciency of a community of power consumers TSP Solves the traveling salesman problem using a randomized algorithm TreeAdd Recursive depth-rst traversal of a tree to sum the node values Voronoi Computes a Voronoi diagram for a random set of points Miscellaneous raytrace Single thread raytracer (not an o-cial part of SPECjvm98) JLex Java lexer generator JavaCUP Java parser generator Table 1: Analyzed Applications Application Analyzed methods Bytecode instrs size (instr.) SSI conversion time Analysis time 200 check 208 7962 10353 1.1 4.1 compress 314 8343 11869 1.2 7.4 jess 1048 31061 44746 5.3 101.2 222 mpegaudio 511 18041 30884 5.2 15.9 228 jack 618 23864 37253 11.6 55.6 BiSort 123 5157 6615 1.2 2.9 Em3d 142 5519 7497 0.9 3.1 Health 141 5803 7561 0.9 3.2 MST 139 5228 6874 1.2 3.0 Perimeter 144 5401 6904 1.2 2.7 Power 135 6039 7928 1.0 3.2 TreeAdd 112 4814 6240 0.8 2.8 Voronoi 274 8072 10969 1.8 4.3 raytrace 498 14116 20875 4.2 23.0 JLex 482 22306 31354 4.0 12.3 JavaCUP 769 27977 41308 5.8 32.0 Table 2: Analyzed Code Size and Analysis Time Application Allocation Unitary sites Exceptions Non-exceptions StringBuers sites count % total unitary total unitary total unitary 200 check 407 326 80% 273 92% 134 57% 44 97% compress 489 155 32% 390 28% 99 44% 38 97% jess 1823 919 50% 1130 58% 693 38% 233 84% 222 mpegaudio 825 390 47% 625 55% 200 24% 43 97% 228 jack 910 479 53% 612 54% 298 50% 135 99% BiSort 234 198 85% 177 97% 57 47% 17 94% Em3d 276 235 85% 206 98% 70 50% 20 95% Health 276 227 82% 202 97% 74 42% 17 94% MST 257 216 85% 194 97% 63 44% Perimeter Power 262 213 81% 192 97% 70 39% 15 93% TreeAdd 227 190 84% 170 96% 57 46% 15 93% Voronoi 448 387 86% 349 98% 99 44% 28 96% raytrace 753 318 42% 525 44% 228 39% 43 95% JLex 971 812 84% 645 99% 326 54% 72 86% Total 14065 8396 60% 9660 68% 4405 41% 1293 92% Table 3: Unitary Site Analysis Results Preallocated memory Size Application size (bytes) reduction normal sharing % 200 check 5516 196 96% compress 2676 144 95% jess 17000 840 96% 222 mpegaudio 6452 104 98% 228 jack 8344 224 97% BH 4604 224 95% BiSort 3252 96 98% Em3d 3860 200 95% Health 3716 96 97% MST 3532 96 97% Perimeter Power 3540 196 94% TreeAdd 3120 92 98% raytrace 5656 644 89% JLex 13996 1676 88% JavaCUP 20540 1180 94% Total 143088 6984 95% Table 4: Preallocated Memory Size The graph coloring algorithm nds an approximation of the smallest number of colors such that no two incompatible allocation sites have the same color. For each color, we pre-allocate a memory area whose size is the maximum size of the classes allocated at allocation sites with that color. Our implementation uses the DSATUR graph coloring heuristic [10]. It is important to notice that the DSATUR heuristic minimizes the numbers of colors, not the nal total size of the preallocated memory. However, this does not appear to have a signicant negative eect on our results: as the numbers from Table 4 show, we are able to reduce the preallocated memory size by at least 88% in all cases; the average reduction is 95%. Theoretically, the preallocation optimization may allocate more memory than the original program: preallocating a memory area for a set of compatible allocation sites reserves that area for the entire lifetime of the program, even when no object allocated at the attached set of compatible sites is reachable. An extreme case is represented by the memory areas that we preallocate for allocation sites that the program never executes. However, as the data from Table 4 indicate, in practice, the amount of preallocated memory for each analyzed application is quite small. We compiled each benchmark with the memory preallocation optimization enabled. Each optimized executable n- ished normally and produced the same result as the unoptimized version. We executed the SPECjvm98 and the Olden applications with their default workload. We ran JLex and JavaCUP on the lexer and parser les from our compiler in- frastructure. We instrumented the allocation sites to measure how many objects were allocated by the program and how many of these objects used the preallocated memory. Application Total Preallocated objects objects count % 200 check 725 238 33% compress 941 108 11% jess 7917932 3275 0% 222 mpegaudio 1189 7 1% 228 jack 6857090 409939 6% BH 15115028 7257600 48% BiSort 131128 15 0% Em3d 16061 23 0% Health 1196846 681872 57% MST 2099256 1038 0% Perimeter Power 783439 12 0% TreeAdd 1048620 13 0% raytrace 6350085 4080258 64% JLex 1419852 12926 1% JavaCUP 100026 16517 17% Table 5: Preallocated Objects Table 5 presents the results of our measurements. For ve of our benchmarks, at least one third of the objects resided in the preallocated memory. There is no correlation between the static number of unitary sites and the dynamic number of objects allocated at those sites. This is explained by the large dierence in the number of times dierent allocation sites are executed. In general, application-specic details tend to be the only factor in determining these dynamic numbers. For example, in JLex, 95% of the objects are iterators allocated at the same (non-unitary) allocation site; 213 javac and JavaCUP use many StringBuers that we can preallocate; both 205 raytrace and BH use many temporary objects to represent mathematical vectors, etc. 4. RELATED WORK This paper presents, to our knowledge, the rst use of a pointer analysis to enable static object preallocation. Other researchers have used pointer and/or escape analyses to improve the memory management of Java programs [14, 20, 7], but these algorithms focus on allocating objects on the call stack. Researchers have also developed algorithms that correlate the lifetimes of objects with the lifetimes of invoked methods, then use this information to allocate objects in dierent regions [19]. The goal is to eliminate garbage collection overhead by atomically deallocating all of the objects allocated in a given region when the corresponding function returns. Other researchers [17] require the programmer to provide annotations (via a rich type systems) that specify the region that each object is allocated into. Bogda and Hoelzle [8] use pointer analysis to eliminate unnecessary synchronizations in Java programs. In spite of the dierent goals, their pointer analysis has many technical similarities with our analysis. Both analyses avoid maintaining precise information about objects that are placed \too deep" into the heap. Bogda and Hoelzle's analysis is more precise in that it can stack allocate objects reachable from a single level of heap references, while our analysis does not attempt to maintain precise points-to information for objects reachable from the heap. On the other hand, our analysis is more precise in that it computes live ranges of objects and treats exceptions with more precision. In particular, we found that our predicated analysis of type switches (which takes the type of the referenced object into account) was necessary to give our analysis enough precision to statically preallocate exception objects. Our analysis has more aggressive aims than escape anal- ysis. Escape analysis is typically used to infer that the life-times of all objects allocated at a specic allocation site are contained within the lifetime of either the method that allocates them or one of the methods that (transitively) invokes the allocating method. The compiler can transform such an allocation site to allocate the object from the method stack frame instead of the heap. Notice that the analysis does not provide any bound on the number of objects allocated at that allocation site: in the presence of recursion or loops, there may be an arbitrary number of live objects from a single allocation site (and an arbitrary number of these objects allocated on the call stack). In contrast, our analysis identify allocation sites that have the property that at most one object is live at any given time. In addition, the stack allocation transformation may require the compiler to lift the corresponding object allocation site out of the method that originally contained it to one of the (transitive) callers of this original allocating method [20]. The object would then be passed by reference down the call stack, incurring runtime overhead. 12 The static preallocation optimization enabled by our analysis does not suer from this drawback. The compiler transforms the original allocation site to simply acquire a pointer to the statically allocated memory; there is no need to move the allocation site into the callers of the original allocating method. Our combined liveness and incompatibility analysis and use of graph coloring to minimize the amount of memory required to store objects allocated at unitary allocation sites is similar in spirit to register allocation algorithms [6, Chapter 11]. However, register allocation algorithms are concerned only with the liveness of the local variables, which can be computed by a simple intraprocedural analysis. We found that obtaining useful liveness results for dynamically allocated objects is signicantly more di-cult. In particular, we found that we had to use a predicated analysis and track the ow of objects across procedure boundaries to identify signicant amounts of unitary sites. 5. CONCLUSIONS We have presented an analysis designed to simplify the computation of an accurate upper bound on the amount of memory required to execute a program. This analysis statically preallocates memory to store objects allocated at unitary allocation sites and enables objects allocated at compatible unitary allocation sites to share the same pre-allocated memory. Our experimental results show that, for our set of Java benchmark programs, 60% of the allocation sites are unitary and can be statically preallocated. More- over, allowing compatible unitary allocation sites to share semantically equivalent alternative is to perform method inlining. However, inlining introduces its own set of overheads. the same preallocated memory leads to a 95% reduction in the amount of memory required for these sites. Based on this set of results, we believe our analysis can automatically and eectively eliminate the need to consider many object allocation sites when computing an accurate upper bound on the amount of memory required to execute the program. We have also used the analysis to optimize the memory managment 6. ACKNOWLEDGEMENTS We would like to thank Wes Beebee and Scott C. Ananian for their useful advice on implementing the preallocation optimization in the MIT Flex compiler system [3], and Viktor Kuncak for proofreading early drafts of the paper. We also want to thank the anonymous referees for their valuable comments. 7. --R The cartesian product algorithm. MIT FLEX compiler infrastructure for Java. Static single information form. Program Analysis and Specialization for the C Programming Language. Modern Compiler Implementation in Java. Escape analysis for object oriented languages. Removing unnecessary synchronization in Java. The Real-Time Speci cation for Java Daniel Br Data ow analysis for software prefetching linked data structures in Java. Software caching and computation migration in Olden. Analysis of pointers and structures. Statically determining memory consumption of real-time Java threads A region inference algorithm. Compositional pointer and escape analysis for Java programs. --TR Compilers: principles, techniques, and tools Analysis of pointers and structures Efficiently computing static single assignment form and the control dependence graph Software caching and computation migration in Olden Points-to analysis in almost linear time Modern compiler implementation in Java A region inference algorithm Escape analysis for Java Escape analysis for object-oriented languages Removing unnecessary synchronization in Java Compositional pointer and escape analysis for Java programs New methods to color the vertices of a graph Region-based memory management in cyclone Data Flow Analysis for Software Prefetching Linked Data Structures in Java The Cartesian Product Algorithm --CTR Oukseh Lee , Kwangkeun Yi, Experiments on the effectiveness of an automatic insertion of memory reuses into ML-like programs, Proceedings of the 4th international symposium on Memory management, October 24-25, 2004, Vancouver, BC, Canada Oukseh Lee , Hongseok Yang , Kwangkeun Yi, Static insertion of safe and effective memory reuse commands into ML-like programs, Science of Computer Programming, v.58 n.1-2, p.141-178, October 2005 Samuel Z. Guyer , Kathryn S. McKinley , Daniel Frampton, Free-Me: a static analysis for automatic individual object reclamation, ACM SIGPLAN Notices, v.41 n.6, June 2006 Darko Marinov , Robert O'Callahan, Object equality profiling, ACM SIGPLAN Notices, v.38 n.11, November Chandrasekhar Boyapati , Alexandru Salcianu , William Beebee, Jr. , Martin Rinard, Ownership types for safe region-based memory management in real-time Java, ACM SIGPLAN Notices, v.38 n.5, May
interprocedural analysis;memory preallocation;static analysis
604155
A real-time garbage collector with low overhead and consistent utilization.
Now that the use of garbage collection in languages like Java is becoming widely accepted due to the safety and software engineering benefits it provides, there is significant interest in applying garbage collection to hard real-time systems. Past approaches have generally suffered from one of two major flaws: either they were not provably real-time, or they imposed large space overheads to meet the real-time bounds. We present a mostly non-moving, dynamically defragmenting collector that overcomes both of these limitations: by avoiding copying in most cases, space requirements are kept low; and by fully incrementalizing the collector we are able to meet real-time bounds. We implemented our algorithm in the Jikes RVM and show that at real-time resolution we are able to obtain mutator utilization rates of 45% with only 1.6--2.5 times the actual space required by the application, a factor of 4 improvement in utilization over the best previously published results. Defragmentation causes no more than 4% of the traced data to be copied.
INTRODUCTION Garbage collected languages like Java are making significant inroads into domains with hard real-time concerns, such as automotive command-and-control systems. However, the engineering and product life-cycle advantages consequent from the simplicity of Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. POPL'03, January 15-17, 2003, New Orleans, Louisiana, USA. Copyright c ACM 1-58113-628-5/03/0001 $5.00. programming with garbage collection remain unavailable for use in the core functionality of such systems, where hard real-time constraints must be met. As a result, real-time programming requires the use of multiple languages, or at least (in the case of the Real-Time Specification for Java [9]) two programming models within the same language. Therefore, there is a pressing practical need for a system that can provide real-time guarantees for Java without imposing major penalties in space or time. We present a design for a real-time garbage collector for Java, an analysis of its real-time properties, and implementation results that show that we are able to run applications with high mutator utilization and low variance in pause times. The target is uniprocessor embedded systems. The collector is therefore concurrent, but not parallel. This choice both complicates and simplifies the design: the design is complicated by the fact that the collector must be interleaved with the mutators, instead of being able to run on a separate processor; the design is simplified since the programming model is sequentially consistent. Previous incremental collectors either attempt to avoid overhead and complexity by using a non-copying approach (and are therefore subject to potentially unbounded fragmentation), or attempt to prevent fragmentation by performing concurrent copying (and therefore require a minimum of a factor of two overhead in space, as well as requiring barriers on reads and/or writes, which are costly and tend to make response time unpredictable). Our collector is unique in that it occupies an under-explored portion of the design space for real-time incremental collectors: it is a mostly non-copying hybrid. As long as space is available, it acts like a non-copying collector, with the consequent advantages. When space becomes scarce, it performs defragmentation with limited copying of objects. We show experimentally that such a design is able to achieve low space and time overhead, and high and consistent mutator CPU utilization. In order to achieve high performance with a copying collector, we have developed optimization techniques for the Brooks-style read barrier [10] using an "eager invariant" that keeps read barrier overhead to 4%, an order of magnitude faster than previous software read barriers. Our collector can use either time- or work-based scheduling. Most previous work on real-time garbage collection, starting with Baker's algorithm [5], has used work-based scheduling. We show both analytically and experimentally that time-based scheduling is superior, particularly at the short intervals that are typically of interest in real-time systems. Work-based algorithms may achieve short individual pause times, but are unable to achieve consistent utilization. The paper is organized as follows: Section 2 describes previous approaches to real-time collection and some of the common problems encountered. Section 3 presents an informal overview of our collector. Section 4 analyzes the conditions under which real-time bounds can be met. Section 5 analyzes the space requirements of our collector and compares them to other real-time collectors. Section 6 describes the implementation of the collector, and Section 7 presents our experimental results. Section 8 discusses issues in real-time garbage collection that are raised by our work. Finally, we present our conclusions. 2. PROBLEMS WITH PREVIOUS WORK Previous approaches to real-time garbage collection have generally suffered from a variety of problems. In this section we will describe these problems. 2.1 Fragmentation Early work, particularly for Lisp, often assumed that all memory consisted of CONS cells and that fragmentation was therefore a non- issue. Baker's Treadmill [6] also only handles a single object size. Johnstone [17] showed that fragmentation was often not a major problem for a family of C and C++ benchmarks, and built a non-moving "real-time" collector based on the assumption that fragmentation could be ignored. However, these measurements are based on relatively short-running programs, and we believe they do not apply to long-running systems like continuous-loop embedded devices, PDAs, or web servers. Fundamentally, this is an average-case rather than a worst-case assumption, and meeting real-time bounds requires handling worst-case scenarios. Furthermore, the use of dynamically allocated strings in Java combined with the heavy use of strings in web-related processing is likely to make object sizes less predictable. Dimpsey et al. [14] describe the compaction avoidance techniques in the IBM product JVM, which are based on Johnstone's work. They show that these techniques can work quite well in prac- tice. However, when compaction does occur it is very expensive. Siebert [23] suggests that a single block size can be used for Java by allocating large objects as linked lists and large arrays as trees. However, this approach has simply traded external fragmentation for internal fragmentation. Siebert suggests a block size of bytes; if there are a large number of 8-byte objects, internal fragmentation can cause a factor of 8 increase in memory requirements. 2.2 High Space Overhead To avoid the problems resulting from fragmentation, many researchers have used copying algorithms [5, 10] as the basis for real-time collection. Such collectors typically have a high space overhead. First of all, when a full collection is performed a complete semi-space is required for the target data, so the minimum space overhead is a factor of 2. Secondly, space is required so that the mutator can continue to run (and allocate) while the collector operates. In order to achieve good mutator utilization while the collector is running, a space overhead of a factor of 3-5 is typical [12]. For Johnstone's non-copying collector [17], space overhead is often a factor of 6-8. 2.3 Uneven Mutator Utilization Much of the literature has focused on maximum pause times induced by collection, but in fact an equally important metric is mutator utilization (the fraction of the processor devoted to mutator execution). If there is a period of low utilization, the mutator may be unable to meet its real-time requirements even though all individual pause times are short. Uneven utilization is endemic to collectors that use a to-space invariant (that is, the mutator only sees objects in to-space). Such collectors are implemented with a read-barrier that checks if an object being accessed is in from-space, and if so, copies it into to-space before returning the pointer to the mutator. There is therefore a tight coupling between the operations of the mutator and the scheduling of operations by the collector. Examples are Baker's copying algorithm [5] which uses an explicit read-barrier, and the Appel-Ellis-Li collector [2], which uses virtual memory protection. Both of these collectors have the property that mutator utilization is very poor right after the collector starts, when the "fault rate" is high. An alternative is to use a replicating collector which maintains a from-space invariant, and to perform mutator updates on both from-space and to-space, as in the ML collectors of Nettles and O'Toole [21] and Cheng and Blelloch [12]. However, this requires a fairly costly replication for all updates, rather than a simple write barrier on pointer updates. As a result, the strategy is better suited to mostly functional languages like ML, and less well-suited to imperative languages like Java. 2.4 Inability to Handle Large Data Structures Some algorithms attempt to avoid the factor of 2 space overhead in copying collectors by doing the work incrementally - collecting only a portion of the heap at a time. The most notable example is the Train algorithm [16]. Recently, Ben-Yitzhak et al. [7] have implemented a parallel incremental collector that operates on a fixed fraction of the heap at a time to minimize pause times for large heaps. The fundamental problem with all algorithms that attempt to collect a subset of the heap at a time is that they can be defeated by adversarial mutators. Large cyclic structures, objects with high in- degree, and high mutation rates are ways to force such collectors to perform work without fixed bound. 3. OVERVIEW Our collector is an incremental uni-processor collector targeted at embedded systems. It overcomes the problems of the previous section by using a hybrid approach of non-copying mark-sweep (in the common case) and copying collection (when fragmentation occurs). The collector is a snapshot-at-the-beginning algorithm that allocates objects black (marked). While it has been argued that such a collector can increase floating garbage, the worst-case performance is no different from other approaches and the termination condition is easier to enforce. Other real-time collectors have used a similar approach. 3.1 Overview of Our Collector Our collector is based on the following principles: Segregated Free Lists. Allocation is performed using segregated lists. Memory is divided into fixed-sized pages, and each page is divided into blocks of a particular size. Objects are allocated from the smallest size class that can contain the object. Mostly Non-copying. Since fragmentation is rare, objects are usually not moved. Defragmentation. If a page becomes fragmented due to garbage collection, its objects are moved to another (mostly full) page. Read Barrier. Relocation of objects is achieved by using a forwarding pointer located in the header of each object [10]. A read barrier maintains a to-space invariant (mutators always see objects in the to-space). Incremental Mark-Sweep. Collection is a standard incremental mark-sweep similar to Yuasa's snapshot-at-the-beginning algorithm [24] implemented with a weak tricolor invariant. We extend traversal during marking so that it redirects any pointers pointing at from-space so they point at to-space. There- fore, at the end of a marking phase, the relocated objects of the previous collection can be freed. Arraylets. Large arrays are broken into fixed-size pieces (which we call arraylets) to bound the work of scanning or copying an array and to avoid external fragmentation caused by large objects. Since our collector is not concurrent, we explicitly control the interleaving of the mutator and the collector. We use the term collection to refer to a complete mark/sweep/defragment cycle and the term collector quantum to refer to a scheduler quantum in which the collector runs. 3.2 Object Allocation and Fragmentation Allocation is performed using a simple segregated free-list ap- proach. When a free list is empty, a new page is chosen, broken into equal-size blocks, and the resulting blocks are placed onto that list. Note that the allocator page size is not necessarily the same as the operating system page size. We use KB. Internal fragmentation is regulated by using a geometric progression list sizes, such that if there is a free list whose blocks are of size s, the next larger size is s(1 generally choose resulting in worst-case fragmentation of 12.5%. How- ever, the measured internal fragmentation in our collector has never exceeded 2% at Most programs obey a "locality of size" property, that is, the object sizes allocated frequently in the past will tend to have a high correlation with object sizes allocated in the future. Therefore, we expect that in the normal case, the garbage collector will find unused blocks in a particular size class that can simply be re-used. Only in relatively rare cases will object allocation cause external fragmentation. Because our collector performs defragmentation, we can choose a that results in low internal fragmentation, but allows a relatively large number of size classes. Most collectors based on segregated lists must be concerned about external fragmentation, and therefore keep the number of size classes small by choosing leading to power-of-two size classes with high internal fragmentation. The only overhead to decreasing is that we may need to have one under-utilized page per size class. Assuming a 4-byte word size, the number of size classes C is bounded by The free lists are actually kept as chains of pages, rather than chains of blocks. Each page has an associated mark array. The allocation cursor is actually a pair pointing to a page and a block within the page. This organization allows formatting of pages to be performed lazily and therefore avoids a full sweep of the memory on each collection. 3.3 Defragmentation At the end of the sweep phase, we determine whether there is a sufficient number of free pages to allow the mutator to continue to execute for another collection cycle without running out of mem- ory, assuming a worst-case selection of object sizes by the mutator (that is, we assume that the mutator will act adversarially to maximize external fragmentation). If the number of free pages drops below this threshold, we perform a defragmentation that will free at least that many pages. Defragmentation is performed as follows: for each page, we compute the number of live objects. Then the pages within each size class are sorted by occupancy. Finally, we move objects from the least occupied to the most occupied pages within a list (note that this never causes new pages to be allocated; it only transfers objects between pages within a size class). 3.4 Read Barrier We use a Brooks-style read barrier [10] to maintain a to-space invariant in the mutator: each object contains a forwarding pointer that normally points to itself, but when the object has been moved, points to the moved object. Our collector thus maintains a to-space invariant, but the sets comprising from-space and to-space have a large intersection, rather than being completely disjoint as in a pure copying collector. While we use a read barrier and a to-space invariant, our collector does not suffer from variations in mutator utilization because all of the work of finding and moving objects is performed by the collector. Read barriers, especially when implemented in software, are frequently avoided because they are considered to be too costly. We will show that this is not the case when they are implemented carefully in an optimizing compiler and the compiler is able to optimize the barriers. A fundamental design choice for the read barrier is whether it is "lazy" or "eager". A lazy barrier has the property that registers and stack cells can point to either from-space or to-space objects, and the forwarding operation is performed at the time of use. An eager barrier, on the other hand, maintains the invariant that registers and stack cells always point into to-space: the forwarding operation is performed eagerly as soon as the quantity is loaded. Eager barriers have a major performance advantage in that if a quantity is loaded and then dereferenced many times (for instance, a reference to an array of integers loaded and then used in a loop), the eager barrier will only perform the forwarding operation once, while the lazy barrier will perform the forwarding operation for every array access. Of course, there is a cost: because the eager invariant is more strict, it is more complex to maintain. Whenever the collector moves objects, it must find all outstanding register and stack cells and re-execute the forwarding operation on them. We apply a number of optimizations to reduce the cost of read barriers, including well-known optimizations like common subexpression elimination, as well as special-purpose optimizations like barrier-sinking, in which we sink the barrier down to its point of use, which allows the null-check required by the Java object dereference to be folded into the null-check required by the barrier (since the pointer can be null, the barrier can not perform the forwarding unconditionally). This optimization works with whatever null-checking approach is used by the run-time system, whether via explicit comparisons or implicit traps on null dereferences. The important point is that we avoid introducing extra explicit checks for null, and we guarantee that any exception due to a null pointer occurs at the same place as it would have in the original program. The result of our optimizations is a mean cost of only 4% for the read barriers, as is shown in Section 7. 3.5 Arraylets Large objects pose special problems for garbage collectors. In copying collectors, if they are repeatedly copied, the performance penalty can be very high. In non-copying collectors, external fragmentation can make it impossible to allocate a large object. For instance, a single small object in the middle of the heap can make it impossible to satisfy a request for an object slightly larger than half the heap. Furthermore, in incremental and real-time collectors, large objects pose an additional problem because they can not be moved in a reasonably bounded amount of time. Siebert [23] has suggested using fixed-size blocks of 32 or 64 bytes for all object allocations, and creating large arrays by using a tree structure. Unfortunately, this requires rewriting every array access as a loop, and can have a severe performance penalty for array-intensive programs since common loop optimizations are defeated Our mostly non-copying collector allows a different contiguously, and large arrays as two-level structures consisting of a sequence of arraylets. Each arraylet (except the last) is of a fixed size, which is chosen to be a power of two so that the division operation required for indexing can be implemented with a shift. Our arraylet size is We therefore have the advantage of never needing to allocate large objects contiguously, and are therefore not subject to external fragmentation. On the other hand, access to array elements is still efficient, and when combined with strip-mining optimizations is usually as efficient as contiguous layout. The arraylet size must be chosen carefully and there are some tradeoffs involved. With a sufficiently large size, one can assume that all objects will be contiguous and smaller than the arraylet size, simplifying the implementation. The maximum array size that can be represented with a single root of size is 2 =4, or 1 MB in our case. However, if necessary we can simply allocate an entire block to be the root of the array, because the wasted space at the end of the block will be negligible compared to the total size of the array. Thus we can accommodate arrays of size up to =4 or 8 MB. For larger objects we can scan the free block list for the necessary number of contiguous free blocks. If the system must be able to return objects larger than 8 MB in real time, the maximum size can be tuned by varying and . All arrays are represented in a uniform manner: arraylet pointers are laid out in reverse order to the left of the array header. If the array is contiguous, there is only one arraylet pointer and it points to the data field to the right of the header. Arraylets are implemented in the system presented in this paper, but not yet highly optimized. However, we can use Arnold's thin guards [3] to eliminate the indirection for array types that do not exist as arraylets, so that most array accesses will operate at full speed. For arraylets, we can strip-mine regular iterations to the ar- raylet size. Thus arraylets should only suffer performance penalties when they are used and when the access pattern is irregular. 3.6 Open Issues The main issue we have not addressed in our collector is making stack processing incremental. This is an issue in two parts of the system: root scanning and maintenance of the eager invariant for the read barrier. Stacklets [13] break stacks into fixed-size chunks to quantize the associated work. However, they only provide a partial solution: if we only copy the top stacklet of the running thread and return to the mutator, the mutator can then begin either pushing or popping at a very high rate. A high rate of popping is problematic because the collector must halt the mutator while it copies each popped stacklet, and if many stacklets are popped in a short interval the mutator utilization will temporarily become very low. It can also force the memory consumption of the stack to double (due to the snapshots). A high rate of pushing is problematic because the collector may have trouble keeping up with the mutator. In this case, the solution is to model stack pushes that enter new stacklets to be modelled as allocation, and to use the associated methods for measuring and controlling allocation rates. For the benchmarks available to us the stacks remained small, and the limiting factor in pause time was the resolution of the operating system clock. Therefore the implementation presented in this paper does not include stacklets. We intend to address the issue of incrementalizing stack operations in future work, in particular by exploring alternative write barriers and termination conditions. 4. REAL-TIME SCHEDULING In this section we derive the equations for CPU utilization and memory usage for our collector using two different scheduling poli- cies: one based on time, the other based on work. We can define the real-time behavior of the combined system comprising the user program and our garbage collector with the following parameters: is the instantaneous memory allocation rate at time (MB/s). is the instantaneous garbage generation rate at time (MB/s). P is the garbage collector processing rate (MB/s). Since ours is a tracing collector, this is measured over live data. time is on an idealized axis in which the collector runs infinitely fast - we call this mutator time. As a practical matter this can be thought of as time measured when the program has sufficient memory to run without garbage collecting. By convention, upper-case letters refer to primitive quantities; lower-case quantities are derived. The only other primitive parameters required are the relative rates of mutator and collector. From these basic parameters we can define a number of important characteristics of the application relevant to real-time garbage collection. The amount of memory allocated and garbage generated during the interval (1 ; 2) are A ? ()d (1) The maximum memory allocation for an interval of size is and the maximum memory allocation rate is a The instantaneous memory requirement of the program (exclud- ing garbage, overhead, and fragmentation) at time is 4.1 Mapping Between Mutator and Real Time Now consider a realistic execution in which the collector is not infinitely fast. Execution will consist of alternate executions of mutator and collector. Time along real time axis will be denoted with the variable t. The function (t) ! maps from real to mutator time, where t. Functions that operate in mutator time are written f ? () while functions that operate in real time are written f(t). The live memory of the program at time t is thus and the maximum memory requirement over the entire program execution is 4.2 Time-Based Scheduling Time-based scheduling interleaves the collector and mutator using fixed time quanta. It thus results in even CPU utilization but is subject to variations in memory requirements if the memory allocation rate is uneven. A time-based real-time collector has two additional fundamental parameters: QT is the mutator quantum: the amount of time (in seconds) that the mutator is allowed to run before the collector is allowed to operate. CT is the time-based collector quantum (in seconds of collection time). For the time being, we assume that the scheduler is perfect, in the sense that it always schedules the mutator for precisely QT sec- onds. A typical value for QT might be 10 ms. In Section 7 we will show how close we are able to get to this ideal in practice. Cheng and Blelloch [12] have defined the minimum mutator utilization or MMU for a given time interval t as the minimum CPU utilization by the mutator over all intervals of width t. From the parameters QT and CT we can derive the MMU as QT where the first term in the numerator corresponds to the number of whole mutator quanta in the interval, and the x term corresponds to the size of the remaining partial mutator quantum, which is defined as CT While this expression is fairly awkward, as the number of intervals becomes large, it reduces to the straightforward utilization expres- sion lim QT A plot of the MMU for a perfectly scheduled system using 10 millisecond mutator and collector quanta is shown in Figure 1. It is important to note that at the small time scales of interest in real-time systems, the x term is very significant: at ms the MMU is 1=2 (the maximum value), while at to 1=3. Also, the higher the scheduling frequency of the collector, the more quickly it converges to the theoretical limit. In practice, at large time intervals uT (t) is only a lower bound on the utilization, since in most cases the collector only runs intermittently Utilization Figure 1: MMU for a perfectly scheduled time-based collector. Now consider the space utilization of a time-scheduled collector. Since we are assuming the collection rate is constant, at time t the collector will run for m(t)=P seconds to process the m(t) live data (since our collector is trace-based, work is essentially proportional to live data and not garbage). In that time, the mutator will run for QT seconds per CT seconds executed by the collector. Therefore, in order to run a collection at time t, we require excess space of QT CT We further define the maximum excess space required as Freeing an object in our collector may take as many as three collections: the first is to collect the object; the second is because the object may have become garbage immediately after a collection began, and will therefore not be discovered until the following collection cycle; and the third is because we may need to relocate the object in order to make use of its space. The first two properties are universal; the third is specific to our approach. As a result, the space requirement of our collector paired with a given application (including unreclaimed garbage, but not including internal fragmentation) at time t is and the overall space requirement is However, the expected space utilization is only m+ eT , and the worst-case utilization is highly unlikely; this is discussed in more detail below. 4.3 Work-Based Scheduling Work-based scheduling interleaves the collector with the mutator based on fixed amounts of allocation and collection. A work-based real-time collector is parameterized by QW is the work-based mutator quantum: the number of MB the mutator is allowed to allocate before the collector is allowed to run. CW is the work-based collector quantum: the number of MB the collector must process each time the mutator yields to it. Then the excess space required to perform a collection at time t is and the excess space required for a collection over the entire execution is Note therefore that it must be the case that QW < CW or else the space may grow without bound. Consequently, the space requirement of the program at time t is and the space requirement for the entire program execution is 4.3.1 Work-based CPU Utilization Computing mutator CPU utilization when collector scheduling is work-based is inherently problematic, because the operations of the mutator may affect the amount of time allocated to the mutator. In other words, there is a time dilation from t to that is linear and fixed in time-based scheduling but variable, non-linear, and application-dependent in work-based scheduling. Due to these problems it is not possible to obtain a closed-form solution for the utilization. We begin by noting that each mutator pause involves the collector processing CW memory at rate P . Hence each mutator pause will be In our simplified model, this will be a constant. Each mutator quantum will involve allocation of QW memory, so the minimum total mutator time i for i quanta will be given by the minimum i that solves the equa- tion As the time interval increases, the maximum amount of allocation in that time does not decrease, so ? ( ) is a monotonically increasing function and hence i > i 1 . Therefore, the solution to (19) can be found with an iterative method. This is analogous to the iterative solution to rate monotonic scheduling in real-time systems [18]. Let k be the largest integer such that kd +k t (20) so the minimum mutator utilization over an interval of size t is where the first term in the numerator is the time taken by k whole mutator quanta in the interval and the y term corresponds to the size of the remaining partial mutator quantum (if any), which is defined as d) (22) In a work-based collector, utilization will be zero for t < d. In fact, any large allocation of nQW bytes will lead to zero utilization for time nd. This simply expresses analytically the fact that in a work-based collector, there is a much larger burden on the programmer to achieve real-time bounds by making sure that memory allocation is sufficiently discretized and evenly spaced. 4.4 Mutation In addition to allocation, the other form of work by the mutator that can interact with the operation of the collector is the actual heap mutation. Mutation can be thought of as an alternate way for roots to be added, along with stack scanning. We impose the following division of labor between the mutator and the collector: the mutator's write barrier is responsible for making sure that only non-null, unmarked objects are placed into the write buffer. This ensures that the work performed by the collector attributable to mutation is O(N), where N is the number of objects, while keeping the overhead of the write barrier constant. The collector periodically processes the write buffer and treats the entries like any other potential roots: it marks the objects gray and places them into the work queue for scanning. Note that in the worst case, the work queue can reach size N . Now we must account for mutation in our formulas for collector performance, because mutation consumes memory just like allocation by the mutator. To do this, we simply redefine A ? ( ) to comprise both directly allocated memory and indirectly allocated memory due to mutation, where each mutation consumes memory of the size of one object pointer. If desired, the formulas could all be broken up to account for each kind of space consumption individually 4.5 Sensitivity to Parameters The degree to which each collector is able to meet its predicted behavior will depend quite strongly on the accuracy of the parameters which are used to describe the application and the collector strategy. These are the application parameters A ? (t) and G ? (t), and the collector parameters, P and either QT and CT or QW and CW for the time-based or work-based collectors, respectively. In practice, the user describes the application in terms of its maximum memory consumption m and its maximum allocation rate a ? ( ). 4.5.1 Sensitivity of the Time-based Collector The CPU utilization rate uT of the time-based collector is strictly dependent on the quantization parameters QT and CT , so the utilization will be very steady (depending only on implementation- induced jitter, and subject to the minimum quantization that the implementation can support). On the other hand, the space required to perform a collection eT (t) which determines the total space sT required to run the application is dependent on both the maximum memory usage by the application and the amount of memory allocated over an interval. Thus if the user under-estimates either m or a ? , then the total space requirement sT may grow arbitrarily. In particular, time-based collectors are subject to such behavior when there are intervals of time in which the allocation rate is very high. Furthermore, the estimate of the collector processing rate P must also be a lower bound on the actual rate. However, the space consumed by the application is over a relatively long interval of time, namely the amount of time the application runs while a single collection takes place or QT CT and therefore the allocation rate in that time will typically be close to the average allocation rate of the program and the variation will tend to be low. Therefore, to a first order, a time-scheduled collector will meet both its time and space bounds as long as the user estimate of m is correct. 4.5.2 Sensitivity of the Work-based Collector In the work-based collector, the space overhead for collection eW (t) is straightforward to compute, and it will be accurate as long as the user estimate of the total live memory m is accurate. On the other hand, the CPU utilization rate for a given interval t depends on the allocation rate a ? () where t as well as on the collector processing rate P . The interval t is the interval over which we require real-time performance, for instance 20 ms. Since this interval is small, the peak allocation rate for this interval size is likely to be quite high, as we will show in Section 7. Thus we expect that the CPU utilization of the work-based collector will vary considerably with the allocation rate. In particular, note that the in which the time-based collector is dependent on allocation rate is on a much larger scale, namely the amount of time for a garbage collection. Therefore, to a first order a work-scheduled collector will meet its space bound as long as the user estimate of m is correct, but its CPU utilization will be heavily dependent on the allocation rate over a real-time interval. 4.5.3 A Robust Collector A robust real-time collector should primarily use a time-based scheduling policy, but as memory resources become scarce (indi- cating that the input parameters to the collector may have been degradation is desirable then the collector should begin slowing down the allocation rate. This can be done in a number of ways. A classical approach in real-time systems is to separate threads into priority classes, and as the system becomes unable to meet real-time bounds, low-priority threads are successively suspended [15]. Another approach is to begin using a hybrid strategy which becomes progressively more work-based as the collector comes closer to its memory limit. This approach will not guarantee that real-time bounds are met, but is robust even if the allocation rate and memory utilization of the top-priority threads have been underestimated. We have not done this; instead we have implemented pure time-based and work-based collector scheduling policies, and in Section 7 we compare them experimentally so that the tradeoffs can be evaluated. 5. SPACE COSTS We now compare the relative space costs of the different types of real-time collectors. Since purely non-copying algorithms are subject to high (and often unbounded) fragmentation, they are not suitable for use in true real-time systems. Since our collector has a significantly different architecture from copying real-time collectors, its space bounds are quite different. Incremental semispace copying collectors have an inherent space requirement of 2 (m+ e) is the maximum live heap memory, e is the space required to allow allocation to proceed during a single garbage collection, f is the maximum stack depth, and g is the maximum size of the global variable area. Our collector has an expected-case space requirement of m+e+ f +g and a worst-case cost of m+3e+f +g+N , where N is the maximum number of uncollected objects (live or dead). The extra 2e+N space is incurred when: a data structure of size close to m is freed immediately after the beginning of a collection (the collector must run again to find it, requiring e extra space); all garbage found causes external fragmentation (requiring an extra collection cycle to relocate the data and make it available, which requires another e extra space); and the program traverses the heap in a pessimal fashion (forcing a maximum number of pointers to be pushed onto the work queue for each mark operation, which requires N extra words of memory). There are two things to note about the worst-case memory requirements of our collector. First, the difference in the worst-case between our collector and a copying collector is e The space e required to run a collection is typically lower than the maximum live memory m (and can be tuned). The maximum number of uncollected objects is the maximum uncollected space divided by the average object size in words A, or (m + e)=A. Since A is typically on the order of 8 for Java programs, N is typically small relative to m. Thus for most programs, the worst-case space requirements of our collector will still be smaller than those of a copying semi-space collector. Second, the likelihood of more than one of these worst-case scenarios occurring concurrently is very low. In practice, this means that the amount of memory devoted to the system can be varied between the expected- and worst-case space requirements depending on the acceptable failure rates for the system in question. These figures do not include the extra space overhead required to bound internal fragmentation with the parameter , which we have set to 1=8 in our implementation. This parameter can be further reduced at the expense of potentially requiring additional partially used blocks for the extra size classes. For 1=8, the number of size classes and the measured fragmentation does not exceed 2% for our benchmarks. We do not include the space overhead due to the forwarding pointer, since all high-performance copying algorithms also use a forwarding pointer. Bacon et al. [4] have shown that an extra header word leads to a 14% increase in space utilization (assuming one uses an object model with a single-word header as a basis). 6. IMPLEMENTATION ISSUES We implemented a real-time collector based on the ideas introduced in the previous sections. Implementing the collector required both coding the collector proper as well as adding read barriers to the compiler. In certain cases, it was infeasible to introduce a read barrier. Omitting the barrier is correct as long as we pin the object to guarantee that it never moves. Fortunately, most objects that fall into this category are run-time data structures that are immor- tal. By maintaining a separate immortal heap, we can omit moving such objects without introducing any fragmentation. 6.1 Triggering a Collection In the worst-case analysis of the collector, we can run the program in space m is the amount of maximum live data and e is the space required to run a single collection or eW depending on the scheduling policy). However, executing with these boundary conditions will result in the collector always running. Even if the application utilization is at 50% during a col- lection, this will lead to an overall slowdown of the program by a factor of 2 which is likely unacceptable. For comparison, running a stop-the-world collector at m will result in a virtually infinite slow- down. The solution is to provide headroom so that the program can run for some time before a collection must occur. For example, if enough headroom is provided so that the collector runs only 25% of the time, then the overall utilization rises to 87.5%. In our implementation, we have set the headroom to be e. A collection is thus triggered when the amount of memory in use is m+ e. 6.2 Control of Interleaving Ideally, in the time-scheduled collector we would use a precise timer to control the scheduling of the mutator and collector pro- cesses. Unfortunately, AIX does not allow user-level access to timers with a resolution of less than 10 ms. Therefore, we must 201.compress 202.jess 209.db 213.javac 222.mpegaudio 227.mtrt 228.jack GEO. Barrier Lazy Eager Figure 2: Relative overhead for lazy and eager read barriers in the Jikes RVM optimizing compiler. use an approximate method based on polling. The mutator polls the timer on the slow path of allocation (when it moves to a new page) or when the mutation buffer fills up. This keeps the polling out of the fast, in-lined cases, but is subject to some inaccuracy. However, as a practical matter, this is acceptable because we are increasing mutator utilization and doing it at a time when resource consumption is low. The collector on the other hand performs work in progressively finer work quanta as it gets closer to the end of its time quantum CT . When the time consumed is close to or exceeds the quantum, the mutator is resumed. The work-scheduled collector is also subject to some inaccuracy because scheduling is only performed in the slow path through the allocator, even though a precise count of bytes allocated is kept on the fast (inlined) path. 7. MEASUREMENTS We present empirical results in this section. All results were obtained on an IBM RS/6000 Enterprise Server F80 running AIX 5.1. The machine has 4 GB of main memory and six 500 MHz processors each with 4 MB of L2 cache. The virtual machine was run on a single CPU. Experiments were run on an unloaded multiprocessor so that operating system processes ran on different CPUs to avoid perturbing our measurements. Our system is implemented as part of the Jikes Research Virtual Machine (RVM) version 2.1.1 at the IBM T.J. Watson Research Center [1]. All methods were compiled with the optimizing compiler (since the system is real-time, adaptive compilation is turned off). Measurements were started after a dummy run of the benchmark which forces all methods to be compiled. Because the optimizing compiler often requires more space than the applications themselves, the heap is resized after compilation to the heap sizes given. In this way, we measure the intrinsic properties of the application rather than of the compilation. 7.1 Read Barrier Costs Since our collector makes use of read barriers, and read barriers are often considered prohibitively expensive, we begin by showing that our optimized implementation of the Brooks-style read barrier with the eager invariant can achieve very low overhead. We have implemented both lazy and eager barriers in the IBM Jikes RVM [1] and present their relative performance, both to each other and to a system without barriers. Read barriers were initially considered so expensive as to only be practical with hardware support, as was done in a number of commercially available machines such as the Symbolics Lisp Machine [20]. The first implementation we know of the Brooks read barrier is that by North and Reppy [22] in their concurrent collector for Pegasus ML. However, they do not measure barrier cost but only the total cost. Zorn [25] compared the cost of hardware, software, and page protection-based read barriers, and determined that software read barriers were much better than protection based read barriers, but still cost about 20%. Zorn measured Baker-style read barriers that require on average four ALU/branch instructions. The straightforward implementation of our read barrier requires a compare, a branch, and a load. However, in most cases we are able to optimize away the compare and branch, and to perform common subexpression elimination on the remaining loads. The results are shown in Figure 2. The geometric mean of the lazy barrier overhead is 6%, with a maximum of 11% overhead for javac. This is significantly better than previous results, but still not acceptable in our opinion. On the other hand, the geometric mean of the eager barrier overhead is only 4%, with a maximum of less than 10% for compress. The mean overhead is an order of magnitude better than previous results, and in our opinion low enough for incorporation into a highly aggressive optimizing compiler, given the potential benefits in space utilization and incrementality, as shown in the following sections. On the other hand, the variance is still too large: we do not consider the slowdown for compress to be acceptable. It turns out that the problem with compress is due to a shortcoming in the optimizer which is preventing it from performing loop-invariant code motion. Once this bug is fixed, we expect the overhead in compress to drop below 5%. 7.2 Collector Performance We tested our real-time collector on the SPECjvm98 benchmarks and a synthetic fragger benchmark designed to act adversarially: it allocates at a high rate, uses a maximal amount of memory, and creates maximal fragmentation. Of the SPEC benchmarks, mpegaudio was excluded because it performed little allocation and would have no necessary garbage collections. In addition, compress was excluded because our current implementation does not fully support arraylets and compress makes frequent use of large arrays. Table presents overall results for the benchmarks when run with a target utilization uT ms, and a collector quantum ms. For each program, we include the high watermark of live data and the maximum memory actually used. The average allocation rate is the allocation rate over the entire execution a ? (T ) whereas peak allocation measures the maximum allocation rate during a mutator quantum a ? (QT ). The collection rate P shows how quickly the collector can trace through the live data of that application. For each program, we show the target application utilization and the worst actual utilization that occurred. Average and maximum pause times are in- cluded. Finally, we show the total amount of moved and traced data as an indication of how much defragmenting work is necessary. All of our benchmarks had a similar amount of maximum live Maximum Memory Allocation Rate Coll. Min. Pause Time Benchmark Live Used Ratio Avg. Peak Rate Util. Avg. Max. Copied Traced javac 34 69.3 2.0 14.2 258.0 39.4 0.446 11.3 12.3 12.1 299.4 jess 21 52.4 2.5 19.2 94.2 53.2 0.441 11.0 12.4 2.0 324.0 jack mtrt 28 44.4 1.6 9.6 114.3 45.1 0.446 11.0 12.3 2.3 176.9 db fragger 20 47.7 2.4 17.5 185.9 38.4 0.441 11.0 12.4 12.6 307.0 Table 1: Overall Results for the Time-Based Collector. T is the total run-time of the program. Target mutator quantum ms, target collector quantum target utilization is 0.45, ms. All sizes in MB, all rates in MB/s, all times in milliseconds. data (between 20 and 30 MB) but they required anywhere from 45 to 70 MB at some point in their execution. The variance in space usage arises from several factors. The heap size requirement appears to be primarily correlated to the average allocation rate - for instance note the high allocation rate for jess and the correspondingly high maximum memory ratio. The measured values for the rate of collection P range from 36.7 to 57.4 MB/s. This is primarily due to variation in pointer density in the data structures of the programs, and shows that while our theoretical assumption that P is constant does not introduce large error, it is nonetheless significant. Average allocation rates ranged from 9.6 to 19.2 MB/s while peak allocation rates ranged from 82.1 to 258 MB/s. These spikes in allocation rates demonstrate the infeasibility of using a purely work-based scheduling policy for the goal of maintaining a high minimum utilization. For all benchmarks, we ran the collector with a target application utilization of 0.45 and obtained a minimum utilization of 0.441 to 0.446. Thus the maximum deviation is only 2%. The last two columns in Table 1 show the amount of data copied and traced over the entire execution of the program. The maximum amount of data copied is about 4% of the data traced (interest- ingly, javac introduces about the same amount of fragmentation as fragger, which we wrote specifically as a fragmenting adversary program). Note that the amount of data traced by our collector is roughly comparable to the amount of data that would be copied by a semi-space collector, although such a collector would require a significantly larger heap to obtain the same performance. Table 2 summarizes the results when we changed from time- to work-based collector scheduling. The table only shows those quantities that changed appreciably from the time-based collector. Also, since the utilization at our target t was often zero, we also give the utilization for an interval of 50 ms. Even at this longer interval, the best case is only half the target value. While average pause times are considerably lower, the maximum pause times for the work-based collector are much higher (up to 92 ms for fragger) and at ms the minimum mutator utilization is very poor. These measurements confirm experimentally the analytic results from Section 4. 7.3 Detailed Evaluation We examine three benchmarks in detail: mtrt, javac, and fragger. They were chosen because they represent a range of difficulty for the collector. For both time- and work-based schedul- ing, we compare the distribution of pause times, the utilization over time, the MMU over a full range of intervals, and the space consumption of these three benchmarks. The pause time distributions are shown in Figures 3 through 8. These figures show that our time-based collector achieves highly uniform pause times, with the majority of all pauses at 12.2 ms. By comparison, the work-based collector has a much more uneven distribution (note the differences in scale on both the x and y axes). The work-based collector has considerably shorter average pauses, but the distribution is much more uneven and there is a much longer "tail" in the distribution. The adversarial nature of fragger is clearly seen in Figure 8: while the work-based collector keeps the vast majority of pauses below 10 ms, the tail extends to almost 100 ms. If one only considered maximum pause time, the pause time distribution graphs would give the impression that utilization under the work-based collector would be about 2-3 times worse for non- adversarial programs. However, Figures 9 through 14 show that for a short interval on the order likely to be of interest in real-time systems (22.2 ms), work-based scheduling produces very large variance in mutator utilization, often dropping to almost zero. This can easily occur when a single large object is allocated, forcing the collector to perform many collector quanta in a row. On the other hand, the time-based collector performs extremely well. There is a small amount of jitter due to slight imprecision in our work predictor, but utilization during collection is almost exactly on or above the target. For mtrt and javac, after the first collection the application enters a fairly regular cycle in which the concurrent collector is off for 1=3 to 1=2 of the time. However, the adversarial nature of fragger is once again apparent: in the time-based collector, it collects continuously, and in the work-based collector the utilization frequently drops to zero. Figures through 17 show the minimum mutator utilization (MMU [12]) of both time- and work-based collectors superimposed on one graph. The time scale ranges from 10 milliseconds to the length of the program run. At small time scales, the MMU for the time-based collector almost precisely matches the shape of the perfect curve shown in Figure 1. At larger time scales, the effect of the mutator being off come into play, and utilization rises above the target. MMU for the work-based collector is much lower, and interestingly has much less of a "sawtooth" shape. At the time scale of a small number of collections, the work-based collector may briefly exceed the time-based collector in utilization, but as the number of collections becomes large they appear to approach the same asymptotic cost. We compute the MMU precisely below using a quadratic algorithm; above 10 seconds we use an approximate algorithm which has very small error. Cheng and Belloch [12] used a sampling technique and only plotted the MMU for certain values Minimum Pause Benchmark Utilization Time uW (t) uW (50ms) Avg. Max. jess 0 0.180 3.1 26.2 jack mtrt Table 2: Overall Results for the Work-Based Collector. Mutator allocation quantum processing quantum ms. All times in milliseconds of t, thus hiding some of the irregularity of the curve. Blackburn et al. [8] use a variant of the MMU which produces a monotonic curve which is strictly derivable from the MMU curve. This definition of utilization is appropriate at the large time scales at which these collectors operate (several hundred milliseconds and above) but hides information that is important at short time intervals of interest in true real-time systems. Finally, Figures show space consumption over time for both time- and work-based collectors. The maximum live data and the collector trigger threshold are also shown. What is surprising is how little difference there is between time- and work-based memory consumption given the large differences in behavior seen in the previous graphs. There is some variation, but there is no clear winner: each type of scheduling sometimes requires slightly more or slightly less space, but the shape of the space curves is very similar and only slightly translated. 8. REAL-TIME ISSUES In Section 2 we outlined some of the problems common to real-time collectors. The design choices made in our collector avoid these problems in the following ways: Fragmentation is avoided through a combination of means: internal fragmentation is limited by choosing a small ratio for adjacent size classes. External fragmentation is prevented by defragmenting the heap as needed, and by breaking up large arrays into arraylets. Space overhead is limited by using a mostly non-copying al- gorithm, so that from-space and to-space are mostly sharing physical storage. Uneven mutator utilization is avoided because we use a time-based scheduling policy, which is not sensitive to variations in average allocation rate at small (real-time) intervals but only at large intervals on the order of a full collection. Large data structures are handled by using arraylets, which effectively turns large objects into small objects. 8.1 Flaws in Baker's Real-time Definition Baker [5] begins his seminal paper on real-time garbage collection by stating that "a real-time list processing system is one in which the time required by the elementary list operations . is bounded by a small constant." This approach has been the basis for most of the later work on real-time collection [2, 6, 10, 11, 17, 19, 24]. However, this is implicitly a work-based approach, and as we have seen in Sections 4 and 7, at the small time intervals that are typically of interest in real-time systems, work-based collectors may be subject to very poor utilization. Baker attempts to finesse this problem by interleaving the collector with the mutator in a very fine-grained manner, but this only hides the problem: it keeps individual pauses low, but does not prevent numerous closely-spaced pauses. In the case of Baker's copying collector, the read barrier converts what was originally a simple load instruction into a sequence of tests, loads, and possibly a copy of the object. Let us say that the cost of such a read with barrier is times the cost of the original read operation. Then if we consider a short interval t containing only read operations, the utilization will be 1=. Ultimately, it comes down to a question of what one means by "small". If < 2, then the utilization will probably be acceptable. However, more typical values are 10 to 20. In such short intervals, utilization may drop so low as to be useless, as we saw experimentally in Table 2. There are fundamentally three ways to ameliorate this problem: increase t, decrease , or make bimodal. Increasing t is dependent on the real-time requirements of the application. An example of decreasing is Brooks' variant [10] of Baker's algorithm: a read only requires one extra load instruction, and the costly barrier is only performed on writes, which are considerably less frequent. However, at a resolution of 1 ms, there could be a lot of writes, and the for the write barrier is unlikely to be less than 10 (and is often much higher), so utilization could still be very low. Attempts have been made to further reduce the cost of the write barrier by using a store buffer [24] or by pre-allocating the space for the copied object and deferring the actual copy to collection time [15]. Nettles and O'Toole [21] introduced replicating copying collectors [12, 16], which represent another point in the tradeoff space. In these collectors, there is no read barrier, but the overall cost of the write barrier is more expensive because it may have to update both to- and from-space objects. Baker attempted to keep performance uniform by interleaving the allocator with each CONS, CAR, and CDR operation. However, the more fine-grained the interleaving, the higher the relative cost of the operations. Many subsequent collectors have attempted to reduce the time overhead of concurrent collection by batching the work (the Appel-Ellis-Li collector [2], which uses virtual memory page traps, is an extreme example). However, this limits the resolution of t, and does not function well when the cost of the quantized work varies widely (for example, due to variation in object or when the quanta occur irregularly. If the variation is low, it should be possible, for a given t, to determine the best batch size analytically. Ultimately, the distinction that is generally made in the literature between hard real-time and soft real-time is an over-simplification. There is really a continuum that depends on the required response time and the cost and variability of collector operations. 8.2 Time-based Collectors While most previous work on real-time collection has focused on work-based scheduling, there are some notable exceptions. In par- ticular, Henriksson [15] implemented a Brooks-style collector [10] in which application processes are divided into two priority lev- els: for high-priority tasks (which are assumed to be periodic with bounded compute time and allocation requirements), memory is pre-allocated and the system is tailored to allow mutator operations to proceed quickly. For low-priority tasks, no response-time goals are set. Henriksson gives a schedulability analysis using the real-time scheduling techniques of Joseph and Pandya [18]. While his analysis is work-based, his formula for utilization is similar to our formula for time-based scheduling. This is because in his collector the high-priority mutators can always interrupt the collector when they are ready to run. Thus we see that interrupt-driven work-based scheduling is essentially the same as periodic time-based scheduling The garbage collectors of Nettles and O'Toole [21] and North and Reppy [22] run the collector in a separate thread, which appears to be a time-based approach. However, Nettles and O'Toole dynamically detect situations in which the mutator is allocating faster than the collector, in which case they pause the mutator while a fixed amount of work is performed. North and Reppy's collector does not have any feedback, nor is there any way of balancing the mutator/collector quanta, so mutators with high allocation rates may fail. 9. CONCLUSIONS We have presented a hybrid real-time collector that operates primarily as a non-moving incremental mark-sweep collector, but prevents fragmentation via the use of limited copying (no more than 4% of traced data in our measurements). Because fragmentation is bounded, the collector has a provable space bound yet retains a lower space overhead than a fully-copying real-time collector. The key to fully incremental defragmentation is a low-overhead read barrier that maintains consistency without compromising the real-time bounds. We have shown that in an optimizing Java com- piler, a highly efficient software read barrier can be implemented and will only cause a 4% mean slowdown. We have implemented the collector and shown that for real applications it can achieve highly predictable mutator utilization rates with highly stable pause times at real-time resolution. It is generally able to achieve 45% utilization while the collector is on with only 1.6-2.5 times the actual memory high water mark of the application Acknowledgements We thank David Grove for his assistance in implementing the read barrier optimizations, and the entire Jikes RVM team for providing the research platform which made this work possible. We also thank Rob O'Callahan, David Grove, Mike Hind, and the anonymous referees for their helpful comments. 10. --R The Jalape-no virtual machine Thin guards: A simple and effective technique for reducing the penalty of dynamic class load- ing List processing in real-time on a serial computer The Treadmill An algorithm for parallel incremental com- paction Beltway: getting around garbage collection gridlock. The Real-Time Specification for Java Trading data space for reduced time and code space in real-time garbage collection on stock hardware A parallel Generational stack collection and profile-driven pretenuring Java server perfor- mance: A case study of building efficient Scheduling Garbage Collection in Embedded Sys- tems Incremental garbage collection for mature objects. Finding response times in a real-time system A compacting incremental collector and its performance in a production quality compiler. Garbage collection in a large LISP system. Concurrent garbage collection on stock hardware. Eliminating external fragmentation in a non-moving garbage collector for Java Barrier methods for garbage collection. --TR Concurrent garbage collection on stock hardware Real-time concurrent collection on stock multiprocessors Real-time garbage collection on general-purpose machines The treadmill Real-time replication garbage collection Generational stack collection and profile-driven pretenuring A compacting incremental collector and its performance in a production quality compiler Haskell Eliminating external fragmentation in a non-moving garbage collector for Java List processing in real time on a serial computer A parallel, real-time garbage collector An algorithm for parallel incremental compaction Beltway Incremental Collection of Mature Objects Space- and Time-Efficient Implementation of the Java Object Model Thin Guards Garbage collection in a large LISP system Trading data space for reduced time and code space in real-time garbage collection on stock hardware Non-compacting memory allocation and real-time garbage collection --CTR Yuqiang Xian , Guangze Xiong, Minimizing memory requirement of real-time systems with concurrent garbage collector, ACM SIGPLAN Notices, v.40 n.3, p.40-48, March 2005 Michael D. Bond , Kathryn S. McKinley, Bell: bit-encoding online memory leak detection, ACM SIGPLAN Notices, v.41 n.11, November 2006 Wei Fu , Carl Hauser, A real-time garbage collection framework for embedded systems, Proceedings of the 2005 workshop on Software and compilers for embedded systems, p.20-26, September 29-October 01, 2005, Dallas, Texas Dinakar Dhurjati , Sumant Kowshik , Vikram Adve , Chris Lattner, Memory safety without runtime checks or garbage collection, ACM SIGPLAN Notices, v.38 n.7, July Matthias Meyer, A true hardware read barrier, Proceedings of the 2006 international symposium on Memory management, June 10-11, 2006, Ottawa, Ontario, Canada Angelo Corsaro , Ron K. Cytron, Efficient memory-reference checks for real-time java, ACM SIGPLAN Notices, v.38 n.7, July Tobias Mann , Morgan Deters , Rob LeGrand , Ron K. Cytron, Static determination of allocation rates to support real-time garbage collection, ACM SIGPLAN Notices, v.40 n.7, July 2005 Mike Fulton , Mark Stoodley, Compilation Techniques for Real-Time Java Programs, Proceedings of the International Symposium on Code Generation and Optimization, p.221-231, March 11-14, 2007 Shahrooz Feizabadi , Godmar Back, Garbage collection-aware utility accrual scheduling, Real-Time Systems, v.36 n.1-2, p.3-22, July 2007 David F. Bacon, Realtime garbage collection, Queue, v.5 n.1, February 2007 Yang Chang , Andy Wellings, Low memory overhead real-time garbage collection for Java, Proceedings of the 4th international workshop on Java technologies for real-time and embedded systems, October 11-13, 2006, Paris, France Tony Printezis, On measuring garbage collection responsiveness, Science of Computer Programming, v.62 n.2, p.164-183, 1 October 2006 Daniel Spoonhower , Joshua Auerbach , David F. Bacon , Perry Cheng , David Grove, Eventrons: a safe programming construct for high-frequency hard real-time applications, ACM SIGPLAN Notices, v.41 n.6, June 2006 Danny Dub , Marc Feeley, BIT: A Very Compact Scheme System for Microcontrollers, Higher-Order and Symbolic Computation, v.18 n.3-4, p.271-298, December 2005 Daniel Spoonhower , Guy Blelloch , Robert Harper, Using page residency to balance tradeoffs in tracing garbage collection, Proceedings of the 1st ACM/USENIX international conference on Virtual execution environments, June 11-12, 2005, Chicago, IL, USA Lothar Thiele , Reinhard Wilhelm, Design for Timing Predictability, Real-Time Systems, v.28 n.2-3, p.157-177, November-December 2004 David F. Bacon , Perry Cheng , David Grove , Michael Hind , V. T. Rajan , Eran Yahav , Matthias Hauswirth , Christoph M. Kirsch , Daniel Spoonhower , Martin T. Vechev, High-level real-time programming in Java, Proceedings of the 5th ACM international conference on Embedded software, September 18-22, 2005, Jersey City, NJ, USA David F. Bacon , Perry Cheng , David Grove, Garbage collection for embedded systems, Proceedings of the 4th ACM international conference on Embedded software, September 27-29, 2004, Pisa, Italy Hans-J. Boehm, The space cost of lazy reference counting, ACM SIGPLAN Notices, v.39 n.1, p.210-219, January 2004 Diab Abuaiadh , Yoav Ossia , Erez Petrank , Uri Silbershtein, An efficient parallel heap compaction algorithm, ACM SIGPLAN Notices, v.39 n.10, October 2004 Hyeonjoong Cho , Chewoo Na , Binoy Ravindran , E. Douglas Jensen, On scheduling garbage collector in dynamic real-time systems with statistical timing assurances, Real-Time Systems, v.36 n.1-2, p.23-46, July 2007 A. M. Cheadle , A. J. Field , S. Marlow , S. L. Peyton Jones , R. L. While, Exploring the barrier to entry: incremental generational garbage collection for Haskell, Proceedings of the 4th international symposium on Memory management, October 24-25, 2004, Vancouver, BC, Canada Konstantinos Sagonas , Jesper Wilhelmsson, Message analysis-guided allocation and low-pause incremental garbage collection in a concurrent language, Proceedings of the 4th international symposium on Memory management, October 24-25, 2004, Vancouver, BC, Canada V. Krishna Nandivada , David Detlefs, Compile-Time Concurrent Marking Write Barrier Removal, Proceedings of the international symposium on Code generation and optimization, p.37-48, March 20-23, 2005 Chengliang Zhang , Kirk Kelsey , Xipeng Shen , Chen Ding , Matthew Hertz , Mitsunori Ogihara, Program-level adaptive memory management, Proceedings of the 2006 international symposium on Memory management, June 10-11, 2006, Ottawa, Ontario, Canada Chris Andreae , Yvonne Coady , Celina Gibbs , James Noble , Jan Vitek , Tian Zhao, Scoped types and aspects for real-time Java memory management, Real-Time Systems, v.37 n.1, p.1-44, October 2007 Wen-ke Chen , Sanjay Bhansali , Trishul Chilimbi , Xiaofeng Gao , Weihaw Chuang, Profile-guided proactive garbage collection for locality optimization, ACM SIGPLAN Notices, v.41 n.6, June 2006 Konstantinos Sagonas , Jesper Wilhelmsson, Efficient memory management for concurrent programs that use message passing, Science of Computer Programming, v.62 n.2, p.98-121, 1 October 2006 Joshua Auerbach , David F. Bacon , Daniel T. Iercan , Christoph M. Kirsch , V. T. Rajan , Harald Roeck , Rainer Trummer, Java takes flight: time-portable real-time programming with exotasks, ACM SIGPLAN Notices, v.42 n.7, July 2007 David Atienza , Jose M. Mendias , Stylianos Mamagkakis , Dimitrios Soudris , Francky Catthoor, Systematic dynamic memory management design methodology for reduced memory footprint, ACM Transactions on Design Automation of Electronic Systems (TODAES), v.11 n.2, p.465-489, April 2006 Glenn Ammons , Jonathan Appavoo , Maria Butrico , Dilma Da Silva , David Grove , Kiyokuni Kawachiya , Orran Krieger , Bryan Rosenburg , Eric Van Hensbergen , Robert W. Wisniewski, Libra: a library operating system for a jvm in a virtualized execution environment, Proceedings of the 3rd international conference on Virtual execution environments, June 13-15, 2007, San Diego, California, USA David F. Bacon , Perry Cheng , V. T. Rajan, Controlling fragmentation and space consumption in the metronome, a real-time garbage collector for Java, ACM SIGPLAN Notices, v.38 n.7, July Sven Gestegard Robertz , Roger Henriksson, Time-triggered garbage collection: robust and adaptive real-time GC scheduling for embedded systems, ACM SIGPLAN Notices, v.38 n.7, July Chandrasekhar Boyapati , Alexandru Salcianu , William Beebee, Jr. , Martin Rinard, Ownership types for safe region-based memory management in real-time Java, ACM SIGPLAN Notices, v.38 n.5, May Martin T. Vechev , Eran Yahav , David F. Bacon, Correctness-preserving derivation of concurrent garbage collection algorithms, ACM SIGPLAN Notices, v.41 n.6, June 2006 Martin T. Vechev , David F. Bacon, Write barrier elision for concurrent garbage collectors, Proceedings of the 4th international symposium on Memory management, October 24-25, 2004, Vancouver, BC, Canada David Detlefs , Christine Flood , Steve Heller , Tony Printezis, Garbage-first garbage collection, Proceedings of the 4th international symposium on Memory management, October 24-25, 2004, Vancouver, BC, Canada Filip Pizlo , Antony L. Hosking , Jan Vitek, Hierarchical real-time garbage collection, ACM SIGPLAN Notices, v.42 n.7, July 2007 Dinakar Dhurjati , Sumant Kowshik , Vikram Adve , Chris Lattner, Memory safety without garbage collection for embedded applications, ACM Transactions on Embedded Computing Systems (TECS), v.4 n.1, p.73-111, February 2005 Narendran Sachindran , J. Eliot B. Moss , Emery D. Berger, MC2: high-performance garbage collection for memory-constrained environments, ACM SIGPLAN Notices, v.39 n.10, October 2004 Jesper Honig Spring , Filip Pizlo , Rachid Guerraoui , Jan Vitek, Reflexes: abstractions for highly responsive systems, Proceedings of the 3rd international conference on Virtual execution environments, June 13-15, 2007, San Diego, California, USA Okehee Goh , Yann-Hang Lee , Ziad Kaakani , Elliott Rachlin, Schedulable garbage collection in CLI virtual execution system, Real-Time Systems, v.36 n.1-2, p.47-74, July 2007 Stephen M. Blackburn , Antony L. Hosking, Barriers: friend or foe?, Proceedings of the 4th international symposium on Memory management, October 24-25, 2004, Vancouver, BC, Canada David F. Bacon , Perry Cheng , V. T. Rajan, A unified theory of garbage collection, ACM SIGPLAN Notices, v.39 n.10, October 2004 Antony L. Hosking, Portable, mostly-concurrent, mostly-copying garbage collection for multi-processors, Proceedings of the 2006 international symposium on Memory management, June 10-11, 2006, Ottawa, Ontario, Canada Zhang Ning , Guangze Xiong, Minimizing GC work by analysis of live objects, ACM SIGPLAN Notices, v.41 n.3, March 2006 David F. Bacon , Perry Cheng , David Grove , Martin T. Vechev, Syncopation: generational real-time garbage collection in the metronome, ACM SIGPLAN Notices, v.40 n.7, July 2005 Yoav Ossia , Ori Ben-Yitzhak , Marc Segal, Mostly concurrent compaction for mark-sweep GC, Proceedings of the 4th international symposium on Memory management, October 24-25, 2004, Vancouver, BC, Canada Stephen M. Blackburn , Kathryn S. McKinley, Ulterior reference counting: fast garbage collection without a long wait, ACM SIGPLAN Notices, v.38 n.11, November Stephen M. Blackburn , Perry Cheng , Kathryn S. McKinley, Oil and Water? High Performance Garbage Collection in Java with MMTk, Proceedings of the 26th International Conference on Software Engineering, p.137-146, May 23-28, 2004 G. Chen , M. Kandemir , N. Vijaykrishnan , M. J. Irwin , B. Mathiske , M. Wolczko, Heap compression for memory-constrained Java environments, ACM SIGPLAN Notices, v.38 n.11, November Matthew Hertz , Yi Feng , Emery D. Berger, Garbage collection without paging, ACM SIGPLAN Notices, v.40 n.6, June 2005 A. M. Cheadle , A. J. Field , J. W. Ayres , N. Dunn , R. A. Hayden , J. Nystrom-Persson, Visualising dynamic memory allocators, Proceedings of the 2006 international symposium on Memory management, June 10-11, 2006, Ottawa, Ontario, Canada Stylianos Mamagkakis , David Atienza , Christophe Poucet , Francky Catthoor , Dimitrios Soudris, Energy-efficient dynamic memory allocators at the middleware level of embedded systems, Proceedings of the 6th ACM & IEEE International conference on Embedded software, October 22-25, 2006, Seoul, Korea
real-time scheduling;read barrier;defragmentation;utilization
604156
Ownership types for object encapsulation.
Ownership types provide a statically enforceable way of specifying object encapsulation and enable local reasoning about program correctness in object-oriented languages. However, a type system that enforces strict object encapsulation is too constraining: it does not allow efficient implementation of important constructs like iterators. This paper argues that the right way to solve the problem is to allow objects of classes defined in the same module to have privileged access to each other's representations; we show how to do this for inner classes. This approach allows programmers to express constructs like iterators and yet supports local reasoning about the correctness of the classes, because a class and its inner classes together can be reasoned about as a module. The paper also sketches how we use our variant of ownership types to enable efficient software upgrades in persistent object stores.
Introduction The ability to reason locally about program correctness is crucial when dealing with large programs. Local reasoning allows correctness to be dealt with one module at a time. Each module has a specication that describes its expected behavior. The goal is to prove that each module satises its The research was supported in part by DARPA Contract F30602-98-1-0237, NSF Grant IIS-98-02066, and NTT. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. POPL'03, January 15-17, 2003, New Orleans, Louisiana, USA. ACM 1-58113-628-5/03/0001 .$5.00 specication, using only the specications but not code of other modules. This way the complexity of the proof eort (formal or informal) can be kept under control. This local reasoning approach is sound if separate verica- tion of individual modules su-ces to ensure the correctness of the composite program [43, 28]. The key to sound local reasoning in object-oriented languages is object encap- sulation. Consider, for example, a Stack object s that is implemented using a linked list. Local reasoning about the correctness of the Stack implementation is possible if objects outside s do not directly access the list nodes, i.e., the list nodes are encapsulated within the s. This paper presents a variant of ownership types for specifying and statically enforcing object encapsulation. With ownership types, a program can declare that s owns all the list nodes. The type system then statically ensures that the list nodes are encapsulated within s. A type system that enforces strict object encapsulation, how- ever, is too constraining [55]: it does not allow e-cient implementation of important constructs like iterators [48, 32]. Consider, for example, an iterator over the above-mentioned Stack object s. If the iterator is encapsulated within s, it cannot be used outside s. If the iterator is not encapsulated within s, it cannot directly access the list nodes in s, and hence cannot run e-ciently. Previous ownership type systems were either too constraining to support constructs like iterators [22, 21], or too permissive to support local reasoning [20, 14, 11]; for example they allowed objects outside the above-mentioned Stack object s to temporarily get direct access to the list nodes. This paper argues that the right way to solve the problem is to provide special access privileges to objects belonging to classes in the same module; we show how to do this for inner classes [50, 38]. Our variant of ownership types allows inner class objects to have privileged access to the representations of the corresponding outer class objects. This principled violation of encapsulation allows programmers to express constructs like iterators using inner classes, yet supports local reasoning about the correctness of the classes. Our system supports local reasoning because a class and its inner classes can be reasoned about together as a module. The paper also describes how our variant of ownership types enables e-cient software upgrades in persistent object stores. Our interest in software upgrades led us to work on ownership types. The paper shows how our ownership types can be used to ensure that code for upgrading objects does not observe broken invariants or interfaces unknown at the time it was written; this makes it possible for programmers to reason about the correctness of their upgrades. This paper is organized as follows. Section 2 discusses object encapsulation. Section 3 describes our variant of ownership types for enforcing object encapsulation. Section 4 presents a formal description of the type system. Section 5 shows how ownership types can be used to enable modular upgrades. Section 6 discusses related work and Section 7 concludes. Object Encapsulation Object encapsulation is important because it provides the ability to reason locally about program correctness. Reasoning about a class in an object-oriented program involves reasoning about the behavior of objects belonging to the class. Typically objects point to other subobjects, which are used to represent the containing object. Local reasoning about class correctness is possible if the sub-objects are fully encapsulated, that is, if all subobjects are accessible only within the containing object. This condition supports local reasoning because it ensures that outside objects cannot interact with the subobjects without calling methods of the containing object. And therefore the containing object is in control of its subobjects. However, full encapsulation is often more than is needed. Encapsulation is only required for subobjects that the containing object depends on [43, 28]: D1. An object x depends on subobject y if x calls methods of y and furthermore these calls expose mutable behavior of y in a way that aects the invariants of x. Thus, a Stack object s implemented using a linked list depends on the list but not on the items contained in the list. If code outside could manipulate the list, it could invalidate the correctness of the Stack implementation. But code outside can safely use the items contained in s because s doesn't call their methods; it only depends on the identities of the items and the identities never change. Similarly, a Set of immutable elements does not depend on the elements even if it invokes a.equals(b) to ensure that no two elements a and b in the Set are equal, because the elements are immutable. Local reasoning about a class is possible if objects of that class encapsulate every object they depend on. But strict object encapsulation is too constraining [55]: it prevents efcient implementation of important constructs like iterators. For example, to run e-ciently, an iterator over the above-mentioned Stack object s needs access to the list nodes in s. To provide this access, we have to allow objects like iterators to violate encapsulation. Local reasoning is still possible provided all violations of encapsulation are limited to code contained in the same mod- ule. For example, if both the Stack and its iterator are imple- O1. Every object has an owner. O2. The owner can either be another object or world. O3. The owner of an object does not change over time. O4. The ownership relation forms a tree rooted at world. Figure 1: Ownership Properties world Figure 2: An Ownership Relation mented in the same module, we can still reason about their correctness locally, by examining the code of that module. 3 Ownership Types for Encapsulation Ownership types [22, 20, 14, 11] provide a statically enforceable way of specifying object encapsulation. The idea is that an object can own subobjects it depends on, thus preventing them from being accessible outside. This section presents our ownership type system. This system is similar to the one described in [20]|the main dierence is that to support constructs like iterators, the type system in [20] allows temporary violations of encapsulation. We disallow this violation. Instead, we support constructs like iterators using inner classes. The key to the type system is the concept of object owner- ship. Every object has an owner. The owner can either be another object or a special owner called world. Our type system statically guarantees the ownership properties shown in Figure 1. Figure 2 presents an example ownership relation. We draw an arrow from x to y if x owns y. In the gure, the special owner world owns objects o1, o5, and o6; o1 owns o2 and o4; o2 owns o3; and o6 owns o7. Ownership allows a program to statically declare encapsulation boundaries that capture dependencies: D2. An object should own all the objects it depends on. The system then enforces encapsulation: if y is inside the encapsulation boundary of z and x is outside, then x cannot access y. (An object x accesses an object y if x has a pointer to y, or methods of x obtain a pointer to y.) In Figure 2, o7 is inside the encapsulation boundary of o6 and o1 is outside, so o1 cannot access o7. An object is only allowed to access: itself and objects it owns, 2) its ancestors in the ownership tree and objects they own, and globally accessible objects, namely objects owned by world. 1 Thus, o1 can access all objects in the gure except for o3 and o7. 1 Note the analogy with nested procedures: proc P1 fvar x2 ; class TStack<stackOwner, TOwner> { { 6 new TNode<this, TOwner>(value, head); 9 T pop() { return value; 14 }16 class TNode<nodeOwner, TOwner> { TNode<nodeOwner, TOwner> next; T value;19 TNode(T v, TNode<nodeOwner, TOwner> n) { 22 T value() { return value; } TNode<nodeOwner, TOwner> next() { return next; } class T { }28 class TStackClient { 29 void test() { new TStack<this, this> (); new TStack<this, world>(); new TStack<world, world>(); new TStack<world, this> (); */ 34 }} Figure 3: Stack of T Objects s1.head s1.head.next s2.head s2.head.next s3.head s3.head.next s1.head.value s2.head.value s1.head.next.value s2.head.next.value s3.head.next.value s3.head.value world Figure 4: Ownership Relation for TStacks s1, s2, s3 3.1 Owner Polymorphism We present our type system in the context of a Java-like language augmented with ownership types. Every class definition is parameterized with one or more owners. The rst owner parameter is special: it identies the owner of the corresponding object. The other owner parameters are used to propagate ownership information. Parameterization allows programmers to implement a generic class whose objects have dierent owners. This parameterization is similar to parametric polymorphism [54, 16, 1, 61] except that our parameters are owners, not types. An owner can be instantiated with this, with world, or with another owner parameter. Objects owned by this are encapsulated objects that cannot be accessed from outside. Objects owned by world can be accessed from anywhere. proc P2 fvar x3 ; proc P3 f.ggg. Say xn+1 and Pn+1 are children of Pn . Pn can only access: 1) Pn and its children, 2) the ancestors of Pn and their children, and global variables and procedures. class C<cOwner, sOwner, tOwner> where (sOwner <= tOwner) { . 3 TStack<sOwner, tOwner> s; Figure 5: Using Where Clauses to Constrain Owners Figure 3 shows an example. 2 A TStack is a stack of T ob- jects. It is implemented using a linked list. The TStack class is parameterized by stackOwner and TOwner. stack- Owner owns the TStack object; TOwner owns the T objects contained in the TStack. The code species that the TStack object owns the nodes in the list; therefore the list nodes cannot be accessed from outside the TStack object. The type of TStack s1 is instantiated using this for both the owner parameters. This means that TStack s1 is owned by the TStackClient object that created it and so are the T objects in s1. TStack s2 is owned by the TStackClient object, but the T objects in s2 are owned by world. TStack s3 is owned by world and so are the T objects in s3. The ownership relation for s1, s2, and s3 is depicted in Figure 4 (assuming the stacks contain two elements dotted line indicates that every object is directly or indirectly owned by world.) 3.2 Constraints on Owners For every type T hx1 ; :::; xni with multiple owners, our type system statically enforces the constraint that (x1 x i ) for f1::ng. Recall from Figure 1 that the ownership relation forms a tree rooted at world. The notation (y z) means that y is a descendant of z in the ownership tree. The notation (y z) means that y is either the same as z, or y is a descendant of z in the ownership tree. Thus, the type of TStack s4 in Figure 3 is illegal because (world 6 this). The above constraint is the same as in [20]. However, we extend it to parameterized methods as well. For a method of an object of type T hx1 ; :::; xni, the restriction is that (x1 x i ) for all i 2 f1::kg. (These constraints are needed to provide encapsulation in the presence of subtyping. [11] illustrates this point with an example.) To check ownership constraints modularly, it is sometimes necessary for programmers to specify additional constraints on class and method parameters. For example, in Figure 5, the type of s is legal only if (sOwner tOwner). We allow programmers to specify such additional constraints using where clauses [25, 54], and our type system enforces the constraints. For example, in Figure 5, class C species that (sOwner tOwner). An instantiation of C that does not satisfy the constraint is illegal. 3.3 Subtyping The rule for declaring a subtype is that the rst owner parameter of the supertype must be the same as that of the subtype; in addition, of course, the supertype must satisfy the constraints on owners. The rst owners have to match 2 The example shows type annotations written explicitly. However, many of them can be automatically inferred. See Section 4.3 for details. class TStack<stackOwner, TOwner> { 3 . 4 TStackEnum<enumOwner, TOwner> elements 5 where (enumOwner <= TOwner) { 6 return new TStackEnum<enumOwner, TOwner>(); 8 class TStackEnum<enumOwner, TOwner> 9 implements TEnumeration<enumOwner, TOwner> {11 TNode<TStack.this, TOwner> current;13 TStackEnum() { current = TStack.this.head; }15 T getNext() { (current == null) return null; 19 return t; { 22 return (current != null); class TStackClient { 28 void test() { 29 TStack<this, world> new TStack<this, world>(); interface TEnumeration<enumOwner, TOwner> { 36 boolean hasMoreElements(); Figure TStack With Iterator because they are special, in that they own the corresponding objects. Thus, TStackhstackOwner, TOwneri is a subtype of ObjecthstackOwneri. But ThTOwneri is not a subtype of Objecthworldi because the rst owners do not match. 3.4 Inner Classes Our inner classes are similar to the member inner classes in Java. Inner class denitions are nested inside other classes. Figure 6 shows an example. The inner class TStackEnum implements an iterator for TStack; the elements method of TStack provides a way to create an iterator over the TStack. The TStack code is otherwise similar to that in Figure 3. Recall from before that an owner can be instantiated with this, with world, or with another owner parameter. Within an inner class, an owner can also be instantiated with C.this, where C is an outer class. This feature allows an inner object to access the objects encapsulated within its outer objects. In Figure 6, the owner of the current eld inTStackEnum is instantiated with TStack.this. The current eld accesses list nodes encapsulated within its outer TStack object. An inner class is parameterized with owners just like a regular class. In our system, the outer class parameters are not automatically visible inside an inner class. If an inner class uses an outer class parameter, it must explicitly include the outer class parameter in its declaration. In Figure 6, the TStackEnum declaration includes the owner parameter TOwner from its outer class. TOwner is therefore visible inside TStackEnum. But the TStackEnum declaration does class TStack<stackOwner, TOwner> { 3 . 4 class TStackEnum<enumOwner, TOwner> 5 implements TEnumeration<enumOwner, TOwner> {7 TNode<TStack.this, TOwner> current; 8 . 9 T getNext() writes(this) reads(TStack.this){.} 12 }14 interface TEnumeration<enumOwner, TOwner> { boolean hasMoreElements() reads(this); Figure 7: TStack Iterator With Eects not include stackOwner. Therefore, stackOwner is not visible inside TStackEnum. Note that in this example, the elements method is parameterized by enumOwner. This allows a program to create different iterators that have dierent owners. elements returns an iterator of type TStackEnumhenumOwner, TOwneri. For this type to be legal, it must be the case that (enumOwner TOwner). This requirement is captured in the where clause. Note also that TStackhstackOwner, TOwneri.TStackEnum- henumOwner, TOwneri is declared to be a subtype of TEnu- merationhenumOwner, TOwneri. This allows TStackClient to create an unencapsulated iterator e2 over an encapsulated TStack s; the program can then pass e2 to objects outside the TStackClient. In general, inner classes can be used to implement wrappers [32] that expose a limited interface to an outer object. A program can then create a wrapper around an encapsulated subobject, and pass the wrapper object outside the encapsulation boundary. 3.5 Encapsulation Theorem Our system provides the following encapsulation property: Theorem 1. x can access an object owned by 1. 2. x is an inner class object of o. Proof. Consider the code: class Chf; :::if::: T ho; :::i y :::g. Variable y of type T ho; :::i is declared within the static scope of class C. Owner can therefore be either 1) this, or 2) world, or 3) a formal class parameter, or 4) a formal method parameter, or 5) C 0 .this, where C 0 is an outer class. We will show that in the rst four cases, the constraint (this o) holds. In the rst two cases, the constraint holds trivially. In the last two cases, (f o) and (this f ), so the constraint holds. In the fth case, (C 0 Therefore an object x of a class C can access an object y owned by as in the rst four cases, or 2) x is an inner object of o, as in the fth case. class IntVector { 3 int size() reads (this) { return elementCount; } 4 void add(int x) writes(this) { elementCount++; . } 5 . 6 }8 class IntStack { 9 IntVector new IntVector (); { vec.add(x); } 11 . Figure 8: Reasoning About Aliasing and Side Eects 3.6 Discussion Our variant of ownership types supports local reasoning provided the programmer declares that all depended-on objects are owned. The above theorem implies that owned objects can only be accessed from inside the owner, and by inner ob- jects. Therefore if ownership captures the depends relation described in Section 2, local reasoning about the correctness of a class is possible, because the class and its inner classes together can be reasoned about as a module. Our ownership types are also expressive. They allow ecient implementation of constructs like iterators and wrappers [32]. Furthermore, they also allow programs to create wrappers that can be used in contexts where the underlying object is inaccessible. This ability was illustrated in Figure 6; iterator e2 can be used globally even though the TStack it is iterating over can only be used in TStackClient. Ours is the rst ownership type system to support constructs like iterators and generally accessible wrappers while also ensuring local reasoning. We discuss this further in Section 6. 3.7 Eects Clauses Our system also contains eects clauses [49] because they are useful for specifying assumptions that hold at method boundaries and enable modular reasoning and checking of programs. We use eects with ownership types to enable modular upgrades; we describe this in Section 5. Our system allows programmers to specify reads and writes clauses. Consider a method that species that it writes wn ) and reads (r1 ; :::; rm ). The method can write an object x (or call methods that write x) only if for some i 2 f1::ng. The method can read an object y (or call methods that read y) only if (y w i ) or (y r j ), for some f1::mg. We thus allow a method to both read and write objects named in its writes clause. Figure 7 shows a TStack iterator that uses eects, but is otherwise similar to the TStack iterator in Figure 6. In the example, the hasMoreElements method reads the this object. The getNext method reads objects owned by TStack.this and writes (and reads) the this object. defn ::= class cnhformal+i extends c where constr* body body ::= finnerclass* eld* meth*g owner ::= formal j world j cn.this constr ::= (owner owner) j (owner 6 owner) innerclass ::= defn meth ::= t mnhformal*i(arg* ) eects where constr* feg eects ::= reads (owner* ) writes (owner* ) eld ::= t fd formal ::= f e ::= new c j x.new c j x j let (arg=e) in feg j class names eld names method names x,y 2 variable names Figure 9: Grammar When eects clauses are used in conjunction with subtyping, the eects of an overridden method must subsume the eects of the overriding method. This sometimes makes it di-cult to specify precisely all the eects of a method. For example, it is di-cult to specify precisely all the read eects in the getNext method of the TEnumeration class because TEnumer- ation is expected to be a supertype of subtypes like TStack- Enum and TEnumeration cannot name the specic objects used in the getNext methods of these subtypes. To accommodate such cases, we allow an escape mechanism, where a method can include world in its eects clauses. Ownership types and eects can be used to locally reason about the side eects of method calls. Consider, for example, the code in Figure 8, which shows an IntStack implemented using an IntVector vec. (We adopted this example from [44].) The example has a method m that receives two arguments: an IntStack s and an IntVector v. The condition in the assert statement in m can be true only if v is not aliased to s.vec. In the example, the method m uses a where clause to specify that (v 6 s) and (s 6 v). Since the ownership relation forms a tree (see Figure 1), this constraint implies that v cannot be aliased to s.vec. Furthermore, IntVector.size declares that it only reads objects owned by the IntVector, and IntStack.push declares that it only writes (and reads) objects owned by the IntStack. Therefore, it is possible to reason locally that v.size and s.push cannot interfere, and thus the condition in the assert statement in m must be true. 4 The Type System This section presents a formal description of our type system. To simplify the presentation of key ideas, we describe our type system in the context of a core subset of Java [33] known as Classic Java [31]. We add inner classes to Classic Java and augment its type system with ownership types. Our approach, however, extends to the whole of Java and other similar languages. 4.1 Type Checking Figure 9 presents our grammar. The core of our type system is a set of rules for reasoning about the typing judgment: FieldsOnce(P) class cnhf1::n i extends c 0 where constr ficlass eld methg 2 c [CONSTR ENV] [OWNER WORLD] world [OWNER FORMAL] [OWNER THIS] class cnhf1::n i. where constr . 2 cnhfi 6 9x;y [METHOD DECLARED] class cnhf1::n i. f. meth .g 2 c [METHOD INHERITED] [FIELD DECLARED] class cnhf1::n i. f. eld .g 2 c [FIELD INHERITED] eld world [EXP REF ASSIGN] Figure 10: Type Checking Rules Judgment Meaning defn is a well-formed class in class c is an owner constraint constr is satised eect X is subsumed by eect Y is a well-formed type a subtype of t 2 typing environment E is well-formed class c declares/inherits eld class c declares/inherits meth eld eld is a well-formed eld meth meth is a well-formed method eects of e are subsumed by R/W Figure Typing Judgments t. P , the program being checked, is included here to provide information about class denitions. E is an environment providing types for the free variables of e. R and W must subsume the read and write eects of e. t is the type of e. We dene a typing environment as as R, W ::= o1::n . We dene the type system using the judgments in Figure 11. We present the rules for these judgments in Figure 10. The rules use a number of predicates that are shown in Figure 12. These predicates are based on similar predicates from [31]. For simplicity, we sometimes treat outermost classes in our rules as if they were inner classes of class ;. We also sometime use cnhfi to denote 4.2 Soundness of the Type System Our type checking rules ensure that for a program to be well-typed, the program respects the properties described in Figure 1. A complete syntactic proof [63] of type soundness can be constructed by dening an operational semantics (by extending the operational semantics of Classic Java [31]) and then proving that well-typed programs do not reach an error state and that the generalized subject reduction theorem holds for well-typed programs. The subject reduction theorem states that the semantic interpretation of a term's type is invariant under reduction. The proof is straightforward but tedious, so it is omitted here. 4.3 Type Inference Although our type system is explicitly typed in principle, it would be onerous to fully annotate every method with the extra type information. Instead, we can use a combination of inference and well-chosen defaults to signicantly reduce the number of annotations needed in practice. [14, 11] describe an intraprocedural type inference algorithm and some default types; we can use a similar approach. (In [14, 11], about one in thirty lines of code had to be changed to express Java programs in an ownership type system.) We emphasize that this approach to inference is purely intraprocedural and does not infer method signatures or types of instance vari- ables. Rather, it uses a default completion of partial type specications in those cases to minimize the required anno- tations. This approach permits separate compilation. Meaning WFClasses(P) There are no cycles in the class hierarchy declared twice in P contains two inner classes with same name, either declared or inherited FieldsOnce(P) No class contains two elds with same name, either declared or inherited contains two methods with same name Overriding methods have the same return type and parameter types as the methods being overridden. The read and write eects of an overriding method must be superseded by those of the overridden methods Figure 12: Predicates Used in Type Checking Rules 4.4 Runtime Overhead The system we described is a purely static type system. The ownership relations are used only for compile-time type checking and are not preserved at runtime. Consequently, our programs have no runtime overhead compared to regular (Java) programs. In fact, one way to compile and run a program in our system is to convert it into a regular program after type checking, by removing the owner parameters, the constraints on owners, and the eects clauses. A language like Java, however, is not purely statically-typed. Java allows downcasts that are checked at runtime. Suppose an object with declared type Objecthoi is downcast to Vectorho,ei. Since the result of this operation depends on information that is only available at runtime, our type checker cannot verify at compile-time that e is the right owner parameter even if we assume that the object is indeed a Vec- tor. To safely support downcasts, a system has to keep some ownership information at runtime. This is similar to keeping runtime information with parameterized types [54, 61]. [10] describes how to do this e-ciently for ownership by keeping runtime information only for objects that can be potentially involved in downcasts into types with multiple parameters. 5 Upgrades in Persistent Object Stores This section shows how ownership types and eects clauses can be used to enable modular reasoning about the correctness of upgrades in a persistent object store. The desire to achieve such reasoning was the motivation for our work on ownership types for encapsulation. A persistent object store [46, 5, 9, 17, 18, 29, 56] contains conventional objects similar to what one might nd in an object-oriented language such as Java. Applications access persistent objects within atomic transactions, since this is necessary to ensure consistency for the stored objects; transactions allow for concurrent access and they mask failures. Upgrades are needed in such a system to improve object implementations, to correct errors, or even to change interfaces in the face of changing application requirements; this includes incompatible changes to interfaces where the new interface does not support the same methods as the old one. Providing a satisfactory solution for upgrades in persistent object stores has been a long-standing challenge. An upgrade for a persistent object store is dened as a set of class-upgrades, one for each class whose objects need to change. A class-upgrade is a triple: hold-class, new-class, TFi. It indicates that all objects belonging to old-class should be transformed, through the use of the transform function TF provided by the programmer, into objects of new-class. TF takes an old-class object and a newly allocated new-class object and initializes the new-class object from the old-class object. The upgrade infrastructure causes the new-class object to take over the identity of the old-class object, so that all objects that used to point to the old-class object now point to the new-class object. An upgrade is executed by transforming all objects whose classes are being replaced. However, transforms must not interfere with application access to the store, and must be performed e-ciently in both space and time. In addition, they must be done safely so that important persistent state is not corrupted. Previous approaches [4, 7, 29, 45, 56, 57] do not provide a satisfactory solution to these challenges; they either stop application access to the database while running the upgrade, or they keep copies of the database, or they limit the expressive power of transforms (e.g., transform functions are not allowed to make method calls). Our system provides an e-cient solution. It performs upgrades lazily. An object is transformed just before an application accesses it: the application transaction is interrupted to run the transform function. The transform runs in its own transaction; when this transaction commits, the application transaction is resumed. Our system also allows later upgrades to run in parallel with earlier ones. If an object has several pending transforms, they are run one after another, in upgrade order. Furthermore, if a transform transaction T encounters an object with a pending transform from an upgrade, T is interrupted (just like an application to run the pending transform, and continues execution after the pending transform commits. More details can be found in [13, 12, 47]. 5.1 Ownership Types for Safe Upgrades Our upgrade system is e-cient and expressive: it does not delay application transactions, avoids the use of versions (copies of objects), and does not limit the expressive power of transform functions. But it also needs to support modular reasoning about the correctness of transform functions. This is possible if each transform function encounters only object interfaces and invariants that existed when its upgrade started, even though in reality the transform function might run much later, after application transactions and other transform transactions. We use our variant of ownership types to enable modular reasoning about the correctness of transform functions. Our system checks statically whether transform functions satisfy the following constraint, using ownership and eects declarations (eects clauses state what objects TFs access): S1. TF(x) only accesses objects that x owns (directly or transitively). Transform functions often satisfy S1 because ownership frequently captures the depends relation discussed in Section 2, and typically transform functions only access the depended- on objects. (We discuss in [13] how we support modular reasoning of transform functions when S1 does not hold.) Our implementation also ensures the following: S2. For any object x aected by an upgrade, x is accessed before any object owned by x. We ensure S2 using two mechanisms. If the owned object is encapsulated within x, the type system guarantees that x is accessed rst. If the owned object is shared with an inner class object of x, our system causes x to be accessed just before the inner class object is rst used after the upgrade. This latter mechanism is described in more detail in [13]. When S1 holds, we can prove that out-or-order processing of transforms does not cause problems. In particular, we can show that: applications do not interfere with transform functions, transform functions of unrelated objects do not interfere with each other, and transform functions of related objects run in a pre-determined order (namely an object is transformed before its owned subobjects). (The proofs are given in [13]). Thus when S1 holds, we can ensure that transform functions encounter the expected interfaces and invariants. This supports modular reasoning: each transform function can be reasoned about as extra method of its old class. 6 Related Work Euclid [41] is one of the rst languages that considered the problem of aliasing. [37] stressed the need for better treatment of aliasing in object-oriented programs. Early work on Islands [36] and Balloons [3] focused on fully encapsulated objects where all subobjects an object can access are not accessible outside the object. Universes [53] also enforces full encapsulation, except for read-only references. However, full encapsulation signicantly limits expressiveness, and is often more than is needed. The work on ESC/Java pointed out that encapsulation is required only for subobjects that the containing object depends on [43, 28], but ESC/Java was unable to always enforce encapsulation. 6.1 Ownership Types and Encapsulation Ownership types provide a statically enforceable way of specifying object encapsulation. They were proposed in [22] and formalized in [21]. These systems enforce strict object en- capsulation, but do so by signicantly limiting expressive- ness. They require that a subtype have the same owners as a supertype. So TStackhstackOwner, TOwneri cannot be a subtype of ObjecthstackOwneri. Moreover, they do not support iterators. PRFJ [14], SCJ [11], and JOE [20] extended ownership types to support a natural form of subtyping. To do so without violating encapsulation, JOE introduces the constraint that in every type with multiple owners, the rst owner all other owners. As a result, in JOE, a program can create a pointer from object x to an object owned by o). PRFJ and SCJ allow an object to contain pointers to subobjects owned by a dierent object, but they have eects clauses that prevent a program from following such point- ers. The above systems eectively enforce encapsulation for object elds. However, to support constructs like iterators, they allow method local variables to violate encapsulation. Therefore they do not support local reasoning. AliasJava [2] uses ownership types to aid program under- standing. Like other ownership type systems, AliasJava allows programmers to use ownership information to reason about aliasing. AliasJava is also more exible than other ownership type systems. However, unlike other ownership type systems, AliasJava does not enforce any encapsulation properties. (This is illustrated with an example in [11].) Ownership types have been extended to inner classes in [19, 2]. However, these systems do not enforce the property stated in Section 3.5, and do not support local reasoning. Ownership types have also been used to enforce other prop- erties. Parameterized Race-Free Java (PRFJ) [14] uses an based type system to prevent data races in multi-threaded programs. Safe Concurrent Java (SCJ) [11] extends this to prevent both data races and deadlocks. These systems can be combined with our approach to enforce object encapsulation as well as prevent data races and deadlocks. [11] sketches a way of doing this. Recent work [15, 59] combines region types [60, 24, 35] with our type system to statically ensure both object encapsulation and safe region-based memory management. 6.2 Related Type Systems Linear types [62] and unique pointers [51] can also be used to control object aliasing. Linear types have been used in low level languages to support safe explicit memory deallocation [24] and to track resource usage [26, 27]. Linear types and unique pointers are orthogonal to ownership types, but the two can be used in conjunction to provide more expressive systems. PRFJ [14] is the rst system that combines ownership types with conventional unique pointers. Recent work [23] proposes a better approach that allows a program to specify a unique external pointer to an object; there can be other internal pointers to the object from its subobjects. Eects clauses [49] are useful for specifying assumptions that must hold at method boundaries. Eects enable modular checking of programs. PRFJ [14] is the rst system to combine eects with ownership types to statically prevent data races. [11] and [20] also combine eects with ownership for preventing deadlocks and for program understanding. This paper uses eects with ownership to enable lazy upgrades. Data groups [42, 44] can be used to name groups of objects in an eects clause to write modular specications in the presence of subtyping. Ownership types provide an alternate way of writing modular specications. Ownership types can also be used to name groups of objects in an eects clause| the name of an owner can be used to name all the objects transitively owned by the owner. Figure 8 presents an example from [44] expressed using ownership types. Data groups are implemented using a theorem prover, and in principle, they can be very exible. However, pivot uniqueness in [44] imposes drastic restrictions on pivot elds. Ownership types do not impose such restrictions; they only require that the owner of an object be unique. In [44], the owner exclusion constraint is hard coded. In our system, programmers can specify arbitrary constraints on owners using where clauses; owner exclusion can be used as a default. Systems such as TVLA [58], PALE [52], and Roles [40] specify the shape of a local object graph in more detail than ownership types. TVLA can verify properties such as when the input to the program is a tree, the output is also a tree. PALE can verify all the data structures that can be expressed as graph types [39]. Roles can verify global properties such as the participation of objects in multiple data structures. Roles also support compositional interprocedural analysis. In contrast to these systems that take exponential time for verication, ownership types provide a lightweight and practical way to constrain aliasing. Conclusions Object encapsulation enables sound local reasoning about program correctness in object-oriented languages. Ownership types provide a way of specifying and statically enforcing object encapsulation. However, a type system that enforces strict object encapsulation is too constraining: it does not allow e-cient implementation of important constructs like iterators. This paper argues that the right way to solve the problem is to allow objects of classes dened in the same module to have privileged access to each other's representations. We show how to do this for inner classes. Our variant of ownership types allows objects of inner classes to have privileged access to the representations of the corresponding objects of outer classes. This principled violation of encapsulation allows programmers to express constructs like iterators and wrappers using inner classes. Our system also allows wrappers to be used in more global contexts than the objects they wrap. Yet our system supports local reasoning about the correctness of classes, because a class and its inner classes can be reasoned about together as a module. Thus the paper describes the rst ownership type system that is expressive enough to support iterators and wrappers, while also supporting local reasoning. In addition, the paper describes an application of the technique to enable modular reasoning about upgrades in persistent object stores. Ownership types have been used for other purposes as well, such as for preventing data races and deadlocks, and for safe region-based memory management. Since ownership types require little programming overhead, their type checking is fast and scalable, and they provide several benets, they oer a promising approach to making object-oriented programs more reliable. Acknowledgments We thank Daniel Jackson, Viktor Kuncak, Greg Nelson, Martin Rinard, and Alexandru Salcianu for useful discussions and comments on earlier drafts of this paper. --R Adding type parameterization to the Java language. Alias annotations for program understanding. Balloon types: Controlling sharing of state in data types. Scalable and recoverable implementation of object evolution for the PJama 1 platform. Design issues for persistent Java: A type-safe Representation independence Semantics and implementation of schema evolution in object-oriented databases JPS: A distributed persistent Java system. Safe runtime downcasts with ownership types. Ownership types for safe programming: Preventing data races and deadlocks. Ownership types and safe lazy upgrades in object-oriented databases Lazy modular upgrades in persistent object stores. A parameterized type system for race-free Java programs Making the future safe for the past: Adding genericity to the Java programming language. The GemStone data management system. Shoring up persistent applications. Object ownership and containment. Ownership, encapsulation and disjointness of type and e Simple ownership types for object containment. Ownership types for exible alias protection. External uniqueness. Typed memory management in a calculus of capabilities. Subtypes vs. where clauses: Constraining parametric polymorphism. Enforcing high-level protocols in low-level software Adoption and focus: Practical linear types for imperative programming. Wrestling with rep exposure. The story of O2. Classes and mixins. Design Patterns: Elements of Reusable Object-Oriented Software The Java Language Speci An object-oriented eects system Islands: Aliasing protection in object-oriented languages The Geneva convention on the treatment of object aliasing. Graph types. Role analysis. Report on the programming language Euclid. Data groups: Specifying the modi Data abstraction and information hiding. Beyond schema evolution to database reorganization. Providing persistent objects in distributed systems. Safe lazy software upgrades in object-oriented databases Towards alias-free pointers The pointer assertion logic engine. Parameterized types for Java. Iterators and encapsulation. Object Design Inc. Class modi Solving shape-analysis problems in languages with destructive updating Parametric polymorphism in Java: An approach to translation based on re ective features. Linear types can change the world. A syntactic approach to type soundness. --TR Semantics and implementation of schema evolution in object-oriented databases Class modification in the GemStone object-oriented DBMS The GemMYAMPERSANDndash;Stone data management system Polymorphic effect systems Beyond schema evolution to database reorganization Islands Graph types Design patterns A syntactic approach to type soundness Shoring up persistent applications Subtypes vs. where clauses Region-based memory management Parameterized types for Java Adding type parameterization to the Java language Classes and mixins Solving shape-analysis problems in languages with destructive updating Ownership types for flexible alias protection Data groups Making the future safe for the past Typed memory management in a calculus of capabilities Confined types Type-based race detection for Java Parametric polymorphism in Java Abstraction mechanisms in CLU Enforcing high-level protocols in low-level software The pointer assertion logic engine Role analysis Representation independence, confinement and access control [extended abstract] A parameterized type system for race-free Java programs Adoption and focus Using data groups to specify and check side effects Region-based memory management in cyclone The Java Language Specification Ownership types for safe programming Ownership, encapsulation and the disjointness of type and effect Alias annotations for program understanding The Story of O2 An Object-Oriented Effects System Providing Persistent Objects in Distributed Systems Simple Ownership Types for Object Containment Scalable and Recoverable Implementation of Object Evolution for the PJama1 Platform Towards Alias-Free Pointers Iterators and Encapsulation --CTR Pradeep Kumar, Modal logic & ownership types: uniting three worlds, Companion to the 21st ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications, October 22-26, 2006, Portland, Oregon, USA David L. Heine , Monica S. Lam, A practical flow-sensitive and context-sensitive C and C++ memory leak detector, ACM SIGPLAN Notices, v.38 n.5, May Ana Milanova, Precise identification of composition relationships for UML class diagrams, Proceedings of the 20th IEEE/ACM international Conference on Automated software engineering, November 07-11, 2005, Long Beach, CA, USA Alex Potanin , James Noble , Robert Biddle, Generic ownership: practical ownership control in programming languages, Companion to the 19th annual ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications, October 24-28, 2004, Vancouver, BC, CANADA Yin Liu , Ana Milanova, Ownership and Immutability Inference for UML-Based Object Access Control, Proceedings of the 29th International Conference on Software Engineering, p.323-332, May 20-26, 2007 Alex Potanin , James Noble , Dave Clarke , Robert Biddle, Featherweight generic confinement, Journal of Functional Programming, v.16 n.6, p.793-811, November 2006 Adrian Birka , Michael D. Ernst, A practical type system and language for reference immutability, ACM SIGPLAN Notices, v.39 n.10, October 2004 Protecting representation with effect encapsulation, ACM SIGPLAN Notices, v.41 n.1, p.359-371, January 2006 Ana Milanova, Composition inference for UML class diagrams, Automated Software Engineering, v.14 n.2, p.179-213, June 2007 Matthew S. Tschantz , Michael D. Ernst, Javari: adding reference immutability to Java, ACM SIGPLAN Notices, v.40 n.10, October 2005 Pratibha Permandla , Michael Roberson , Chandrasekhar Boyapati, A type system for preventing data races and deadlocks in the java virtual machine language: 1, ACM SIGPLAN Notices, v.42 n.7, July 2007 Yu David Liu , Scott F. Smith, Interaction-based programming with classages, ACM SIGPLAN Notices, v.40 n.10, October 2005 Wei-Ngan Chin , Florin Craciun , Shengchao Qin , Martin Rinard, Region inference for an object-oriented language, ACM SIGPLAN Notices, v.39 n.6, May 2004 Nathanael Schrli , Andrew P. Black , Stphane Ducasse, Object-oriented encapsulation for dynamically typed languages, ACM SIGPLAN Notices, v.39 n.10, October 2004 Derek Rayside , Lucy Mendel , Daniel Jackson, A dynamic analysis for revealing object ownership and sharing, Proceedings of the 2006 international workshop on Dynamic systems analysis, May 23-23, 2006, Shanghai, China Tian Zhao , Jens Palsberg , Jan Vitek, Type-based confinement, Journal of Functional Programming, v.16 n.1, p.83-128, January 2006 Alex Potanin , James Noble , Dave Clarke , Robert Biddle, Generic ownership for generic Java, ACM SIGPLAN Notices, v.41 n.10, October 2006 Chandrasekhar Boyapati , Alexandru Salcianu , William Beebee, Jr. , Martin Rinard, Ownership types for safe region-based memory management in real-time Java, ACM SIGPLAN Notices, v.38 n.5, May David A. Naumann, Observational purity and encapsulation, Theoretical Computer Science, v.376 n.3, p.205-224, May, 2007 Chandrasekhar Boyapati , Barbara Liskov , Liuba Shrira , Chuang-Hue Moh , Steven Richman, Lazy modular upgrades in persistent object stores, ACM SIGPLAN Notices, v.38 n.11, November David A. Naumann , Mike Barnett, Towards imperative modules: reasoning about invariants and sharing of mutable state, Theoretical Computer Science, v.365 n.1, p.143-168, 10 November 2006 Peter Mller , Arnd Poetzsch-Heffter , Gary T. Leavens, Modular invariants for layered object structures, Science of Computer Programming, v.62 n.3, p.253-286, 15 October 2006
software upgrades;ownership types;object encapsulation
604166
On the computational complexity of assumption-based argumentation for default reasoning.
Bondarenko et al. have recently proposed an abstract framework for default reasoning. Besides capturing most existing formalisms and proving that their standard semantics all coincide, the framework extends these formalisms by generalising the semantics of admissible and preferred arguments, originally proposed for logic programming only.In this paper we analyse the computational complexity of credulous and sceptical reasoning under the semantics of admissible and preferred arguments for (the propositional variant of) the instances of the abstract framework capturing theorist, circumscription, logic programming, default logic, and autoepistemic logic. Although the new semantics have been tacitly assumed to mitigate the computational hardness of default reasoning under the standard semantics of stable extensions, we show that in many cases reasoning under the admissibility and preferability semantics is computationally harder than under the standard semantics. In particular, in the case of autoepistemic logic, sceptical reasoning under preferred arguments is located at the fourth level of the polynomial hierarchy, whereas the same form of reasoning under stable extensions is located at the second level.
Introduction Bondarenko et al. [1] show that many logics for default reasoning, i.e., theorist [25], (many cases of) circumscription [20], Default Logic (DL) [26], Nonmonotonic Modal Logic [21], Autoepistemic Logic (AEL) [22], and Logic Programming (LP) can be understood as special cases of a single abstract framework. The standard semantics of all these logics can be understood as sanctioning a set of assumptions as a stable extension of a given theory, formulated in an underlying monotonic logic, iff the set of assumptions does not attack itself and it attacks every assumption not in the set. In abstract terms, an assumption can be attacked if its contrary can be proved, in the underlying monotonic logic, possibly with the aid of other conflicting assumptions. Bondarenko et al. also propose two new semantics generalising, respectively, the admissibility semantics [8] and the semantics of preferred extensions [8] or partial stable models [27] for LP. In abstract terms, a set of assumptions is an admissible argument of a given theory, formulated in an underlying monotonic logic, iff it does not attack itself and it attacks all sets of assumptions which attack it. A set of assumptions is a preferred argument iff it is a maximal (with respect to set inclusion) admissible argument. The new semantics are more general than the stability semantics since every stable extension is a preferred (and admissible) argument, but not every preferred argument is a stable extension. Moreover, the new semantics are more liberal because for most concrete logics for default reasoning, admissible and preferred arguments are always guaranteed to exist, whereas stable extensions are not. Fi- nally, reasoning under the new semantics appears to be computationally easier than reasoning under the stability semantics. Intuitively, to show that a given sentence is justified by a stable extension, it is necessary to perform a global search amongst all the assumptions, to determine for each such assumption whether it or its contrary can be derived, independently of the sentence to be justified. 1 For the semantics of admissible and preferred arguments, however, a "local" search suffices. First, one has to construct a set of assumptions which, together with the given theory, (monotonically) derives the sentence to be justified, and then one has to augment the constructed set with further assumptions to defend it against all attacks [18, 6, 7]. 1 See [18, 7] for a more general discussion of the problems associated with computing the stability semantics. However, from a complexity-theoretic point of view, it seems unlikely that the new semantics lead to better lower bounds than the standard semantics since all the "sources of complexity" one has in default reasoning are still present. There are potentially exponentially many assumption sets sanctioned by the semantics. Further, in order to test whether a sentence is entailed by a particular argument, one has to reason in the underlying monotonic logic. For this reason, one would expect that reasoning under the new semantics has the same complexity as under the stability semantics, i.e., it is complete for the first level of the polynomial hierarchy for LP and on the second level for logics with full propositional logic as the underlying logic [3]. However, previous results on the expressive power of queries by Sacc-a [28] suggest that this is not the case for LP. Indeed, Sacc-a's results imply that reasoning under the preferability semantics for LP is at the second level of the polynomial hierarchy. In this paper we extend this analysis and provide complexity results for reasoning in the propositional variants of theorist, circumscription, LP, DL, and AEL under the new semantics. As it turns out, reasoning under the new semantics can be much harder than reasoning under the standard semantics. In particular, we show that sceptical reasoning in DL under the preferability semantics is on the third level of the polynomial hierarchy, that credulous reasoning in AEL under the admissibility semantics is on the third level of the polynomial hierarchy, and that sceptical reasoning in AEL under the preferability semantics is on the fourth level of the polynomial hierarchy. The paper 2 is organised as follows. Section 2 summarises relevant features of the abstract framework of [1], its semantics and concrete instances. Section 3 gives complexity theory background and introduces the reasoning problems. Section 4 gives generic upper bounds for credulous and sceptical reasoning, parametric with respect to the complexity of the underlying monotonic logics. The generic results are instantiated to provide upper bounds for concrete instances of the abstract framework. Section 5 gives then completeness results for theorist and circumscription, Section 6 gives the completeness results for LP and DL, and Section 7 gives the completeness results for AEL. Section 8 discusses the results and concludes. This paper combines earlier papers [4, 5] by the same authors and it contains all formal proofs of the results in full. Reasoning via Argumentation Assume a deductive system (L, R), where L is some formal language with countably many sentences and R is a set of inference rules inducing a monotonic derivability notion '. Given a theory T L and a formula 2 L, is the deductive closure of T . Then, an abstract (assumption-based) framework is a triple hT; A; i, where T; A L and is a mapping from A into L. T , the theory, is a set of beliefs, formulated in the underlying language, and can be extended by subsets of A, the set of assumptions. Indeed, an extension of an abstract framework hT; A; i is a theory Th(T [ with A (sometimes an extension is referred to simply as T [ or ). Finally, given an assumption 2 A, denotes the contrary of . Theorist can be understood as a framework hT; A; i where T and A are both arbitrary sets of sentences of classical (first-order or propositional) logic and the contrary of an assumption is just its negation. ' is ordinary classical provability Many cases of circumscription 3 can be understood similarly, except that the assumptions are negations of atomic sentences :p(t), for all predicates p which are minimised, and atomic sentences q(t) or their negations, for all predicates q which are fixed. LP is the instance of the abstract framework hT; A; i where T is a logic pro- gram, the assumptions in A are all negations not p of atomic sentences p, and the contrary not p of an assumption is p. ' is Horn logic provability, with assump- tions, not p, understood as new atoms p , as in [12]. DL is the instance of the abstract framework hT; A; i where the monotonic logic is first-order logic augmented with domain-specific inference rules of the are sentences in classical logic. T is a classical theory and A consists of all expressions of the form M where is a sentence of classical logic. The contrary M of an assumption M is :. AEL has, as the underlying language L, a modal logic with a modal operator L, but the inference rules are those of classical logic. The assumptions have the form :L or L. The contrary of :L is , and the contrary of L is :L. 3 Namely, all cases where every model of the theory to be circumscribed is a Herbrand model of the theory, see [1] for more details. Given an abstract framework hT; A; i and an assumption set A: attacks an assumption 2 A iff attacks an assumption set 0 A iff attacks some assumption 2 Given that an assumption set A is closed iff the standard semantics of extensions of theorist [25], minimal models of circumscription [20], extensions of DL [26], stable expansions of AEL [22], and stable models of LP [14] correspond to the stability semantics of abstract frameworks, where an assumption set A is stable iff 1. is closed, 2. does not attack itself, and 3. attacks each assumption 62 . Assumption sets are always closed in the case of LP and DL. Frameworks with this property are referred to as flat [1]. Assumption sets might not be closed in the case of AEL. For example, given the theory in AEL, the empty assumption set is not closed. Furthermore, assumption sets might not be closed in the case of theorist and circumscription. For example, if a formula is an assumption in theorist that is already derived by the theory, then the empty assumption set is not closed. A stable extension is an extension Th(T [) for some stable assumption set . The standard semantics of circumscription [20] corresponds to the intersection of all stable extensions of the abstract framework corresponding to circumscription Bondarenko et al. argue that the stability semantics is unnecessarily restric- tive, because it insists that an assumption set should take a stand on every issue (assumption). Thus, they define new semantics for the abstract framework, by generalising the argumentation-theoretic reformulation of [17] for the semantics originally proposed for LP by Dung [8]. The new semantics are defined in terms of "admissible" and "preferred" sets of assumptions/extensions. An assumption set A is admissible iff 1. is closed, 2. does not attack itself, and 3. for all closed sets of assumptions 0 A, if 0 attacks then attacks Maximal (with respect to set inclusion) admissible assumption sets are called preferred. In this paper we use the following terminology: an admissible (pre- ferred) argument is an extension Th(T [ ) for some admissible (preferred) assumption set . Bondarenko et al. show that preferred arguments correspond to preferred extensions [8] and partial stable models [27] for LP. Every stable assumption set/extension is preferred (and thus admissible) [1, Theorem 4.6], but not vice versa, in general. However, if the framework is nor- mal, i.e., if every maximal closed assumption set that does not attack itself is a stable set, then the semantics of preferred and stable assumption sets coincide [1, Theorem 4.8]. Theorist and circumscription are normal frameworks, which implies that stability and preferability semantics are identical in these cases. In the sequel we will use the following: preferred assumption set is (trivially) admissible and every admissible assumption set is a subset of some preferred assumption set; The empty assumption set is always admissible, trivially, for all flat frameworks; preferred extension is stable and every stable extension is pre- ferred, for all normal frameworks. Moreover, for any given semantics amongst the stability, admissibility and preferability semantics, we will use the terminology that "a set of assumptions is sanctioned by a semantics" to mean that the set of assumptions is stable/admissible/preferred, respectively. Reasoning Problems and Computational Complexit We will analyse the computational complexity of the following reasoning problems for the propositional variants of the frameworks for theorist, circumscription, LP, DL, and AEL under admissibility and preferability semantics: the credulous reasoning problem, i.e., the problem of deciding for any given sentence assumption set sanctioned by the semantics; the sceptical reasoning problem, i.e., the problem of deciding for any given sentence ' 2 L whether ' 2 Th(T [ ) for all assumption sets sanctioned by the semantics. Instead of the sceptical reasoning problem, we will often consider its complementary problem, i.e. the co-sceptical reasoning problem, i.e, the problem of deciding for any given sentence ' whether ' 62 Th(T [ ) for some assumption set sanctioned by the semantics. Note that we are not advocating co-sceptical reasoning as interesting or useful epistemologically. Rather, we use it to support our complexity analysis. In addition, we will consider a sub-problem of all these problems, namely: the assumption set verification problem, i.e., the problem of deciding whether a given set of assumptions is sanctioned by the semantics. We briefly revise fundamental notions from complexity theory. 4 We assume familiarity with the complexity classes P, NP, and co-NP, and with the notions of many-one-reductions, Turing reductions, and hardness and completeness with respect to these reductions. The complexity of the above problems for all frameworks and semantics we consider is located at the lower end of the polynomial hierarchy. This is a (pre- sumably) infinite hierarchy of complexity classes above NP defined by using oracle machines, i.e. Turing machines that are allowed to call a subroutine-the oracle-deciding some fixed problem in constant time. Let C be a class of decision problems. Then, P C denotes the class of problems that can be solved on a deterministic oracle machine in polynomial time with an oracle that decides a problem in C. In general, for any class X defined by resource bounds, X C denotes the class of problems decidable on a Turing machine with a resource bound given 4 Good textbooks covering the notions we introduce here have been written by Garey and Johnson [13] and Papadimitriou [24]. by X and an oracle for a problem in C. 5 Based on these notions, the sets p and p are defined as follows: 6 The "canonical" complete problems are SAT for p 1 =NP and k-QBF for p is the problem of deciding whether the quantified boolean | {z } alternating quantifiers starting with 9 is true, for a formula . The above problems remain complete for their respective classes when the innermost quantifier is 9 and the formula is in 3CNF, as well as when the innermost quantifier is 8 and the formula is in 3DNF [30]. The complementary of a k-QBF problem, denoted by co-k-QBF, is complete for p k . All problems in the polynomial hierarchy can be solved in polynomial time these problems can be solved by worst-case exponential time algorithms. Thus, the polynomial hierarchy might not seem too meaning- ful. However, different levels of the polynomial hierarchy differ considerably in practice, e.g. methods working for moderately sized instances of NP-complete problems do not work for p -complete problems. The complexity of the problems we are interested in has been extensively studied for existing logics for default reasoning under the standard, stability semantics [3, 15, 23, 19, 29, 2, 10]. Table 1 gives a partial summary of these results for the different logics. We note here that the semantics of circumscription has been originally proposed with respect to sceptical reasoning only. In this case, as shown in [1], reasoning in circumscription (restricted to Herbrand models) coincides with sceptical reasoning in theorist under the stability semantics. Moreover, we can naturally extend circumscription and define its credulous reasoning via a one-to-one correspondence with credulous reasoning in theorist under the stability semantics (see [1] for more details). Hence the complexity result for credulous reasoning in circumscription is a direct consequence of the respective result for 5 Note that because using an oracle for a problem from C is identical to using an oracle for a problem from co-C, we have X . For this reason, one usually does not use the notation 6 The super-script p is only used to distinguish these classes from the analogous classes in the Kleene hierarchy. theorist. The complexity results for reasoning in circumscription under the admissibility semantics, presented later in the paper, can be understood in a similar way. credulous sceptical reasoning reasoning Logic Programming NP-complete co-NP-complete Theorist p Circumscription p-complete p-complete Autoepistemic Logic p-complete p-complete Table 1: Existing computational complexity results for the stability semantics 4 Generic Upper Bounds In this section we give a number of generic upper bounds for reasoning under the admissibility and preferability semantics that are parametric on the complexity of the derivability problem in the underlying monotonic logic. This allows us to derive upper bounds for a wide range of concrete logics for default reasoning. In the case of LP, the underlying logic is propositional Horn logic, hence the derivability problem is P-complete (under log-space reductions) [24, p. 176]. In the case of theorist, circumscription and AEL, the underlying logic is classical propositional logic, hence the derivability problem is co-NP-complete. Finally, in the case of DL, the underlying monotonic derivability is classical derivability extended with domain-specific inference rules. However, these extra inference rules do not increase the complexity of reasoning. Indeed, it is known (e.g. see [16, p.90]) that for any DL-like propositional monotonic rule system S, checking whether S 6j= ' is NP-complete. Therefore, the following proposition follows immediately. Proposition 1 Given a DL framework hT; A; i, deciding for a sentence ' 2 L and an assumption set A whether '2Th(T [ ) is co-NP-complete. In order to decide the credulous and co-sceptical reasoning problems, one can apply the following non-deterministic algorithm: Algorithm 2 1. Guess an assumption set, 2. verify that it is sanctioned by the semantics, and 3. verify that the formula under consideration is derivable from the set of assumptions and the monotonic theory or not derivable from it, respectively. From this it follows that credulous reasoning and co-sceptical reasoning is in the complexity class NP C , provided reasoning in the underlying logic is in C and the verification that an assumption set is sanctioned by the semantics can be done with polynomially many calls to a C-oracle. For the stability semantics, we need indeed only polynomially many C-oracle calls in order to verify that the assumption set is not self-attacking and that it is closed and attacks all assumptions 62 . However, for the admissibility and preferability semantics the verification step does not seem to be so easy, as suggested by the following theorem. Theorem 3 For frameworks with an underlying monotonic logic with a derivability problem in C, the assumption set verification problem is in P C under the stability semantics, in co-NP C under the admissibility semantics, and in co-NP NP C under the preferability semantics. Proof: The first claim follows from the argument above that polynomially many C-oracle calls are sufficient to verify that an assumption set is stable. In order to prove the second claim, we give the following nondeterministic, polynomial-time algorithm that uses a C-oracle and decides whether A is not admissible: 1. Check whether is closed. If not, succeed, otherwise continue. 2. Guess an assumption set 0 A. 3. Verify that 0 is closed, using jA 0 j C-oracle calls. 4. Verify that 0 attacks , using jj C-oracle calls. 5. Verify that does not attack 0 , using calls. Obviously, this algorithm succeeds iff is not admissible, i.e., it decides the complement of the assumption set verification problem, thus proving the claim. In order to prove the third claim, for any assumption set A that we want to verify, we give the following nondeterministic, polynomial-time algorithm that uses an NP C -oracle: 1. Check whether is admissible, using one NP C -oracle call (by the second claim). If it is not, succeed. Otherwise continue. 2. Guess an assumption set 0 . 3. Check whether 0 is admissible, using one NP C -oracle call (by the second claim). If it is, succeed. Otherwise fail. Obviously, this algorithm succeeds iff is not preferred. This means it decides the complement of the assumption set verification problem, thus proving the claim. Furthermore, in the general case, there does not appear to be more efficient algorithms for the assumption set verification problems than the ones given in Theorem 3. For the special flat and normal frameworks, however, more efficient algorithms can be found, as demonstrated by the following two theorems. Theorem 4 For flat frameworks with an underlying monotonic logic with a derivability problem in C, the assumption set verification problem is in P C under the admissibility semantics, and in co-NP C under the preferability semantics. Proof: We prove the first claim by giving the following deterministic, polynomial-time algorithm using a C-oracle, for any assumption set A that we want to verify: 1. Check whether attacks itself, using polynomially many C-oracle calls. If it does, succeed. Otherwise continue. 2. Compute does not attack g, using jA j calls to a C-oracle. 3. Check whether A [ attacks , using polynomially many C-oracle calls. If it does, succeed. Otherwise fail. It is easy to see that if this algorithm succeeds then is not admissible, as A [ attacks but, by (2), does not attack A and, by (1), does not attack itself. 7 Moreover, if the algorithm fails then is admissible. Indeed, let 0 be any attack against . If 0 A [, then, by monotonicity of the underlying logic, A [ attacks , thus contradicting that the algorithm fails. Therefore, 0 6 A [ . Let 2 0 A . By (2), attacks . Thus, attacks 0 , and, by (1), is admissible. The second claim of the theorem follows by reconsidering the algorithm used in the proof of Theorem 3 for the third claim, but using P C -oracle calls at steps (1) and (3). Due to (Prop 3 ), for normal frameworks the assumption set verification task under the preferability semantics is easier, as it can be reduced to that under the stability semantics. Therefore, the following result is a direct corollary of Theorem 3. Proposition 5 For normal frameworks with an underlying monotonic logic with a derivability problem in C, the assumption set verification problem under the preferability semantics is in P C . We could now apply directly algorithm 2 described above in combination with the above results for deriving upper bounds for the credulous and sceptical reasoning problems. However, some of the upper bounds thus obtained can be reduced, as follows. Directly from (Prop 1 ), we have the following result. 7 Note that if the framework is not flat, then the assumption set A [ might not be closed. Therefore, even if (3) succeeds, can still be admissible, as it may attack an assumption that is derivable from A [ . Proposition 6 Credulous reasoning under the admissibility semantics is equivalent to credulous reasoning under the preferability semantics. Thus, it follows directly that credulous reasoning under the admissibility semantics has the same upper bound as credulous reasoning under the preferability semantics. In particular, for normal frameworks we get the same upper bound for credulous reasoning under the admissibility semantics as for the stability semantics In addition, co-sceptical and sceptical reasoning under the admissibility semantics is often much simpler than suggested by the upper bounds of the respective assumption set verification problem combined with algorithm 2. For example, in flat frameworks hT; A; i the sceptical reasoning problem reduces to the classical derivability from the theory T , because of (Prop 2 ). This might be the case even for non-flat frameworks. We call an assumption-based framework hT; A; i simple iff there is no admissible assumption set whenever T is inconsistent in the underlying monotonic logic 8 , and otherwise there exists a minimal (with respect to set inclusion) admissible set Proposition 7 For flat frameworks and for simple frameworks with an underlying monotonic logic with a derivability problem in C, the sceptical reasoning problem under the admissibility semantics is in C. All the results in this section combined with algorithm 2 give the next the- orem, specifying upper bounds for the reasoning problems for all the types of frameworks considered so far. Theorem 8 Upper bounds for the different reasoning problems, types of frame- works, and semantics are as specified in the following table: Frameworks Stability Admissibility Preferability cred. scept. cred. scept. cred. scept. general NP C co-NP C NP NP C co-NP NP NP C normal NP C co-NP C NP C co-NP NP C flat NP C co-NP C NP C C NP C co-NP NP C simple NP C co-NP C NP NP C co-NP NP NP C 8 Note that not all deductive systems underlying an abstract framework are equipped with a notion of inconsistency. For example, the instance of the framework for LP is not. Moreover, note that the notion of inconsistency is a separate notion from that of contrary. Proof: The results for the stability semantics follow from applying algorithm 2, with step (2) of the algorithm solvable by a call to a P C oracle (by Theorem 3), and step (3) solvable by a call to a C-oracle. This gives an upper bound of NP P C , which coincides with NP C , for both the credulous and co-sceptical reasoning problems. The results for the admissibility semantics in the first row and for sceptical reasoning under the preferability semantics in the first row follow by the same argument. The result for credulous reasoning under the preferability semantics in the first row follows from Proposition 6 and the corresponding result for the admissibility semantics. The results for admissibility and preferability semantics in the second row are justified as follows. Credulous reasoning under admissibility and preferability semantics as well as co-sceptical reasoning under the preferability semantics can be shown to be in NP P C , which equals NP C , by using algorithm 2 and applying Propositions 6 and 5. Further, the upper bound for sceptical reasoning under the admissibility semantics is the general upper bound given in the first row. The results for admissibility and preferability semantics in the third row follow by applying Proposition 7 for sceptical reasoning under admissibility and, for the other columns, algorithm 2 and Theorem 4. Finally, the results for admissibility and preferability semantics in the fourth row are the general results in the first row, with the exception of the result for sceptical reasoning under the admissibility semantics given by Proposition 7. As shown in the table, the upper bounds derived for sceptical reasoning under the admissibility semantics are sometimes lower than those derived for sceptical reasoning under the stability semantics. However, in these cases it amounts to deriving monotonic conclusions from the theory T and ignoring the assumptions completely. In other words, in these cases, default reasoning is trivialised. 5 Simple, Normal Frameworks: Theorist and Cir- cumscription The concrete frameworks for theorist and circumscription are normal [1] and sim- ple, as shown below. Lemma 9 The frameworks for theorist and circumscription are simple. Proof: Circumscription is a special instance of theorist. Thus, we only need to prove the theorem for theorist. If the given theorist theory T is inconsistent then the corresponding framework admits no admissible argument, as any closed assumption set attacks itself. Assume that T is consistent. Then, we only need to prove that attacks every closed assumption set 0 which attacks . Now, if ;, then there is no set 0 that attacks . If 6= ;, then 0 attacks iff T [ 0 is inconsistent and, as 0 is closed, A. Thus, necessarily attacks 0 . For both frameworks, the credulous and sceptical reasoning problems reach the respective upper bounds specified in Theorem 8. Indeed, due to Proposition 6 and (Prop 3 ), credulous reasoning under admissibility and preferability semantics is identical to credulous reasoning under the standard, stability semantics, leading to the result that the complexity is also identical. Thus, the next proposition follows immediately from the results in Table 1. Credulous reasoning in theorist and circumscription under the admissibility and preferability semantics is p-complete. Directly by (Prop 3 ), sceptical reasoning under the preferability semantics is identical to sceptical reasoning under the stability semantics. Thus, the next proposition follows immediately from the results in Table 1. Proposition 11 Sceptical reasoning in theorist and circumscription under the preferability semantics is p-complete. Finally, sceptical reasoning under the admissibility semantics is trivial because the frameworks are simple and sceptical reasoning reduces to monotonic derivability from the theory. Proposition 12 Sceptical reasoning in theorist and circumscription frameworks under the admissibility semantics is co-NP-complete. In other words, for the concrete frameworks for theorist and circumscription, we either get the same results as under the stability semantics or we get trivial results. 6 Flat Frameworks: Logic Programming and Default Reasoning As in the case of theorist and circumscription, in the case of LP and DL the upper bounds specified in Theorem 8 are tight. Since the concrete framework for LP is flat, sceptical reasoning under the admissibility semantics reduces to reasoning in the underlying monotonic logic, i.e., derivability in propositional Horn theories, which is P-complete. Proposition 13 Sceptical reasoning in LP under the admissibility semantics is P-complete. From Theorem 8, again because the LP framework is flat, credulous reasoning under the admissibility and preferability semantics is in NP P , which equals NP. NP-completeness can be obtained as a direct corollary of an earlier result by Sacc-a [28], that the expressive power of DATALOG : queries under the "pos- sible M-stable semantics" (corresponding to credulous reasoning under the admissibility and preferability semantics) coincides with DB-NP, i.e. the class of all databases that are recognisable in NP. From this result the following theorem immediately. Theorem 14 Credulous reasoning in LP under the admissibility and preferability semantics is NP-complete. Again from Theorem 8, sceptical reasoning in LP under the preferability semantics is in co-NP NP P , which coincides with p 2 -completeness can be obtained again as a direct corollary of the result proven again by Sacc-a [28], that the expressive power of DATALOG : queries under the "definite M-stable semantics" (corresponding to sceptical preferability semantics) coincides with the class DB- 2, i.e. the class of all databases that are recognisable in DB- p. From this result the following theorem follows immediately. Theorem 15 Sceptical reasoning in LP under the preferability semantics is p- complete. Therefore, for LP, credulous reasoning under admissibility and preferability semantics has the same complexity as under the stability semantics (see Table 1), whereas sceptical reasoning is either one level lower but trivial, under the admissibility semantics, or one level higher, under the preferability semantics, than under the stability semantics. Since the instance of the framework for DL is flat, sceptical reasoning under the admissibility semantics reduces to reasoning in the underlying monotonic logic, i.e., derivability in propositional classical logic, which is co-NP-complete. Proposition Sceptical reasoning in DL under the admissibility semantics is co-NP-complete. By Proposition 6, credulous reasoning under the preferability semantics coincides with credulous reasoning under the admissibility semantics. From Theorem credulous reasoning under the admissibility and preferability semantics is in NP NP , which coincides with p. p-hardness, and therefore p-completeness, can be proven by a reduction from 2-QBF. Theorem 17 Credulous reasoning in DL under the admissibility and preferability semantics is p Proof: By Proposition 6, it suffices to prove the theorem for the admissibility semantics. Membership follows from Theorem 8. To prove hardness, we use a straightforward reduction from 2-QBF to the credulous reasoning problem under the admissibility semantics. Assume the quantified boolean formula 9p formula in 3DNF over the propositional variables p 1 We construct a DL theory (;; D) such that the given quantified boolean formula is true iff some admissible argument for the framework corresponding to (;; D) contains . Let D consists of the default rules for each simulating the choice of a truth value for each propositional variable p i in . Obviously, (;; D) can be constructed in log-space. Moreover, it is easy to see that the given 2-QBF is true iff there exists an admissible extension of the framework corresponding to (;; D) containing . Again from Theorem 8, in DL, sceptical reasoning under the preferability semantics is in co-NP NP NP , which coincides with p. p-hardness, and therefore 3 -completeness, can be proven by a reduction from 3-QBF. Theorem Sceptical reasoning in DL under the preferability semantics is p- complete. Proof: Membership follows from Theorem 8. To prove hardness, we use a reduction from 3-QBF to the co-sceptical reasoning problem under the preferability semantics. Assume the quantified boolean with a formula in 3CNF over the propositional variables We construct a DL theory (;; D) such that is true iff some sentence F is not contained in some preferred argument for the framework corresponding to (;; D). The language of (;; D) contains atoms well as atoms t intuitively holding true iff a truth value for the variables respectively, has been chosen. D consists of the default rules for each simulating the choice of a truth value for each to prohibit choices of truth values for all the q j 's that render satisfiable, for each to enforce that truth value choices are made either for all q j 's or for no q j and that truth value choices are made either for all 's or for none of the p i 's and q j 's, and finally for each to guarantee that no admissible assumption set contains M or any of M:t i and M:s j . Obviously, (;; D) can be constructed in log-space. Moreover, we prove that is true iff there is a preferred argument not containing F =^ j=1;:::;m s j . In other words, the 3-QBF can be reduced to co-sceptical reasoning in DL under the preferability semantics. In the sequel we will use the following terminology. If v is a truth assignment to the p i 's, we denote by p v the assumption set Similarly, if u is a truth assignment to the q j 's, we denote by q u the assumption set First of all, it is obvious that no admissible assumption set can contain any of the assumptions M, M:s i , M:t i (as, if it did, it would attack itself). Furthermore, it is easy to see that for any truth assignment v to the p i 's, the set p v is an admissible set. Moreover, every preferred assumption set must contain a set p v for some truth assignment v to the p i 's. Finally, if p v is not preferred, then there exists a truth assignment u to the q i 's such that p u is preferred. Assume that is true under a particular truth assignment v to the p i 's. Obvi- ously, p v does not derive F =^ j=1;:::;m s j . We show that the set p v is a preferred assumption set. Suppose that it is not, and that we can extend p v by the set q u , for some truth assignment u to the q i 's, thus obtaining an admissible set. Then, p attacks the attack fMg, i.e. : belongs to the extension given by p u . As a consequence, is not true under the truth assignment v: contradiction. Conversely, assume that the framework corresponding to (;; D) admits a preferred argument that does not derive F =^ j=1;:::;m s j . We prove that is true. there exists some truth assignment v to the p i 's such that p v . Since is preferred and it does not contain F , none of the sets p every possible truth assignment u to the q i 's, is admissible. This means that none of these sets of assumptions can counter attack the attack fMg and derive :. Therefore, is true. Therefore, as in the LP case, in the DL case credulous reasoning under the admissibility and preferability semantics has the same complexity as under the stability semantics (see Table 1), whereas sceptical reasoning is either one level lower but trivial, under the admissibility semantics, or one level higher, under the preferability semantics, than under the stability semantics. Note that similar results to the one obtained above for DL have been recently obtained for disjunctive logic programming [11]. 7 General Frameworks: Autoepistemic Logic AEL is neither flat, simple, nor normal. This means that we cannot expect any simplifications when reasoning in AEL frameworks. As a matter of fact, the upper bounds for general frameworks, which apply of course, are also tight for AEL. By Proposition 6, credulous reasoning under the preferability semantics coincides with credulous reasoning under the admissibility semantics. From Theorem 8, since the reasoning problem in the underlying monotonic logic for AEL is classical reasoning in propositional logic (coNP-complete), credulous reasoning under the admissibility and preferability semantics is in NP NP NP , which coincides with p. p-hardness, and therefore p-completeness, can be proven by a reduction from 3-QBF. Theorem 19 Credulous reasoning in AEL under the admissibility and preferability semantics is p 3 -complete. Proof: By Proposition 6, it suffices to prove the theorem for the admissibility semantics. Membership follows from Theorem 8. To prove hardness, we use a reduction from 3-QBF to the credulous reasoning problem under the admissibility semantics. Assume the following quantified boolean with a formula in 3CNF over the propositional variables We construct an AEL theory T such that is true iff some sentence F is contained in some admissible argument for the framework corresponding to T . The language of T contains atoms as atoms t intuitively holding if a truth value for the variables p 1 has been chosen, and an atom s used to prevent that any truth value for the q j 's can be chosen. T consists of the sentences: for each Obviously, T can be constructed in log-space. Now we prove that the frame-work corresponding to T admits an admissible extension containing iff is true. This means that the given 3-QBF can be reduced to credulous reasoning under the admissibility semantics. Assume that the framework corresponding to T admits an admissible extension deriving F . Then, for each is part of , for F to be derived by it. Further, :L: must be part of , for to be closed, and thus admissible. Finally, none of the assumptions :L:q i , :Lq i can be part of , for otherwise , if closed, would attack itself and thus be non-admissible. Consider any assumption set A that attacks . A must attack one of the assumptions or :L:. However, if A attacked any of :L:p i , :Lp i , then would immediately counter-attack A. Therefore, for A to be an assumption set that can possibly render non-admissible, it must make the same choices on the p i 's as , and attack :L:. For A to attack :L:, then A must derive :, by including, in addition to the assumptions from f:L:p chosen by , assumptions from the set f:L:q j ; :Lq j g j=1;:::;m . Such choices cannot be counter-attacked by without making it self-attacking. Therefore, since is admissible, no such A exists. This means that, for the given choices on the in , no choices for the q j 's exist that make : true. In other words, for the given choice of the p i in , and for all choices of the truth values for the q j 's, there exists an assignment of truth values to the r l 's that makes true, which implies that is necessarily true. Conversely, assume that there is no admissible extension of the framework corresponding to T deriving F above. Then, regardless of the choices for the p i 's, there is always an attack on :L:, deriving :, that cannot be counter-attacked while keeping the candidate set of assumptions non-self-attacking. Then, by the arguments presented above, the given 3-QBF formula cannot be true. Again from Theorem 8, sceptical reasoning under the admissibility and preferability semantics in AEL is in co-NP NP NP , which coincides with p. p-hardness, and therefore p 3 -completeness, can be proven by a reduction from 3-QBF. Theorem 20 Sceptical reasoning in AEL under the admissibility semantics is p- complete. Proof: Membership follows from Theorem 8. To prove hardness, we use a reduction from 3-QBF to the co-sceptical reasoning problem under the admissibility semantics. We use the reduction in the proof of the previous Theorem 19, but extend the theory T constructed there to the theory T g. Any admissible set must contain the assumptions :L: and L V for to be closed. Furthermore, any admissible extension of T 0 must contain V because otherwise it is attacked by :L V having a counter-attack. From this fact and the above observations it follows that T 0 has an admissible extension iff the given 3-QBF formula is true. Given that if no admissible extension exists all co-sceptical queries will be answered negatively, the above is equivalent to the fact that : V is not a sceptical consequence of T 0 iff is true, i.e., the construction is a log-space reduction from 3-QBF to co-sceptical reasoning under the admissibility semantics. Again from Theorem 8, in AEL, sceptical reasoning under the preferability semantics is in co-NP NP NP NP , which coincides with p. p-hardness, and therefore 4 -completeness, can be proven by a reduction from 4-QBF. Theorem 21 Sceptical reasoning in AEL under the preferability semantics is p- complete. Proof: Membership follows from Theorem 8. To prove hardness, we use a reduction from 4-QBF to the co-sceptical reasoning problem under the preferability semantics. Assume the following quantified boolean with a formula in 3DNF over the propositional variables We construct an AEL theory T such that is true iff a particular sentence F is not contained in some preferred argument of T . The language of T contains atoms as well as atoms t , the latter intuitively holding iff a truth value for the variables q 1 ;: : :; q m has been chosen. Finally, we have atoms v and w. The atom v is used to block the truth assignment to the q j 's and w is used to prohibit any choices on assumptions f:L:r h ; :Lr h g in the preferred argument. T consists of the following sentences: for each Now we claim that there exists a preferred extension not containing iff is true. First, one notes that an assumption set containing non-conflicting assumptions from the set f:L:p is an admissible set. Let be a maximal such set. Secondly, it is obvious that can be expanded (in a non-trivial way) only by adding the assumption :Lv and assumptions from the set f:L:q g. Let us call this expanded set 0 . Such a set 0 is only admissible if we make choices for all q j 's because otherwise 0 can be attacked by :Lt j (using :Lt which there is no counter-attack from 0 . Thirdly, the set 0 cannot be further expanded using assumptions from f:L:r h ; :Lr h g, because these assumptions lead to an immediate self-attack. Fourthly, an assumption set 0 containing assumptions from f:L:q together with :Lv can only be admissible if :Lv cannot be attacked by any assumption set. The only way to construct an attack A against :Lv in 0 , which is not immediately counter-attacked by 0 , would be to use all assumptions in 0 and assumptions from f:L:r h ; :Lr h g. Note that such assumptions cannot be counter- attacked by 0 . Now the only way to attack :Lv would be to make v true, and in order to do so, one has to make true. Assuming now that 0 is admissible means that for all possible choices for the r h 's, is not derivable, i.e., there is always a truth assignment to the s k 's that makes : true. This means that cannot be expanded by assumptions from together with :Lv, if under the truth assignment to the p i 's corresponding to the assumptions in , for all truth assignments to the q j 's, there is always an truth assignment to the r h 's that makes true. In other words, if there exists a preferred assumption set that does not render V Conversely, let us assume that is true. Let be an assumption set containing assumptions from f:L:p corresponding to a truth assignment to the p i 's that makes 8q This assumption set cannot be expanded to 0 by assumptions from f:L:q together with :Lv, because for any such expansion there exists a value assignment to the r h 's which makes true, corresponding to a set of choices from f:L:r h ; :Lr h g which together with 0 is an assumptions set that leads together with T to the derivation of and v, hence attacking 0 . For this reason, there exists a preferred extension not containing both :Lv and choices from f:L:q j ; :Lq j g, and hence this preferred extension does not contain V Therefore, all reasoning problems are harder in AEL under the admissibility and preferability semantics than under the stability semantics (see Table 2). In- deed, credulous reasoning under admissibility and preferability semantics is one level higher than under the stability semantics (Theorem 19); sceptical reasoning under the admissibility semantics is one level higher than under the stability semantics (Theorem 20); sceptical reasoning under the preferability semantics is two levels higher than under the stability semantics (Theorem 21). Moreover, whereas reasoning under the stability semantics has the same complexity in AEL as in DL, reasoning under the admissibility and preferability semantics is harder in AEL than in DL. Indeed, sceptical reasoning under the preferability semantics and credulous reasoning under the admissibility and preferability semantics are one level harder for AEL than for DL, and sceptical reasoning under the admissibility semantics is two levels harder. We note that various complexity results for the parsimonious and moderately grounded semantics for AEL are presented in [9]. It would be interesting to see how the semantics for AEL provided by preferred/admissible arguments (for the instance of the abstract framework for AEL) relate to the semantics of [9]. This is however outside the scope of the present paper. 8 Conclusion and Discussion We have studied the computational complexity of the credulous and sceptical reasoning problems under the new admissibility and preferability semantics for the abstract framework for default reasoning proposed in [1], for a number of concrete instances of the abstract framework, namely theorist, circumscription, logic programming (LP), default logic (DL) and autoepistemic logic (AEL). These new semantics are presented in [1] as "simpler" alternatives to the conventional stability semantics for all instances of the framework (see Section 1 for a discussion of this issue). Table 2 summarises the results we have proven (for the admissibility and preferability semantics) as well as existing results in the literature (for the stability semantics). In the table, "X -c." stands for "X -complete." We have proven the results by appealing to properties of the frameworks, whenever possible. In particular, we have used the properties (proven in [1]) that default logic and logic programming are flat frameworks and that theorist and circumscription are normal frameworks. In addition, we have introduced the new property that frameworks are simple, and proven that theorist and circumscription satisfy such property. Autoepistemic logic is a general framework in that it does not satisfy any special property amongst the ones considered. Framework Property Admissibility Preferability Stability cred. scept. cred. scept. cred. scept. AEL general p-c. p-c. p-c. p-c. p-c. p-c. 3 -c. p flat NP-c. P-c. NP-c. p -c. NP-c. co-NP-c. Theorist simple & p Circumscription normal p-c. co-NP-c. p-c. p-c. p-c. p-c. Table 2: Overview of complexity results The table shows that reasoning under the new semantics can be much harder than reasoning under the conventional stability semantics. In particular, for AEL, sceptical reasoning under the admissibility and preferability semantics is one and two level harder, respectively, than under the stability semantics, whereas credulous reasoning under both new semantics is one level harder than under the stability semantics. Also, for DL and LP, sceptical reasoning under the preferability semantics is one level harder than under the stability semantics, whereas sceptical reasoning under the admissibility semantics is one level simpler than under the stability semantics, but it reduces to monotonic reasoning in the logic underlying the framework, thus becoming a trivial form of non-monotonic reasoning. There appears to be a clash between these results and the intuition spelled out in Section 1, that admissibility and preferability arguments are seemingly easier to compute than stable extensions. However, our results are not as surprising as they might at first appear. Since the admissibility and preferability semantics do not restrict the number of extensions, one would expect that default reasoning under these semantics is as hard as under the stability semantics. The higher complexity of the sceptical reasoning problem under the preferability semantics is due to the fact that in order to verify that an assumption set is preferred, one needs to check that none of its supersets is admissible. Of course, our results do not contradict the expectation that in practice constructing admissible arguments is often easier than constructing stable extensions. For example, given the propositional logic program P [ fpg, with P any set of clauses not defining the atom p, the empty set for the query p that can be constructed "locally", without accessing P . Moreover, if P [ fpg is locally stratified or order-consistent [1], p is guaranteed to be a credulous consequence of the program under the stability semantics. Indeed, in all cases where the stability semantics coincides with the preferability semantics (e.g. for stratified and order-consistent abstract frameworks) any sound (and complete) computational mechanism for the admissibility semantics is sound (and complete) for the stability semantics. The "locality" feature of the admissibility semantics renders it a feasible alternative to the stability semantics in the first-order case, when the propositional version of the given abstract framework is infinite. For example, given the (negation- logic program: fq(f(X)); p(0)g, the empty set of assumptions is an admissible argument for the query p(0) that can be constructed "locally", even though the propositional version of the corresponding abstract framework is infinite. The complexity results in this paper show that sceptical reasoning under admissibility and preferability semantics is trivial and highly complex, respectively. However, this does not seem to matter for the envisioned applications of this se- mantics, because credulous reasoning only is required for these applications [18]. For example, in argumentation in practical reasoning in general and legal reasoning in particular, unilateral arguments are put forwards and defended against all counterarguments, in a credulous manner. Indeed, these domains appear to be particularly well suited for credulous reasoning under the admissibility semantics. In general, the results presented in this paper indicate that reasoning under the new semantics is harder. On the positive side, they indicate that the new semantics allows us to encode more complex reasoning patterns than when reasoning with the stability semantics. Acknowledgments The first author has been partially supported by the DFG as part of the graduate school on Human and Machine Intelligence at the University of Freiburg and the second author has been partially supported by the University of Cyprus. --R An abstract The Complexity of Propositional Closed World Reasoning and Circumscription. A survey of complexity results for non-monotonic logics Preferred Arguments are Harder to Compute than Stable Extensions Finding Admissible and Preferred Arguments Can Be Very Hard Synthesis of Proof Procedures for Default Reasoning Negation as hypothesis: an abductive foundation for logic programming. Reasoning with parsimonious and moderately grounded expansions. Propositional Circumscription and Extended Closed-World Reasoning are p 2 -Complete Expressive power and complexity of partial models for disjunctive deductive databases. Abduction compared with negation as failure. Computers and Intractability-A Guide to the Theory of NP-Completeness The stable model semantics for logic programming. Complexity results for nonmonotonic logics. The complexity of default reasoning under the stationary fixed point semantics. The role of abduction in logic programming. Abstract argumentation. Nonmonotonic logic: context-dependent reasoning Nonmonotonic logic II: Nonmonotonic modal theories. Semantical considerations on nonmonotonic logic. Towards automatic autoepistemic reasoning. Computational Complexity. A logical framework for default reasoning. A logic for default reasoning. --TR Semantical considerations on nonmonotonic logic A logical framework for default reasoning Towards automatic autoepistemic reasoning Propositional circumscription and extended closed-world reasoning are MYAMPERSANDPgr;<supscrpt>p</supscrpt><subscrpt>2</subscrpt>-complete Reasoning with parsimonious and moderately grounded expansions The complexity of propositional closed world reasoning and circumscription The complexity of default reasoning under the stationary fixed point semantics An abstract, argumentation-theoretic approach to default reasoning The expressive powers of stable models for bound and unbound DATALOG queries Expressive power and complexity of partial models for disjunctive deductive databases Stable models and non-determinism in logic programs with negation Computers and Intractability Preferred Arguments are Harder to Compute than Stable Extension Synthesis of Proof Procedures for Default Reasoning Word problems requiring exponential time(Preliminary Report) --CTR P. M. Dung , R. A. Kowalski , F. Toni, Dialectic proof procedures for assumption-based, admissible argumentation, Artificial Intelligence, v.170 n.2, p.114-159, February 2006 Paul E. Dunne , T. J. M. Bench-Capon, Two party immediate response disputes: properties and efficiency, Artificial Intelligence, v.149 n.2, p.221-250, October
default reasoning;non-monotonic reasoning;abduction;argumentation;assumption-based reasoning;computational complexity