Replaying live-user interactions in the off-line evaluation of critique-based mobile recommendations Supporting conversational approaches in mobile recommender systems is challenging because of the inherent limitations of mobile devices and the dependence of produced recommendations on the context. In a previous work, we proposed a critique-based mobile recommendation approach and presented the results of a live users evaluation. Live-user evaluations are expensive and there we could not compare different system variants to check all our research hypotheses. In this paper, we present an innovative simulation methodology and its use in the comparison of different user-query representation approaches. Our simulation test procedure replays off-line, against different system variants, interactions recorded in the live-user evaluation. The results of the simulation tests show that the composite query representation, which employs both logical and similarity queries, does improve the recommendation performance over a representation using either a logical or a similarity query. When searching for products and services, e-commerce web sites users are often overwhelmed by the number of options to consider. Hence they need some system support to filter out irrelevant products, compare candidates, and select the best one(s). Recommender Systems (RSs) are decision support tools that solve this information overload problem, by suggesting products and services personalized to the user's needs and preferences at her particular context.. A research direction in the RSs field, that has received much attention, is conversational RSs. In these systems the user gets her desired items through a structured human-computer dialogue [13] . Critique-based RSs are conversational RSs which, at each interaction cycle, interleave the system's product proposals with the user's critiques to the proposed products [12, 2, 9, 5, 10, 6, 4, 7, 11, 3] . The user makes a critique to a recommended item when either a feature of the item does not satisfy the user or when she wants to emphasize that it is very important to her. A user's critique, for instance, may specify an unsatisfied preference, such as "I want a restaurant cheaper than this", or confirm an important preference, such as "I prefer to rent a room with private bathroom".. There have recently been an increasing number of mobile RSs introduced in the literature [14, 5, 16, 15, 11] . In practice, designing an effective and usable mobile RS requires the recommendation methodology to overcome obstacles typically present in the mobile usage environment (e.g., smaller screens and limited input modalities) and to be suitable for mobile users' behavior.. In our previous paper [11] , we have presented a critique-based mobile RS that, to make user interaction simple and fast, supports a very limited input of explicit user preferences through system questions and is mostly based on critiques. When making critiques, the user also assigns the strength (i.e., wish or must) of the expressed preference, which helps the system correctly exploit the user's critique. To produce relevant recommendations, the system integrates both long-term and session-specific user preferences, employs a composite query representation, and exploits many sources of user related information [8] . The proposed recommendation methodology has been implemented in MobyRek, a mobile phone on-tour RS that assists on-the-go users in searching for travel products (restaurant). MobyRek was evaluated with real users with respect to: usability (i.e., functionality, efficiency, and convenience), recommendation quality, and overall user satisfaction [11] . The objective and subjective results of the on-line evaluation showed that our recommendation methodology is effective in supporting on-the-go users in making product choice decisions.. However, in the on-line evaluation we could not test different system variants that employ different user-query representation approaches. In particular, we would like to understand whether or not our composite user-query representation approach, which employs both logical and similarity query components, results in a better recommendation performance (interaction length and percentage of successful sessions) against other approaches that 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, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. employs an individual query representation based on either logical filtering or similarity-based retrieval. If being tested in the on-line evaluation, this check-experiment would have required test users to use and evaluate different system variants implementing the alternative query models. This would have required them to spend much more time and effort, and would have limited the number of variants that we could compare. This is a general problem for empirical system evaluation. Therefore, we decided to design a simulation methodology that could benefit from the interaction logs collected in the live-user test and replay such interactions with systems (slightly) different from that used in the live-user evaluation.. In this paper, we describe the proposed simulation test procedure and how it has been used to validate the hypothesized advantage of a hybrid (logical and similarity-based) query model. The simulation test procedure takes as input a dataset that comprises a historical series of recommendation sessions, where each session contains a historical sequence of user critiques. In other words, recommendation sessions, and user critiques in a session as well, are replayed in the simulation in the original order, instead of being simulated randomly. In summary, the paper makes the following contributions.. • A simulation test procedure that can be used for testing critique-based RSs in simulated environments, based on the replay of real recommendation sessions and the various ways of simulating user critiques.. • A number of simulation tests that show the advantage of the composite query representation (i.e., using both logical and similarity queries) over a single query representation (i.e., using either logical or similarity query) in term of the rate of successful recommendation sessions.. The remainder of the paper is organized as follows. Section 2 discusses the product representation and the user preferences model, followed by the description of the recommendation process. The hypothesis on the user-query representation is posed and discussed in section 3. In section 4, we discuss the proposed simulation procedure, apply it to test the posed hypothesis, and discuss on the observed results. In section 5, we recall the off-line evaluation approaches introduced in previous research in critiquebased RSs. Finally, the conclusions are given in Section 6. In a previously conducted live users evaluation we proved the effectiveness of our critique-based recommendation methodology for supporting on-the-go users in decision making of product selection. In this paper, we report on an experimental study aimed at comparing different user-query representation approaches. In particular, we compared a composite query representation approach, which employs both logical and similarity queries, with two representations, each one using only one of the two queries. To perform this comparative evaluation, we defined a simulation procedure, and used it to replay the testers' recommendation sessions recorded in the live users evaluation. The results of the simulation tests showed that the query representation using both logical and similarity queries resulted in a better recommendation quality over a simpler query representation. The proposed simulation procedure replays real recommendation sessions and simulates user critiques in different ways. This simulation procedure could be useful for other researchers who want to test their critique-based RSs off-line.. As future work we want to introduce some query repair approach for the repLQ-based variant, so that we can relax failing queries in the off-line evaluations of repLQ. Moreover, the presented empirical evaluation assumes a re-application of real users' critiques in their historical (original) order. Since different products shown may cause users to make different critiques, we plan to test other replaying strategies that will prioritize the critiquing according to user preferences. Though a number of critique-based recommendation approaches have been introduced in the literature, only some of them have been evaluated with real users [5, 6, 9, 10] or by simulation tests [3, 7, 12] . Previous off-line tests, except the one presented in [3] , have focused mainly on the recommendation length (i.e., the number of cycles, or the number of products presented). In previous research, such as [7] , it was assumed an unlimited number of critiques that can be simulated in a session, that is, critiques are simulated until the target item is found in the output list. Hence, a simulated session never fails. But, in practice (mobile) users are often impatient, and rarely express many critiques in a recommendation session.. Simulating user critiques, which plays a very important role in off-line evaluations of critique-based RSs, has been done in a random way. In particular, at a recommendation cycle the criticized product is randomly selected [12] or is the product in the recommendation list that is most similar to the target one [7] , and also the criticized feature is randomly selected [7] . Furthermore, no off-line evaluations of previous critique-based RSs, except the one presented in [3] , have exploited a dataset of real users' recommendation sessions; they have mainly exploited the product (e.g., wine, PC, or travel) catalogs, where each product is used to generate the initial query and identify the target.

O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


Trellis decoding complexity of linear block codes Abstruct-In this partially tutorial paper, we examine minimal trellis representations of linear block codes and analyze several measures of trellis complexity: maximum state and edge dimensions, total span length, and total vertices, edges and mergers. We obtain bounds on these complexities as extensions of well-known dimensiodlength profile (DLP) bounds. Codes meeting these bounds minimize all the complexity measures simultaneously; conversely, a code attaining the bound for total span length, vertices, or edges, must likewise attain it for all the others. We define a notion of "uniform" optimality that embraces different domains of optimization, such as different permutations of a code or different codes with the same parameters, and we give examples of uniformly optimal codes and permutations. We also give some conditions that identify certain cases when no code or permutation can meet the bounds. In addition to DLPbased bounds, we derive new inequalities relating one complexity measure to another, which can be used in conjunction with known bounds on one measure to imply bounds on the others. As an application, we infer new bounds on maximum state and edge complexity and on total vertices and edges from bounds on span lengths. In this paper we approached the trellis complexity problem by first considering the minimal span generator matrix (MSGM) for a fixed permutation of a code. After briefly describing the connection between a minimal trellis and the MSGM, we identified the primitive structures of a minimal trellis and gave some fundamental duality relationships. The ideas in this section grew from the work of [21] and closely resemble that of [15] , to which the reader is referred for more details on constructing minimal trellises or extending these results to nonlinear codes.. McEfiece [21] showed that the minimal trellis minimizes not only the maximum stat nsion of the trellis but other complexity measures as we have augmented the list of reasonable comple es and have shown many connections among them and with the primitive structures. The duality properties lead to interesting relationships among several of the complexity measures for the special cases of self-dual codes and certain divisible codes.. We gave some simple inequalities bounding one complexity measure in terms of another, ich can be used in conjunction with any known bounds on complexity measure to imply bounds on the others. By applying these results, we were able to infer some simple new bounds on the maximum state or edge complexity and on the total numbers of vertices and edges by bounding instead the total span lengths associated with the MSGM. These bounds imply a simple link between complexity and asymptotic coding gain, similar to that shown in 1171, where this connection is discussed in more detail.. The trellis complexity analysis for a fixed code was extended to codes allowed to vary over a domain of optimization.. We looked at two useful domains, the set of permutations of a given code and the set of all codes with given parameters. Bounds on maximum state complexity derived by other authors from the dimensiodlength profile (DLP) of a code (see especially [7] ) generalize easily to similar bounds on all the complexity measures over each domain. Conversely, we have shown that if a minimal trellis attains the bounds for certain complexity measures (total span length, total vertices, or total edges), it must necessarily be uniformly optimal, but this is not true for the simpler measures of maximum state or edge dimension usually considered by other authors. This lends credence to the argument in [21] that a measure of total complexity is more useful than a measure of maximum complexity.. We attempted to unify the theory of DLP bounds over different domains of optimization by defining the simple concept of a uniformly dominating pasvfuture dimension profile (PFDP). A code or permutation is uniformly optimal within a given domain if its associated PFDP uniformly dominates that of any other code or Permutation within the same domain, a definition that does not require reference to any particular bounds. We demonstrated that this is a useful concept by presenting several examples of uniformly optimal trellises. However, uniform optimality is such a strong requirement that in many cases we were able to prove that no uniformly optimal code or permutation can exist. This shows that there is room for considerably more research to define what should be meant by an "optimal" code or permutation without the qualifier "uniformly.". Finally, to round out the subject, we briefly examined minimal trellises of maximal complexity. The theory is much simpler here, because one can easily construct a minimal trellis that has the maximum number of vertices and edges for any code of given length and dimension. Maximum-distanceseparable codes always have full minimal trellises, as do many other codes if inefficiently permuted. It is much easier to construct full minimal trellises than to find concise ones.

B I O O O B I O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O B I O O O O O


Databases for recognition of handwritten Arabic cheques This paper describes an e ort towards the development of Arabic cheque databases for research in the recognition of hand-written Arabic cheques. Databases of real-life Arabic legal amounts, Arabic sub-words, courtesy amounts, Indian digits, and Arabic cheques are described. This paper highlights some characteristics of the Arabic language and presents the various steps that have been completed to build these databases including segmentation, binarization and data tagging. It also describes a solid validation procedure including grammars and algorithms used to verify the correctness of the tagging process. Detailed descriptions of the database organization and class distribution are included. These databases aim to facilitate experimental comparisons between various recognition methods, and will be provided to all interested researchers upon request to CENPARMI. 1 Cheque processing involves all the tasks a bank o cer may have to do to process an incoming cheque for a client. This includes: accessing account numbers, verifying names and signatures on the cheque, verifying the date of the cheque, matching the legal and courtesy amounts, and verifying the credit of the issuer.. During the past few years, extensive e orts have been devoted to Latin cheque processing systems [1] [2] [3] 13] , including legal amount recognition, courtesy amount recognition, and date recognition. For training and testing purposes, researchers in Ref. [1] have used a private real-life database. Their database could not be provided to the research community due to the conÿdentiality of information in real-life cheques. On the other hand, researchers in Refs. [2, 3] built artiÿcial databases to train and test their systems. A set of 2600 English cheques, written by 800 writers with pre-set legal amounts, has been collected. Another set of 1900 French cheques from 600 di erent writers has been collected too. The legal amounts were given to the writers to produce a balanced word distribution. These databases are available for the research community.. To the best of our knowledge, no attempts have been reported towards an Arabic cheque processing system. This was partially due to the lack of a supporting infrastructure required to conduct, develop and compare such systems. A major e ort to open this area is needed to develop a representative database that can be used for such purposes. This work provides real-life databases for Arabic legal amounts and courtesy amounts (written in Indian digit). It is interesting to note that Indian digits are more popular than Arabic numerals in some parts of the Arabian world.. Arabic has di erent character set and language rules than Latin languages. Therefore, there is a need to build Arabic databases to train, test and compare recognition systems. Building databases of Arabic cheque processing shares most of the di culties and challenges with its Latin-based counterparts that are related to the conÿdentiality of such data. In addition, Arabic has a larger vocabulary for legal amounts than English and French. The large number of secondary components causes more di culties at the segmentation level. Moreover, grammatical rules for the Arabic legal amounts allow for large variations in writing similar amounts.. In this paper, we describe a set of databases that might be used to train, evaluate and compare Arabic cheque processing systems. These databases comprise real-life data, which make recognition systems more adjustable to real-world applications. In addition, these databases have gone through a solid validation process, which makes erroneous labelling practically impossible.. By choosing to collect real-life data, we eliminated the bias involved in laboratory environments. However, data from real-world environment has its own drawbacks. This is observed from the uneven distribution of sub-word classes in the collected data that may cause some training problems. This is particularly true for those classes that are rarely used. Training and testing of such classes become more di cult and may impose restrictions on the type of classiÿers.. To facilitate experimental comparisons among various recognition methods, the databases are divided into training and testing sets. These databases are available to the research community upon request to the Centre for Pattern Recognition and Machine Intelligence (CENPARMI) (see footnote 1).. The rest of this paper is organized as follows. After this introduction, we give a brief description of the Arabic written language focusing on the current application, and mentioning the major characteristics that may a ect a pattern recognition system. Data collection is covered next, followed by the pre-processing section. Tagging comes next, followed by validation, and databases that resulted from this project. After that, we discuss the impact of this work on existing and future recognition systems. We ÿnish this paper with some concluding remarks. A substantial amount of e ort has been devoted toward building Arabic cheque databases, a very important infrastructure to develop and compare pattern recognition systems for the Arabic-based cheque-processing systems. This paper describes the main steps that have been completed to develop such databases. The paper also gives a list of useful databases that have been produced from the ÿrst batch of 3000 cheques. These databases can be obtained by a request to CENPARMI. In the future, we will work to complete the remaining 4000 cheques. This paper provides a detailed description of newly developed databases to assist researchers in the ÿeld of handwritten Arabic legal and courtesy amounts recognition. It describes databases for Arabic cheques, Arabic legal amounts, Arabic sub-words, courtesy amounts written in Indian digits, and a database for Indian digits. Among the unique characteristics of these databases are (i) items were extracted from real-life data, (ii) tags of objects went through a solid validation procedure that uses dual-redundant information.. The databases were extracted from 3000 real-life cheques out of 7000 cheques collected from a ÿnancial institution. The remaining collected cheques require additional processing and are left for future research work. The resulted databases include 29,498 samples in the Arabic sub-words The tag validation procedure works with tagged legal and courtesy amounts. The tags of a legal amount is interpreted and translated into numerical value, which is then compared with the corresponding courtesy amount tags. Any error in the tagging process will mostly lead to un-interpretable sequence of tags, or in the worst case, will lead to mismatch in the values obtained.. The paper includes a detailed description of all the steps that were conducted throughout the development process, including the following:. (i) gathering of real-life data (cheques), (ii) segmentation and binarization, (iii) tagging, (iv) validation of the tagging process, and (v) distribution and structure of various databases.. The paper also includes a description of the major characteristics of Arabic legal and courtesy amounts with deep analysis of the linguistic and grammatical rules that a ect the writing of legal amounts and their interpretations.. In addition, grammar and algorithm to parse and translate Arabic legal amounts into numerical values are included.. The databases described in this paper are available to interested researchers through CENPARMI (see footnote 1). Theoretically speaking, our validation process may oversee some tagging mistakes. However, this is extremely rare in practice. We may make a point by describing what it takes to approve incorrect tagged cheque C:. 1. An error would occur while tagging the legal amount of C. 2. This error should create a di erent, yet correct sequence of sub-words that makes a word. 3. The new sequence of words should be grammatically correct to generate a corresponding numerical value. 4 . An equivalent numerical error should have occurred while tagging the courtesy amount of C, to make it equal to the one generated from the legal amount.. It is clear that such a sequence of events is hardly expected for a single cheque. Note that legal and courtesy amounts are tagged independently at di erent instances. A question may arise about the set of cheques that could not be approved. Following are some of the reasons that led most unapproved-tagged cheques to this category:. 1. The extraction tool may have cut the legal amount (or the courtesy amount), providing incomplete or incorrect data to the tagging tool. 2. The legal amount may have contained an unexpected spelling mistake that left the relevant sub-word untagged (tagged as OTHER symbol), leaving a gap in the legal amount. 3. The legal amount may contain a word that is out of the range covered by this study (e.g. million). 4. There may be missing sub-words (mainly letters) in the original legal amount. 5. The tagging operator may have produced some error. Fig. 13 shows an example of rejected cheques.

O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


Analysis of copositive optimization based linear programming bounds on standard quadratic optimization The problem of minimizing a quadratic form over the unit simplex, referred to as a standard quadratic optimization problem, admits an exact reformulation as a linear optimization problem over the convex cone of completely positive matrices. This computationally intractable cone can be approximated from the inside and from the outside by two sequences of nested polyhedral cones of increasing accuracy. We investigate the sequences of upper and lower bounds on the optimal value of a standard quadratic optimization problem arising from these two hierarchies of inner and outer polyhedral approximations. We give a complete description of the structural properties of the instances on which upper and lower bounds are exact at a finite level of the hierarchy, and the instances on which upper and lower bounds converge to the optimal value only in the limit. In this paper, we study standard quadratic optimization problems given by . where Q ∈ S and S denotes the set of n × n real symmetric matrices, x ∈ R n , and ∆ n denotes the unit simplex in R n given by. where e ∈ R n is the vector of all ones and R n + denotes the nonnegative orthant in R n .. Standard quadratic optimization problems arise in a variety of applications (see, e.g. [2] ).. Despite its seemingly simple structure, the problem (StQP) encompasses several interesting problem classes. For instance, it is well-known that the problem of minimizing a nonhomogeneous quadratic function over the unit simplex can be reformulated in the form of (StQP) using the following identity:. Similarly, any quadratic optimization problem over a polytope can be formulated as an instance of (StQP), where the dimension n is equal to the number of vertices of the polytope.. Since the maximum stable set problem admits a formulation in the form of (StQP) [14] , it follows that (StQP) is in general an NP-hard problem.. The problem (1) can be equivalently reformulated as the following instance of a linear optimization problem over the cone of completely positive matrices [4] :. ν(Q) = min{ Q, X : E, X = 1, X ∈ C},. where A, B = trace(AB) = n i=1 n j=1 A ij B ij for A, B ∈ S, E = ee T ∈ S is the matrix of all ones, and C ⊆ S is the cone of the completely positive matrices given by. where conv{·} denotes the convex hull. The dual cone of C with respect to the trace inner product ·, · is the cone of copositive matrices given by C * := {X ∈ S : u T Xu ≥ 0 for all u ∈ R n + }.. Since (StQP) is in general an NP-hard problem, the convex optimization problem (3) is in general intractable. Indeed, the computational complexity is now hidden in the conic constraint X ∈ C, for which the membership problem is NP-hard [10] . Similarly, the membership problem for the dual cone C * is also NP-hard [15, 10] .. Despite the fact that the convex reformulation (3) of the problem (StQP) does not seem to be helpful from the computational complexity point of view, it offers a new perspective as the difficulty is now shifted to the convex cones C and C * . In fact, Burer [7] established more generally that, under mild assumptions, every optimization problem with a quadratic objective function, linear equality constraints, and a mix of nonnegative and binary variables admits an exact reformulation as a linear optimization problem over the cone C. Therefore, there has recently been a considerable research activity towards a better understanding of the cones C and C * . Many of these studies propose different ways of approximating each of these two cones by a sequence of tractable convex cones of increasing accuracy (see, e.g., [16, 12, 8, 3, 17, 6, 21, 18, 5, 13] ). Such sequences therefore yield approximation hierarchies for the cones C and C * . By replacing the difficult conic constraints with the sequences of increasingly more accurate tractable approximations, one can obtain a sequence of increasingly tighter bounds on the optimal value of a linear optimization problem over the cones of completely positive or copositive matrices.. In this paper, we focus on two approximation hierarchies, each of which is comprised of a sequence of polyhedral cones of increasing accuracy. The first approximation hierarchy, defined originally in the context of standard quadratic optimization by Bomze and de Klerk [3] and later extended to a hierarchy that consists of nested cones by Yıldırım [21] , is motivated by exploiting necessary conditions for copositivity of a matrix. By duality, these conditions translate into a hierarchy of inner polyhedral approximations I r , r = 0, 1, . . . of the cone C of completely positive matrices, with the property that I 0 ⊆ I 1 ⊆ . . . ⊆ C and cl (∪ r∈N I r ) = C, where cl(·) denotes the closure. Exploiting a sequence of sufficient conditions for copositivity of a matrix, de Klerk and Pasechnik [8] proposed another hierarchy, which, by duality, yields a sequence of outer polyhedral approximations O r , r = 0, 1, . . . of the cone C, with the property that. Since each of the two approximation hierarchies is composed of polyhedral cones, it follows that replacing the conic constraint X ∈ C in (3) with X ∈ I r (resp., with X ∈ O r ),. where r ∈ N, gives rise to a linear programming problem with O(n r+2 ) variables, whose optimal value yields an upper (resp., lower) bound on the optimal value ν(Q). In this paper, we investigate the upper and lower bounds arising from these inner and outer polyhedral approximations. We give a complete description of the structural properties of the instances of (StQP) for which the upper bound or the lower bound is already exact at a finite level r ∈ N of the corresponding hierarchies. Similarly, we completely describe the properties of the instances of (StQP) for which the upper bounds or the lower bounds converge to ν(Q) only in the limit.. We remark that our perspective in this paper, in general, is not algorithmic in the sense that some of our results may not necessarily translate into an efficient method for deciding, for a given instance of (StQP), whether the upper and/or the lower bound is exact at a given level of the corresponding hierarchies. Rather, our main objective is to identify the relations between the structural properties of instances of (StQP) and the strength of the upper and lower bounds on the optimal value ν(Q) arising from the inner and outer polyhedral approximations of the cone C. In particular, our results shed light onto the strengths and limitations of the two polyhedral approximation hierarchies in the context of standard quadratic optimization. We believe that the insights obtained from our results may be useful for the construction of improved polyhedral approximation hierarchies.. The paper is organized as follows. We define our notation in Section 1.1. In Section 2, we describe the inner and outer polyhedral approximations of the cone of completely positive matrices. Section 3 is devoted to some preliminary results. In Section 4, we present the relations between the structural properties of (StQP) and the behavior of upper bounds.. The corresponding relations for lower bounds are discussed in Section 5. We conclude the paper in Section 6. In this paper, we investigated the sequences of copositive optimization based upper and lower bounds on the optimal value of a standard quadratic optimization problem. We gave a complete description of the instances for which the upper and/or the lower bound is exact at a finite level of the hierarchy and the instances for which the upper and/or the lower bound converges to the optimal value only in the limit.

O O O O O O O O O B I I O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


An information theoretic approach for improving data driven prediction of protein model quality We present the results of an information theory-based approach to select an optimal subset of features for the prediction of protein model quality. The optimal subset of features was calculated by means of a backward selection procedure. The performances of a probabilistic classifier modeled by means of a Kernel Probability Density Estimation method (KPDE) were compared with those of a feed-forward Artificial Neural Network (ANN) and a Support Vector Machine (SVM). The current phase of genomics is to catalogue, characterize and comprehend the entire set of functional elements encoded in the human and other genomes. The compilation of this genome 'parts list' will be an immense challenge. Well-known classes of functional elements, such as protein 3D structures, still cannot be accurately predicted from sequence information alone because many features must be considered and it is not clear which features are most important and how they should best be combined [1] . On the other hand the experimental determination of the 3D structure of the proteins is currently a very laborious process. In some cases it can take years before the structure of a protein is determined, and in other cases, such as membrane proteins, the most commonly used methods are not always applicable [2] .. The level of difficulty in predicting a protein structure is determined by the similarity of the protein sequence with that of a known protein structure. Scientists have classified protein structure prediction methods into three categories. From least difficult to most difficult, they are comparative modeling, fold recognition, and ab initio [3] .. Several benchmarks of these methods have been developed, such as CASP [4] , CAFASP [5] , and LiveBench [6] . An important conclusion from these studies has been that for different targets, the best predictions are often made by different methods. This observation justifies the use of meta-predictors for the selection of a solution from a set of predictions coming from different servers. Basically a meta-predictor detects structural similarities between high scoring predictions selecting representatives of large clusters of models (consensus procedure). To fully benefit from the meta-predictors, it is important to understand what knowledge human experts use and what is not used by the servers (developed by them and others). There are two important contributions by the experts which should be automated and added to the consensus analysis: biological knowledge and structural verifications [7] . Due to the current limitations in computer-readable classifications of protein functions, biological knowledge is hard to automatize. Some attempts have been done by means of text-based bioinformatics approaches [8] . Text-based bioinformatics employs methods to retrieve or extract information from unstructured text for the purpose of structuring it into a biologically or medically relevant model.. In our work we focused on structural analysis of a protein model. A post-processing filter based on structural information might be very useful to deselect false positives if an appropriate set of structural features is selected. We know that as the number of features in a predictive task increases, the time requirements for an algorithm grow dramatically, sometimes exponentially. This problem is further exacerbated by the fact that many features in a learning task may either be irrelevant or redundant to other features with respect to predicting the class of an instance.. This paper presents the results of an information theory-based approach to select an optimal subset of structural features for the assessment of protein model accuracy. Atomic interactions, solvent accessibility, and secondary structure were considered and 109 structural features were defined. These three important categories of structural features have proven to include a subset of appropriate features for model quality prediction [9] . About 9000 instances of this set of features were calculated for as many protein models belonging to the Decoys 'R' US database [10] . The MaxSub score [11] was used to define 4 different classes of model accuracy and calculate the quality class of each model. These values were used to select an optimal subset of structural features by means of a backward feature selection algorithm based on the information theoretic measure of relative entropy (also known as Kullback-Leibler divergence).. Three different approaches were used to estimate the classification function which associates with each instance of the optimal subset of features the quality class of the related model.. First, a probabilistic classifier was used to model the classification function. The probabilistic classifier assigns the most probable quality class to an instance of the optimal subset of features, based on the probability distribution of the interdependencies among the class and the set of input features. The probability distribution was estimated with a Kernel Probability Density Estimation method (KPDE) [12] . Then a feed-forward Artificial Neural Network (ANN) and a Support Vector Machine (SVM) were trained to predict the MaxSub score of a protein model when an input vector corresponding to an instance of an optimal subset of features is presented. Finally the performances of the three approaches were compared. It has been shown that information-theoretic methods for feature selection can be efficiently used for the assessment of protein 3D models. Since our approach does not rely on the method used to predict the protein structure, it can be used in all the main tertiary structure prediction algorithms. In particular it can be combined with a traditional consensus procedure for the meta-prediction of protein structure. Future work will include the analysis of different methods to evaluate the quality of the models, including both alignment dependent and independent measures [36] . Furthermore a larger database with a set of protein models representative of the Protein Data Bank (PDB) of known protein structures [37] will be used. Finally the model assessment algorithm will be applied as the final step of a protein 3D structure meta-predictor and the performances will be compared with those of a traditional consensus procedure.

O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


An Efficient Synchronization Mechanism for Mirrored Game Architectures Existing online multiplayer games typically use a client-server model, which introduces added latency as well as a single bottleneck and single point of failure to the game. Distributed multiplayer games minimize latency and remove the bottleneck, but require special synchronization mechanisms to provide a consistent game for all players. Current synchronization methods have been borrowed from distributed military simulations and are not optimized for the requirements of fast-paced multiplayer games. In this paper we present a new synchronization mechanism, trailing state synchronization (TSS), which is designed around the requirements of distributed firstperson shooter games.We look at TSS in the environment of a mirrored game architecture, which is a hybrid between traditional centralized architectures and the more scalable peer-to-peer architectures. Mirrored architectures allow for improved performance compared to client-server architectures while at the same time allowing for a greater degree of centralized administration than peer-to-peer architectures.We evaluate the performance of TSS and other synchronization methods through simulation and examine heuristics for selecting the synchronization delays needed for TSS. Online multiplayer games typically take one of two basic forms: centralized client-server (all commands go through a single server), shown in figure 1(a), or distributed peer-to-peer (commands go directly to other players), shown in figure 1(b). Client-server architectures are usually simpler, but are also less efficient and scalable. Every command must go from the client to the server and then be re-sent by the server to other clients in the form of update messages. This adds additional latency over the minimum cost of sending commands directly to other clients. In addition, the server becomes a single point of failure in the game. Unlike centralized games, where there is a single authoritative copy of the game state kept at the server, distributed game architectures require a copy of the entire game state to be kept at each client. As a result, these architectures require some form of synchronization between clients to ensure that each copy of the game state is the same. Without synchronization, clients' game states would diverge over time due to network delays and other factors.. Common synchronization techniques used in existing distributed simulation environments include bucket synchronization, breathing bucket synchronization, and TimeWarp synchronization [8, 19] . Many of these synchronization mechanisms were initially designed for use in large-scale military simulations, and were only later adapted for use in multiplayer games as games gained popularity. In this paper we present a novel new synchronization mechanism, trailing state synchronization (TSS), which is designed specifically with distributed first-person shooter games such as Quake [10] in mind. First-person shooters are the most latency-sensitive class of multiplayer games, and have a different set of optimization parameters than large military simulations. Existing synchronization techniques suffer from problems such as introducing too much additional latency, providing only loosely consistent synchronization, or requiring high memory and computation costs. TSS is designed to execute commands quickly while at the same time maintaining a consistent copy of the game state at all players, and doing this in a computationally and memory-wise efficient manner.. The remainder of the paper is organized as follows: in Section 2 we provide background on multiplayer game architectures, including the mirrored game architecture, and previously proposed synchronization methods. In Section 3 we introduce trailing state synchronization. Section 4 examines the performance of TSS and compares it with other synchronization algorithms. Finally, Section 5 concludes. In this paper we have presented TSS, an optimistic synchronization mechanism designed for multiplayer games with low latency but strong consistency requirements. It provides for low-latency, consistent gameplay through the use of multiple copies of the game state and rollbacks. We have shown that because of its design characteristics, TSS performs well in high-speed games where there is a large game state and many commands to be synchronized. There are still a number of areas where future work is needed. The benefits of event classification have not been explored in depth. This has the potential to greatly reduce the number of rollbacks experienced in TSS. In the mirrored server architecture (where the mirrors can be trusted), there is potential for performing some pre-execution at one mirror to reduce the cost of executing in each state at each mirror. Similarly, in purely peer-to-peer environments there is the ability to employ interest management. Neither of these optimizations has been explored yet. More accurate game traces, such as those recorded by pkthisto [1] , could be used for simulating TSS and other synchronization algorithms, although the traces we have used in this paper provide an adequate means of comparing TSS and TimeWarp side by side. The problem of selecting the right leading synchronization delay was examined, but the selection of intermediate synchronization delays or the dynamic adjustment of synchronization delays as network conditions change is still unexplored. Note 1. When discussing TSS we often use events and commands interchangeably, as the events being synchronized in Quake are player commands.

O O B O O O B O O B O B O B O B B O O O O O O O O O O O O B O B O O B B O B O O O O O O O O O B O O O O O B O O O O B O O O O O B O O O O O O O O B O O O B O O B O O O O B O O O B O O O O O O B O B O O O O O O O O O O O O B B O O O B O O O O O O O O B O O O O O O B O O B O O O O O O O O O O O O O O O B O O O B O O O O B O O B O O O O O O B O O O O B O B O O O O O O O O B O O O O O O O O O O O O B B O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O B O O B O O B O O O O O O O O O B O O O O O B B O O O O O O O B O O O O O O O O O O O O O O O O B O O O O O O O O O B O O O O O B O B O O O O O O O O O O O O O B O O O O B B B O O B O O B O O B O O O O O O B O O O O O B O O O O O O O O O O B O O B O B O O O O B O O O O O B O O O B O O O O O O B O O B O O O O O O O O O O O O O O O B O O O O O O O O O O O O O B O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O B O O O O B B O O O B O O O O O O O O B O O O O B O O O O O O O B O O O O O O O B O O O O O O B O O O O B O O O O O B B O O O O O O O O B O O O O O B O O O O O O O O O O O O O O O O O B O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B B O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O B O O O O O O O O O B O O O O O O O O O O O O O O O O O O O B O O O O O O O O B O O O O O O B O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O


Regular expression types for XML We propose regular expression types as a foundation for statically typed XML processing languages. Regular expression types, like most schema languages for XML, introduce regular expression notations such as repetition (*), alternation (|), etc., to describe XML documents. The novelty of our type system is a semantic presentation of subtyping, as inclusion between the sets of documents denoted by two types. We give several examples illustrating the usefulness of this form of subtyping in XML processing.The decision problem for the subtype relation reduces to the inclusion problem between tree automata, which is known to be EXPTIME-complete. To avoid this high complexity in typical cases, we develop a practical algorithm that, unlike classical algorithms based on determinization of tree automata, checks the inclusion relation by a top-down traversal of the original type expressions. The main advantage of this algorithm is that it can exploit the property that type expressions being compared often share portions of their representations. Our algorithm is a variant of Aiken and Murphy's set-inclusion constraint solver, to which are added several new implementation techniques, correctness proofs, and preliminary performance measurements on some small programs in the domain of typed XML processing. XML [Bray et al. 2000 ] is an emerging standard format for tree-structured data. One of the reasons for its popularity is the existence of a number of schema languages, including DTDs [Bray et al. 2000] , XML-Schema [Fallside 2001 ], DSD [Klarlund et al. 2000] , RELAX [Murata 2001] , and RELAX NG [Clark and Murata 2001] , that can be used to define "types" (or "schemas") describing structural constraints on data and thereby improve the safety of data processing and exchange.. However, the use of types in mainstream XML processing technology is often limited to checking only data, not programs. Typically, an XML processing program first reads an XML document and checks that it conforms to a given type using a validating parser. The program then uses either a generic tree manipulation library such as DOM [DOM 2001] or a dedicated XML language such as XSLT [Clark 1999] or XML-QL [Deutsch et al. 1998 ]. Since these tools make no systematic connection between the program and the types of the documents it manipulates, they provide no compile-time guarantee that the documents produced by the program will always conform to an intended type.. In this article, we propose regular expression types as a foundation for statically typed processing of XML documents. Regular expression types capture (and generalize) the regular expression notations (*, ?, |, etc.) commonly found in schema languages for XML, and support a natural semantic notion of subtyping.. We have used regular expression types in the design of a domain-specific language called XDuce ("transduce") for XML processing [Hosoya and Pierce 2002, 2003] . In the present article, however, our focus is on the structure of the types themselves, their role in describing transformations on XML documents, and the algorithmic problems they pose. Interested readers are invited to visit the XDuce home page http://xduce.sourceforge.net for more information on the language as a whole.. As a simple example of regular expression types, consider the definitions [String] corresponding to the following set of DTD declarations:. <!ELEMENT addrbook person*> <!ELEMENT person (name,email*,tel?)> <!ELEMENT name #PCDATA> <!ELEMENT email #PCDATA> <!ELEMENT tel #PCDATA>. • H. Hosoya et al. Type constructors of the form label [...] classify tree nodes with the tag label (i.e., XML structures of the form <label>...</label>). Thus, the inhabitants of the types Name, Email, and Tel are all strings with an appropriate identifying label. Types may also involve the regular expression operators * (repetition) and ? (optional occurrence), as well as | (alternation). Thus, the type Addrbook describes a label addrbook whose content is zero or more repetitions of subtrees of type Person. Likewise, the type Person describes a label person whose content is a Name subtree, zero or more Email subtrees, and an optional Tel subtree. An instance of the type Addrbook is the following XML document:. <addrbook> <person> <name> Haruo Hosoya </name> <email> hahosoya@upenn </email> <email> haruo@u-tokyo </email> </person> <person> <name> Jerome Vouillon </name> <email> vouillon@upenn </email> <tel> 123-456-789 </tel> </person> </addrbook>. We define subtyping between regular expression types in a semantic fashion. A type, in general, denotes a set of documents; subtyping is simply inclusion between the sets denoted by two types. For instance, consider again the Person type definition from above Elements of the Person type can have one name, zero or more emails, and zero or one tels in this order, while the Person2 type allows any number of such nodes in any order. Therefore, Person2 describes strictly more documents, which implies that Person is a subtype of Person2. Such subtype inclusions can be quite useful in programming. For example, suppose that we originally have a value of type Person. The above inclusion allows us to process this value using code that does not care about the ordering among the name, email, and tel nodes. (Such a situation might arise, for example, if we want to display the child nodes in a linear format, where we would naturally write a single loop over the sequence of child nodes with a case branch for each tag.). Note that if we replaced Person with a more conventional type person(name(string) × email(string) list × tel(string) option) (using sum, product, and ML-like list and option types, plus unary covariant constructors person, name, email, and tel) and Person2, analogously, with person((name(string) + email(string) + tel(string)) list) the conventional subtyping of sum and product types would not yield the inclusion above. In general, the subtype relation obtained from our definition is quite a bit more permissive than conventional subtyping. We give some further examples in Section 2.. Regular expression types exactly correspond to tree automata [Comon et al. 1999 ]-a finite-state machine model for accepting trees. It is easy to construct, from a given type, a tree automaton that accepts just the set of trees denoted by the type (Appendix A). Therefore, the subtyping problem can be reduced to the inclusion problem between tree automata, which is known to be decidable. Unfortunately, in the worst case, this problem is EXPTIME-complete [Seidl 1990 ].. To address this high complexity, we develop an algorithm that runs efficiently for the cases that we expect to encounter most often in programming with regular expression types. Instead of beginning from classical algorithms for testing tree automata inclusion [Comon et al. 1999] , which work by (expensively) transforming their input automata to other completely separate automata before testing their properties, we take Aiken and Murphy's algorithm [Aiken and Murphy 1991] as the starting point. Like standard subtyping algorithms for other type systems, this algorithm works top-down-that is, a given pair of types, we check matching of the top-most type constructors, proceed to the subcomponents of the types, and repeat the same check recursively. The main advantage of this top-down algorithm is that it enables many simple optimizations. In particular, we can exploit reflexivity (T <: T) in order to decide subtype relations by looking at only a part of the whole input type expressions.. Our additions to the work of Aiken and Murphy are fourfold. First, we give proofs of soundness, completeness, and termination for (a reformulation of) their algorithm. Second, we give a detailed, intuitive explanation of the key step in the algorithm involving "untagged" union types, which was not presented well in their original paper. Third, we incorporate several useful implementation techniques, including (1) sharing type expressions as much as possible by using a representation that exploits equivalence between types, and (2) caching intermediate results of the subtyping algorithm by using a functional data structure (for which the operations do not destructively update the data). We describe these techniques in detail in Section 5. Fourth, we describe some preliminary experiments with our algorithm (as implemented in the prototype XDuce interpreter), confirming its practicality on several small examples. (Aiken and Murphy's algorithm also addresses a more general problem: set-constraint solving. See Section 7 for further discussion of the relationship between their algorithm and ours.). The contributions of this article can be summarized as follows:. -We motivate the use of regular expression types and set-inclusion-based subtyping for the domain of XML processing. -We formalize the connection of regular expression types to tree automata. -We develop a practical subtyping algorithm, present it in detail (along with an intuitive explanation of its key ideas), and give soundness, completeness, and termination proofs. -We describe several implementation techniques for the subtyping algorithm and present preliminary measurements of their practical effects.. • H. Hosoya et al.. The article is organized as follows: In the next section, we give some examples of programming with regular expression types. In Section 3, we describe the connection of regular expression types to tree automata and give a precise definition of subtyping. In Section 4, we present our subtyping algorithm and prove its correctness. Section 5 describes our implementation techniques, and Section 6 presents the results of our preliminary experiments. We survey related work in Section 7 and conclude in Section 8. Appendix A presents an algorithm for translating regular expression types to tree automata, with its proof of correctness. We have proposed regular expression types for XML processing, arguing that set-inclusion-based subtyping and subtagging yield useful expressive power in this domain. We developed an algorithm for subtyping that can exploit sharing among type expressions, giving soundness, completeness, and termination proofs. By incorporating several optimization techniques, our algorithm runs at acceptable speeds on several applications involving fairly large types, such as the complete DTD for HTML documents.. Our work on type systems for XML processing has just begun. In the future, we hope to incorporate other standard features from functional programming, such as higher-order functions and parametric polymorphism. The combination of these features with regular expression types raises some difficult problems. For function types, our current approach-define subtyping by inclusion of the semantics of types and reduce it to the decidability of tree automata inclusion-does not easily extend simply because functions are not trees. (Some achievements in this direction have recently been reported by the CDuce team [Frisch et al. 2002] .) Also for polymorphism, our current scheme needs to be substantially extended since usual tree automata do not have any concept corresponding to "type variables." A promising direction might be to incorporate ideas from tree set automata ], though we have not gone far. Static typing of programs for XML processing has been approached from several different angles. One popular idea is to embed a type system for XML in an existing typed language. The advantage is that we can enjoy not only static type safety, but also all the other features provided by the host language. The cost is that XML values and their corresponding schemas must somehow be "injected" into the value and type spaces of the host language; this usually involves adding more layers of tagging than were present in the original XML documents, which inhibits subtyping. The lack of subtyping (or availability of only restricted forms of subtyping) is not a serious problem for simple traversal of tree structures; it becomes a stumbling block, though, in tasks like the "database integration" that we discussed in Section 2.7, where ordering-forgetting subtyping and distributivity were critically needed.. A recent example of the embedding approach is Wallace and Runciman's [1999] proposal to use Haskell as a host language for XML processing. The only thing they add to Haskell is a mapping from DTDs into Haskell datatypes. This allows their programs to make use of other mechanisms standard in functional programming languages, such as higher-order functions, parametric polymorphism, and pattern matching. However, they do not have any notion of subtyping. A difference in the other direction is that our type system does not currently support higher-order functions or parametric polymorphism. (We are working on both of these extensions, but they are nontrivial.). Meijer and Shields propose the typed functional language XMλ for XML processing [Meijer and Shields 1999; Shields and Meijer 2001] . Although their type system stems from Haskell's, they attain additional flexibility required in XML processing by incorporating, instead of subtyping, extensible records and variants based on row polymorphism.. The query language YAT [Cluet and Siméon 1998 ] has a type system similar to regular expression types. They also provide a notion of subtyping that can make programs flexible against changes of types. However, their subtyping is somewhat weaker than ours: they can handle the first example ("database evolution") in Section 2.7, but since their subtyping lacks distributive laws, they cannot treat the second example ("database integration") given in the same section.. Since its initial publication, our work on regular expression types has influenced proposals by other researchers. In particular, Fernández et al. [2001] propose XML Query Algebra for the basis of XML query processing and optimization, and they use our regular expression types in their type system and our subtyping algorithm in their implementation. Milo et al. [2000] have studied a typechecking problem for their general framework called k-pebble Tree transducers, which can capture a wide range of query languages for XML. The types there are based on tree automata and conceptually identical to regular expression types. Papakonstantinou and Vianu [2000] present a typechecking algorithm for their query language loto-ql, where the algorithm uses extensions to DTDs. One of their extensions is equivalent to tree automata.. Although schema languages for XML do not treat static verification of programs, the type structures in these languages and regular expression types are worth discussing. Since schema languages are too many to enumerate, we consider the following representative ones: DTD [Bray et al. 2000] , XML-Schema [Fallside 2001 ], DSD (Document Structure Description) [Klarlund et al. 2000] , RELAX [Murata 2001 ], TREX [Clark 2001 ], RELAX NG [Clark and Murata 2001] , and SOX (Schema for Object-Oriented XML) [Davidson et al. 1999] . As our regular expression types do, all of these use regular expressions or similar mechanisms for describing sequences. Both our regular expression types and RELAX (and its relatives TREX and RELAX NG) are equivalent to tree • H. Hosoya et al. automata (more precisely, nondeterministic tree automata; see Comon et al. [1999] for a detailed classification of tree automata), and therefore these have the same expressiveness. The other schema languages are more restrictive. Some of the above schema languages consider subtyping. XML-Schema has a "restriction" subtyping (which yields a subtype by decreasing the number of choices in an existing type), and both XML-Schema and SOX have an "extension" subtyping (which yields a subtype by adding new fields to the tail, similarly to inheritance in object-oriented languages). Both forms of subtyping are subsumed by ours. Kuper and Siméon [2001] define a schema language similar to regular expression types; they provide a subtype relation that is weaker than ours but allows efficient storage layout for XML databases.. Several researchers have developed type systems for query languages for tree-like data that are similar to XML except that they have no ordering among children nodes (some of the formalisms also allow cycles). Their unorderedness makes these type systems quite different from those for XML. In the type system studied by Buneman et al. [1997] , types are graph structures and their conformance and subtype relations are defined in terms of graph simulation (which is weaker than the inclusion relation). The query language Lorel uses a somewhat similar type system called DataGuide [Goldman and Widom 1997] .. Our investigation of regular expression types was originally motivated by an observation by Buneman and Pierce [1998] that untagged union types correspond naturally to forms of variation found in semistructured databases. The difference from the present work is that they study unordered record types instead of ordered sequences and do not treat recursive types.. Our subtyping algorithm can be seen as an extension to subtyping algorithms for conventional type systems. In particular, the technique used in our algorithm for keeping track of a set of "assumptions" to detect termination (Section 4.2) can be found in many subtyping algorithms for simple recursive types [Amadio and Cardelli 1993; Brandt and Henglein 1998; Gapeyev et al. 2000] . The ingredient that is rarely found in classical algorithms is the complex rule shown Section 4.2 for the "untagged" union type operator.. As we discussed above, our subtyping algorithm can be viewed as a variant of Aiken and Murphy's algorithm [Aiken and Murphy 1991] . They actually treat a more general problem called set-constraint solving. In their setting, types can contain free variables and the goal is to obtain a substitution for the variables that satisfies the given set-constraints, if they are satisfiable. In our setting, on the other hand, types do not contain free variables and the goal is to know only whether the constraints are satisfiable. Thus, we can solve our subtyping problem by using their algorithm and removing the rules related to free variables. They do not, however, prove correctness in their paper-in particular, they have no completeness proof since their algorithm is indeed incomplete. (Incompleteness means that the algorithm may answer "no" even if the constraints are solvable.) What we have proved is that their algorithm is actually complete if we restrict types to contain no free variables.. In their framework for refinement types for ML, Freeman and Pfenning [1991] adopt regular tree languages to express more precise types than ML datatypes and use tests for inclusion between tree automata in type checking. Davies [2000] addresses the efficiency issue of the inclusion test in this context. Damm [1994] considers a type system with union, intersection, and recursive types where the subtype relation is defined in a semantic way. He presents a decision procedure for subtype checking that first encodes types into regular tree expressions and then uses existing set-constraint solving algorithms. Furthermore, he treats higher-order functions, which we have not handled yet. On the other hand, he does not address the efficiency of the subtyping algorithm. The subtyping algorithm is expressed by two judgments, T <: U ⇒ and † T <: U ⇒ , where is a set of pairs of types of the form R <: S, called "assumptions." Both judgments should be read: "assuming that all relations R <: S in hold, the algorithm verifies T <: U and yields, in the output set , both the old pairs in and the new pairs T <: U that have been checked in the process." At each step of the subtyping algorithm, we add the given pair of types to the assumption set. Later on, when we encounter the same pair, we immediately return "yes," thus ensuring termination. Of course, we have to be careful not to check the assumption set immediately after storing the given pair, which would incorrectly establish subtyping between any pair of types. This is why we have two different judgments: we switch from one to the other immediately after adding a pair and switch back whenever it is safe. The accumulated assumptions are eventually returned in the output set , which is propagated as the input to other subtype checks, avoiding repeated checks of the same pair. Furthermore, these pairs are reused not only in the process of checking a single inclusion, but all the way through the typechecking of the whole program, thus serving as a cache of all verified subtype relations. (Related discussions of assumptions can be found in Amadio and Cardelli [1993] , Brandt and Henglein [1998] , and Gapeyev et al. [2000] .). We now give the rules to define the above two judgments. If the pair T <: U of input types is already in the set of assumptions, we immediately succeed (rule HYP). Otherwise, we add the pair to this set and switch judgments (rule ASSUM).. These two rules are for ensuring termination as well as avoidance of repeated checks of the same pair. In ASSUM, we switch from the judgment of the form T <: U ⇒ to † T <: U ⇒ , preventing the incorrect application of the rule HYP immediately following ASSUM. We keep using the judgment † T <: U ⇒ in the subsequent rules, and switch back to the judgment T <: U ⇒ in the last rule REC below. The remaining rules depend on the shapes of the input types. The first three handle the cases where the left-hand side is either an empty set type, a union type, or a leaf type.. If the left-hand side is an empty set type, we simply return since the relation clearly holds (rule EMPTY). If the left-hand side is the union of two types T and T , we generate two subgoals for these types (rule SPLIT). The intuition behind this rule is the set-theoretic fact that T ∪ T ⊆ U iff T ⊆ U and T ⊆ U . The side conditions card(T ) < card(T | T ) and card(T ) < card(T | T ) ensure that the algorithm makes progress.. If the left-hand side is a leaf type, we check that the right-hand side also contains a leaf type (rule LEAF). The algorithm can fail only at this rule.. In the remaining cases, the left-hand side is a singleton labeled type. for all 1 ≤: j ≤: n, l ≺ l j , for all 1 ≤: i ≤: 2 n , either. The rules PRUNE and PRUNE-LEAF remove from the right-hand side a leaf type and all types with labels l that are not greater than l . The side conditions l (U, U ) ∈ R and ∈ R guarantees that the algorithm proceeds with smaller types. The rule REC handles the other cases-that is, where the right-hand side is the (possibly empty) union of types l j (Y j , Y j ), with all labels l j greater than the label l -using the intuition explained in Section 4.1. We index the subsets of {1, . . . , n} in some arbitrary order from I Figure 1 shows a proof-tree-like diagram that arises when we use the algorithm to check the subtype relation X <: Y , where we assume X and Y are defined in the global tree automaton as follows:. In the figure, we write for {X <: Y }. Notice that when X <: Y is checked for the second time, HYP is used; thus the check terminates. Also, checking † l (X , ) <: l (Y, ) generates a complex form of premises, some of which fail; thus the check involves backtracking.. Intuitively, we can check that the algorithm terminates by reasoning as follows. The process from EMPTY to PRUNE-LEAF obviously terminates because the cardinalities of the types always decrease. In REC, observe that X , X , Y 1 , . . . , Y n , Y 1 , . . . , Y n are always states of the tree automata of the input types. Since the set of such states is finite, the set of unions of such states, for which REC generates subgoals, is also finite. ASSUMP keeps track of all such unions of states that the algorithm encounters, and HYP ensures termination. This argument is formalized in the next section. Our subtype checker implementation embodies the rules in the previous section, plus a number of optimizations specialized to the subtyping problems that arise in practice in the domain of typed XML processing. This section describes several of these techniques. They are categorized into low-level, representational techniques and higher-level heuristics inspired by settheoretic observations.

B I B O B O O B I B O O O O O O B O O B I B O O B O O B O B I O O O O O O O O O O B O O B O O O O O O B O O B O B O O O O O O O O B O O O B O O O O O O O B O B O O O O O O B O O O B O O B B O O O O O O O O O O B O O O O O O B B O O O O O O O O B B O O B B O O O O O O O O O O O O O O B O O O O B O O O O O O O O O O O O O O B O O O O O O O O B O O O O O O O B O O O O O O O O O O O O O O O O B O B O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O B O B O O B O O O O O O O O O O O O O B O B O O O B O O O O O O O O O O O O O O O B O O O O O B O O O O O O O O O O B B O O O O O O O O O O O O O O O O O O O O O B O O B O O O O O O O O O O O O O O O O B O O O O O O O O O O O O B I B O O O O O O O O B O B I B O O O O B I O O O O O O O O B O O B O O O O B O O B O O O B I B O O O O O O B O O O O B O O O O O O O O O B O O O O O O O O O O B O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O B I B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O B O O O O O O O O O O B O O O O O O O O O O O O B O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O B I B O O B O O O O O O O O O O B O O B O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O B O O O O B O O O O B O O O O O B O O O O O O O O O O O O B O O O O B O O O B I B O O O B B O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O B O O O O O O B O O B B O O O O O O O O O O O O O O O O O O O O O O B O O O B O O O O O O O O O O O O O O O O B I B O O O O O O O O B B B O O O O O O O O O O O O B O O O O B O O O O O O O O O B O O O O O O O O O O B O O O B I O B O O O O O O O B O O O O O O O O O O O O O O B O O O O O O O O O O O O B O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O B O O O O O O O O O O O O O B O O O B O O O O O O O O O O O O O O B O O O B O O O O O O O O O O O O O O B O O O O O O O B B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O B O O O B O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O B O B I B O O B O O O O B O O O O O O B I B O B B O O O B B B B O O O O O O O O O O O O O O O B O O O O O O B O O O B B O B O O O O B O O O O O O O O O O O O O O O O O O O B O O O B I B O O O O O O O O B I B O B B O O O O O O B O O O O B O B B O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O B I B O B B O O O O O O O O B I B O B O O O O B O O O O O O O O O O O O B O B O O B B O O O O O B O O O O O O O O O B O O O O O O O O O O B O O O O O O O O O O O B I O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I B O O O O O O B O O O B O B O O O O B O O O O O O O B B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B B O O O O O O O O O O O O O O O O O O B O B O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O B O O O O B O O O O O O O O O O O O O O O O O O O O O O B O O O O B O O O O O O O O O O O O O O O O O O B O O O O O O O O O O B O O O B O O O B O O O B O O O O O O O B O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O B O O O O B O B O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O B O O O O O O O O O O O O O O O O O O O O O O O B O O O O O B O O O O O O O O O O B O O O O O O O O O O O O B I B O O O O O O B O O O O O O O O B O O B O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O B I B O O O O O O O O O O O O O B O O O O O O B O O O O O O B O B I B O O O O O O B B O O B O O O O O O O O O O O O O O O B O O O O O O O O O O O B O B O O O O B B O O O O B I B O O O O B O O B O O O B O O O B O O O O O O O O O O O B B O B O O B O O O O O O O O O O O O O O B I B O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O B O O O O O O O B I B O O O O B O O O O O O O O O O B I B O O O O O O O O O O O O B O O O O O B O O O B B O O O O O O O O O O B B O O O O O O O O O B O O O O O O O O B O O B O O O O B O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O B B O O B I B O O O O B O O O O O O O O O O O B O O O O O B I O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O B I O O O O O B O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O B B O O B O O O O O O O O O O O O O O O O O B I B O O O O O O O O O O O O O O B O O O O O O O O O O O O O O B O O O O O O O B O O O O O O O O O B O B B O O O O O O O B O O O B I O O O O O O O B O O O O O O O O O O O O O O O O O O B O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B B O O O O O O O O O O B O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O B O O O O B O O O O O O O O O O O O O O O O O O O O O B O O O B O O O O O O O B O O O O O O O O O O O O O O O O B O O O O O O B O O O O O O O O O O B O O O O O O O O B O O B O O B O O O O B O O B O B B O O O O O O O O O O O B O O O O O O O O O O O O O O O B O O O B O O O O B O O O O O O O O O O O O B O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B B O B B O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O B B O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O B O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O B O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O B O O O B O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O B O O O O B O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O B O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B B O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O B O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O